akhauriyash/Code-Regression huggingface dataset:
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

const int inf = (int)1e9;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)1e5 + 123;
const int mod = (int)1e9 + 7;

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    string s;
    cin >> s;
    int best = 9 * (sz(s) - 1);
    int sum = 0;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] > '0') {
            best = max(best, sum + (s[i] - '0' - 1) + 9 * (sz(s) - i - 1));
        }
        sum += (s[i] - '0');
    }
    best = max(best, sum);
    cout << best << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
		
    public void solve(){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a < b){
			System.out.println("a < b");
		}else if(a > b){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}
    }
		
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}
				

Measured memory_bytes: 17320
N=int(input())
inlis=[int(i) for i in input().split()]
csum=[0]*(N+1)
for i, v in enumerate(inlis, start=1): csum[i] = csum[i-1] + v

i, k = 1, 3
resmin = 9223372036854775807
# print(csum)
for j in range(2, N-1):
    while abs((csum[i]-csum[0]) - (csum[j]-csum[i])) > abs((csum[i+1]-csum[0]) - (csum[j]-csum[i+1])): i += 1
    while abs((csum[k]-csum[j]) - (csum[N]-csum[k])) > abs((csum[k+1]-csum[j]) - (csum[N]-csum[k+1])): k += 1
    # print("p{} q{} r{} s{}".format(csum[i]-csum[0], csum[j]-csum[i], csum[k]-csum[j], csum[N]-csum[k]))
    # minkamo = max(csum[i]-csum[0], csum[j]-csum[i], csum[k]-csum[j], csum[N]-csum[k]) - min(csum[i]-csum[0], csum[j]-csum[i], csum[k]-csum[j], csum[N]-csum[k])
    # print(i,j,k, minkamo)
    resmin = min(resmin, max(csum[i]-csum[0], csum[j]-csum[i], csum[k]-csum[j], csum[N]-csum[k]) - min(csum[i]-csum[0], csum[j]-csum[i], csum[k]-csum[j], csum[N]-csum[k]))

print(resmin)


Measured memory_bytes: 25672
#include<iostream>

using namespace std;

int main(){

    int n, x, sum = 0, cnt = 0;

    cin >> n >> x;

    int l[n];

    for(int i = 0;i < n;i++){

        cin >> l[i];
    }

    for(int i = 0;i <= n;i++){

        if(sum <= x){
            
            cnt++;
        }

        sum += l[i];
    }

    cout << cnt << endl;

    return 0;
}

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

int N;
vector<vector<int>> G;
vector<int> V;
int ans;

void dfs(int v) {
  if (accumulate(V.begin(), V.end(), 0) == N - 1) {
    ans++;
    return;
  }
  V.at(v) = 1;
  for (auto g : G.at(v)) if (!V.at(g)) dfs(g);
  V.at(v) = 0;
}

int main() {
  int M;
  cin >> N >> M;
  G.resize(N);
  V.resize(N);
  for (int i = 0, a, b; cin >> a >> b; i++) {
    G.at(--a).push_back(--b), G.at(b).push_back(a);
  }
  dfs(0);
  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int l,r,i,n,m,s[100005];
char a[100005];
int main()
{
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=2;i<=n;i++)
    {
        if(a[i]=='C' && a[i-1]=='A')
            s[i]=s[i-1]+1;
        else
            s[i]=s[i-1];
    }
    for(i=1;i<=m;i++)
    {
        cin>>l>>r;
        cout<<s[r]-s[l]<<'\n';
    }
    return 0;
}

Measured memory_bytes: 1280
// Crt. 2019-12-28  19:59:21
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n, a, b;

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n >> a >> b;

    if (a % 2 == b % 2) cout << (max(a, b) - min(a, b)) / 2 << endl;
    else {
        bool op = 0;
        if (b - 1 < a - 1) swap(a, b);
        if (n - b < a - 1) swap(a, b), op = 1;
        if (n - a < a - 1) op = 1;
        if (!op) {
            cout << a + (b - a) / 2;
        }
        else {
            cout << n - a + 1 + (n - (b + n - a + 1)) / 2;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define _for(i,a,b) for(int i = (a);i<(b);i++)
#define endl  '\n'
#define inf 0x3f3f3f3f
#define ull unsigned long long  
using namespace std;
const int mod=1e9+7;
const int MAX=2e5+7;
const double pi=6.28318530717958623200;
//ll a[MAX];
int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	double r;
 	cin>>r;
 	cout<<fixed<<setprecision(20)<<r*pi;
 	
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

const int B = 2018 * 2018;
bitset<B> d;

signed main() {
#ifdef LOCAL
  assert(freopen("c.in", "r", stdin));
#endif
  int n;
  cin >> n;
  vector<int> a(n);
  d[0] = 1;
  int s = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    d |= (d << a[i]);
    s += a[i];
  }
  for (int i = (s + 1) / 2; i <= s; ++i) {
    if (d[i]) {
      cout << i << '\n';
      return 0;
    }
  }
}


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

int main() {
    string S;
    cin >> S;

    ll n = 0, k;
    bool result = true;
    while(n < S.length() && result) {
        ll k = S.length() - n;
        if(k >= 5) {
            string sClip = S.substr(n, 5);
            if(sClip == "dream") {
                n += 5;
                if(k >= 7 && S.substr(n, 2) == "er") {
                    n += 2;
                    if(k >= 8 && S[n] == 'a') {
                        n -= 2;
                    }
                }
            } else if(sClip == "erase") {
                n += 5;
                if(k >= 6 && S[n] == 'r') {
                    n += 1;
                }
            } else {
                result = false;
            }
        } else {
            result = false;
        }
    }

    if(result) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3752
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

##################################
from collections import Counter
N=int(input())
p=10**9+7

tmp=[]
for i in range(1,N+1):
  tmp += prime_factorize(i)
d=dict(Counter(tmp))
ans=1
for i in d:
  ans = ans*(d[i]+1)%p
print(ans)

Measured memory_bytes: 3316
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000;

/* typedef */

typedef vector<int> vi;
typedef pair<int,int> pii;

/* global variables */

int n;
pii tbl[MAX_N];

/* subroutines */

int hms2s(string hms) {
  int h = (hms[0] - '0') * 10 + hms[1] - '0';
  int m = (hms[3] - '0') * 10 + hms[4] - '0';
  int s = (hms[6] - '0') * 10 + hms[7] - '0';
  return h * 3600 + m * 60 + s;
}

/* main */

int main() {
  for (;;) {
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) {
      string shms, ghms;
      cin >> shms >> ghms;
      tbl[i].first = hms2s(shms);
      tbl[i].second = hms2s(ghms);
    }
    sort(tbl, tbl + n);
    
    priority_queue<int,vi,greater<int> > q;
    int wt = 0;

    for (int i = 0; i < n; i++) {
      int st = tbl[i].first;
      int gt = tbl[i].second;

      while (! q.empty() && q.top() <= st)
	q.pop(), wt++;

      if (wt > 0) wt--;
      q.push(gt);
    }

    cout << wt + q.size() << endl;
  }

  return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
int N, u, v;
vector<vint> G(100005);
int mc[100005];

void cdist(int u, int prev, int dist = 0) {
    mc[u] = dist;
    for (auto &v : G[u]) {
        if (v != prev) cdist(v, u, dist + 1);
    }
}

int dfs(int u, int prev, int dist = 0) {
    int ret = mc[u];
    for (auto &v : G[u]) {
        if (v != prev && dist + 1 < mc[v]) ret = max(ret, dfs(v, u, dist + 1));
    }
    return (ret);
}
int main() {
    cin >> N >> u >> v; --u, --v;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b; --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    cdist(v, -1);
    
    cout << dfs(u, -1) - 1 << endl;

    return (0);
}

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

using namespace std;

int main(){
    int m,nmin,nmax;
    while(true){
        cin>>m>>nmin>>nmax;
        if(m==0)break;
        int cnt=0;
        int t=0;
        int gap=0;
        vector<int> p(m);
        for (int i = 0; i < m; ++i) {
            cin>>p[i];
        }
        for (int i = 0; i < m-1; ++i) {
            ++t;
            if(p[i]==p[i+1]){
                while(p[i]==p[i+1]){
                    ++i;
                    ++t;
                }
            }
            if(cnt+t<=nmax){
                if(cnt+t<=nmin||gap<=p[i]-p[i+1]){
                    cnt+=t;
                    t=0;
                    if(cnt>=nmin)gap=p[i]-p[i+1];
                }
            }
            else break;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

typedef long long ll;

int main(){
  int n,i,flag = 0;
  int cnt = 0;
  ll x;
  ll sum = 0;
  ll min = 100100100;

  scanf("%d", &n);

  for(i = 0;i < n;i++){
    scanf("%lld", &x);
    sum += abs(x);

    if(x == 0) flag = 1;

    if(x < 0) cnt++;

    if(min > abs(x)) min = abs(x);
  }


  if((cnt % 2) == 0) flag = 1;

  if(flag == 1) printf("%lld\n", sum);

  else printf("%lld\n", sum - 2*min);


  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

#define N 100002
#define llint long long int

llint binarySearch(int key, int array[N], llint val_array[N], int length){
  int left = 1;
  int right = length+1;

  while(left < right){
    int mid = (left+right)/2;
    if (array[mid] <= key){
      left = mid+1;
    } else {
      right = mid;
    }
    
  }
  return val_array[left];
}

int main(void){
  int n;
  int a[N], b[N], c[N];
  
  std::cin >> n;


  for(int i=1; i<=n; i++){
    std::cin >> a[i];
  }
  for(int i=1; i<=n; i++){
    std::cin >> b[i];
  }
  for(int i=1; i<=n; i++){
    std::cin >> c[i];
  }

  
  std::sort(a+1, a+n+1);
  std::sort(b+1, b+n+1);
  std::sort(c+1, c+n+1);

  

  llint dpa[N] = {};
  llint dpb[N] = {};
  llint dpc[N] = {};

  dpa[0] = n;
  dpb[0] = n;
  dpc[0] = n;
  //dpc[n+1] = 0;
  for(int i=1; i<=n; i++){
    dpc[i] = n-i+1;
  }

  for(int i=1; i<=n; i++){
    dpb[i] = binarySearch(b[i], c, dpc, n);
  }

  for(int i=1; i<=n;i++){
    dpb[n-i+1] += dpb[n-i+2];
  }
  
  for(int i=1; i<=n; i++){
    dpa[i] = binarySearch(a[i], b, dpb, n);
  }


  llint result = 0;
  for(int i=1; i<=n; i++){
    result += dpa[i];
  }

  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.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;}


int main(){
  double r;
  cin >> r;

  cout << fixed << setprecision(10) << 2*M_PI*r;

}


Measured memory_bytes: 3784
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n,m;
	cin>>n>>m;
	vvint vv;
	initvv(vv, n, m);
	rep(i,n){
		rep(j,m){
			cin>>vv[i][j];
			vv[i][j]--;
		}
	}
	// sort(ALL(vv));
	int ans = n;
	set<int> used;
	while(used.size()<m){
		vint cnt(m);
		rep(i,n){
			rep(j,m){
				if(used.find(vv[i][j])==used.end()){
					cnt[vv[i][j]]++;
					break;
				}
			}			
		}
		int mx = 0;
		rep(i,m) maxs(mx, cnt[i]);
		mins(ans, mx);
		rep(i,m){
			if(cnt[i] >= ans) used.insert(i);
		}
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1002
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int main(){
	int a[4], b[2], ans = 0;
	rep(i,4)scanf("%d", &a[i]);
	scanf("%d%d", &b[0], &b[1]);
	sort(a, a+4);sort(b, b+2);
	ans = a[1]+a[2]+a[3]+b[1];
	printf("%d\n", ans);
	return 0;
}

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
	int n, k;
	cin >> n >> k;
	COMinit();
	for(int i = 1; i <= k; ++i){
		cout << COM(k-1, i-1) * COM(n-k+1, i) % MOD << endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

int main(void) {
    vector<char> p(2e5, 1);
    p[0] = p[1] = 0;
    for(ll i=2; i<2e5; i++) {
        if(!p[i]) continue;
        for(ll j=2; i*j<2e5; j++)
            p[i*j] = 0;
    }
    vector<ll> pp(2e5);
    for(ll i=0; i<2e5; i++)
        pp[i] = p[i] && p[(i+1)/2];
    for(ll i=1; i<2e5; i++)
        pp[i] += pp[i-1];

    ll q;
    cin >> q;

    for(ll i=0; i<q; i++) {
        ll l, r;
        cin >> l >> r;
        r++;
        cout << pp[r-1] - pp[l-1] << endl;
    }

}


Measured memory_bytes: 2432
#include<stdio.h>
#define MAX 5000000
 
int heapsize;
int A[MAX];
int p(int heap){
    return heap/2;
}
int l(int heap){
    return heap*2;
}
int r(int heap){
    return (heap*2+1);
}
 
main(){

    int i,left,right;
    scanf("%d",&heapsize);
     
    for(i = 1;i <= heapsize;i++){
        scanf("%d",&A[i]);
    }
    buildMaxHeap();
    for(i = 1;i <= heapsize;i++)
    printf(" %d",A[i]);
    printf("\n");
   
    return 0;
}
 
int maxHeapify(i){
    int largest;
    int left = l(i);
    int right = r(i);
    if(left <= heapsize && A[i]< A[left]){
        largest = left;
    }else{
        largest = i;
    }
    if(right <= heapsize && A[right] > A[largest]){
        largest = right;
    }
    if(largest != i){
        int tmp;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
    maxHeapify(largest);
    }
}
int buildMaxHeap(){
    int i;
    for(i = (heapsize/2); i >= 1;i--){
        maxHeapify(i);
    }
    
}

Measured memory_bytes: 2552
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int N = 1e5+10;
typedef long long LL;
const LL mod = 1e9+7;
int a[N];

int main()
{
    int n;
    while(scanf("%d", &n)!=EOF)
    {
        for(int i=2;i<=n;i++)
        {
            int x=i;
            for(int j=2;j<=x;j++)
            {
                while(x%j==0)
                {
                    a[j]++;
                    x/=j;
                }
            }
            if(x!=1) a[x]++;
        }
        LL ans=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]!=0) ans=(ans*(a[i]+1))%mod;
        }
        printf("%lld\n",ans);
    }
    return 0;
}
































Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500001
#define SENT 2000000000
 
 int S[MAX],n,cnt;

 
 int merge(int left,int right,int mid){
             int n1,n2,i,j,k,R[MAX],L[MAX];
             n1=mid-left;
             n2=right-mid;
             for(i=0;i<n1;i++){L[i]=S[left+i];}
             for(i=0;i<n2;i++){R[i]=S[mid+i];}
            L[n1]=R[n2]=SENT;

             i=0;j=0;
             for(k=left;k<right;k++){
                        if(L[i]<=R[j]){S[k]=L[i];i++;cnt++;}
                        else {S[k]=R[j];j++;cnt++;}
                        }
             }

 int mergesort(int left,int right){
       if(right-left>1){
             int mid=(left+right)/2;
             mergesort(left,mid);
             mergesort(mid,right);
             merge(left,right,mid);
             }
       }

 int main(){
       int i;
       cnt=0;
       scanf("%d",&n);
       for(i=0;i<n;i++){
                  scanf("%d",&S[i]);
                  }
       mergesort(0,n);
       for(i=0;i<n;i++){
              printf("%d%c",S[i],i==n-1?'\n':' ');
                  }
       printf("%d\n",cnt);
       return 0;
       }


Measured memory_bytes: 5612
n = int(input())
a =  [input() for i in range(n)]
if len(set(a)) != n:
    print("No")
    exit()
aold = a[0][0]
for i in a:
    if aold != i[0]:
        print("No")
        break
    aold = i[-1]
else:
    print("Yes")

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int M = 107;

void read() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (s[i] == 'C' && s[j] == 'F') {
        cout << "Yes\n";
        return;
      }
  cout << "No\n";
}


void kill() {

}

int main() {
  cout.precision(20);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  read();
  kill();
}


Measured memory_bytes: 256
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int median(vector<int> v) {
    int size = v.size();
    sort(all(v));
    if (size % 2 == 1) {
        return v[(size - 1) / 2];
    } else {
        return (v[(size / 2) - 1] + v[size / 2]) / 2;
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i < n; i++){
        b[i] = a[i] - (i + 1);
    }
    int mid = median(b);
    ll sum = 0;
    for (auto t : b){
        sum += abs(t - mid);
    }
    cout << sum << endl;
        



    return 0;
}


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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}

int arr[2001], n, k, q;

int helper(int minimum){
    vector<int> low = {}, cur = {};
    for(int i = 0; i < n; ++i){
        if(arr[i] >= minimum) cur.push_back(arr[i]);
        if(i == n - 1 || arr[i] < minimum){
            int grab = cur.size() - k + 1;
            sort(cur.begin(), cur.end());
            for(int j = 0; j < grab; ++j)
                low.push_back(cur[j]);
            cur.clear();
        }
    }
    sort(low.begin(), low.end());
    if(low.size() < q)
        return 2e9;
    return low[q - 1] - low[0];
}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> n >> k >> q;

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

    int best = 2e9;

    for(int i = 0; i < n; ++i)
        best = min(best, helper(arr[i]));

    cout << best << "\n";

    return 0;

}


Measured memory_bytes: 256
S = input()
T = input()

t2s = {}
s2t = {}

for s, t in zip(S, T):
    if s2t.get(s, t) != t:
        print('No')
        break
    if t2s.get(t, s) != s:
        print('No')
        break
    s2t[s] = t
    t2s[t] = s
else:
    print('Yes')


Measured memory_bytes: 9432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out, n) for(int i=0; i<n; i++) cout<<out[i]<<endl

int binary_search(const vector<ll>& a ,ll key){
    int ng=-1, ok=(int)a.size();
    while(abs(ok-ng)>1){
        int mid=(ok+ng)/2;
        if(a[mid] >= key){
            ok=mid;
        }else{
            ng=mid;
        }
    }
    return ok;
}



int main(){
    ll N; cin>>N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll> C(N);
    forin(A, N); sort(A.begin(), A.end());
    forin(B, N);
    forin(C, N);
  	for(int i=0;i<N;i++){
      C[i]=C[i]*(-1);
    }
  	sort(C.begin(), C.end());

    ll ans=0;
    for(int i=0; i<N; i++){
        ll A2=binary_search(A, B[i]), C2=binary_search(C, -B[i]);
        ans+=A2*C2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5632
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
  int x[100],top=0;
  char s[100];
  while(scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      top--;
      x[top]=x[top]+x[top+1];
    }
    else if ( s[0] == '-' ){
      top--;
      x[top]=x[top]-x[top+1];
    }
    else if ( s[0] == '*' ){
      top--;
      x[top]=x[top]*x[top+1];
    } 
    else {
      top++; 
      x[top] = atoi(s);
    } 
  }
  printf("%d\n",x[1]);
  return 0;
}


Measured memory_bytes: 2108
use std::io::Read;

fn solve(g : &Vec<Vec<usize>>, pos : usize, prev : usize) -> u32 {
    let mut res = 0;
    for &t in &g[pos] {
        if t == prev { continue }
        res ^= solve(g, t, pos) + 1;
    }
    res
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let mut g = vec![Vec::new(); n];
    for _ in 0..n-1 {
        let x = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y = it.next().unwrap().parse::<usize>().unwrap() - 1;
        g[x].push(y);
        g[y].push(x);
    }
    println!("{}", if solve(&g, 0, n) != 0 { "Alice" } else { "Bob" });
}


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

const int N=1e5+5;


void init();
void work();
int ca=1;
int main(){
//    freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
//    init();
//    int T;cin>>T;
//    while(T--)
    work();
    return 0;
}
void work(){
    ll n;cin>>n;
    ll sum=n*(n+1)/2;
    sum-=(n/3*(n/3+1))/2*3,sum-=(n/5*(n/5+1))/2*5;
    ll t=n/15;
    sum+=t*(t+1)/2*15;
    cout<<sum;
}


Measured memory_bytes: 3600
A, B, C = map(int, input().split())
K = int(input())


def combinations(k):
    result = []
    for b in range(k + 1):
        for c in range(k + 1 - b):
            result.append([b, c])

    return result


def magic(A, B, C, K):
    if A < B < C:
        return True

    for l in combinations(K):
        a, b, c = A, B, C
        b_count, c_count = l
        if b_count > 0:
            b *= 2 ** b_count
        if c_count > 0:
            c *= 2 ** c_count

        if a < b < c:
            return True

    return False


if (magic(A, B, C, K)):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9136
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define mem(x,y)		(x*)malloc(sizeof(x)*(y))
#define PI 3.14159265358979

int list_sort(const void* a,const void* b)
{
	if((*(int**)a)[1] > (*(int**)b)[1])
	{
		return 1;
	}
	else if((*(int**)a)[1] == (*(int**)b)[1])
	{
		if((*(int**)a)[0] < (*(int**)b)[0])
		{
			return 1;
		}
		else if((*(int**)a)[0] == (*(int**)b)[0])
		{
			return 0;
		}
	}
	return -1;
}

int find(int***data,int* len,int n,int k)
{
	int table[10][k];
	int i,j,l;
	table[0][0] = data[0][0][0];
	for(i = 1;i < k;i++)
	{
		if(len[0] <= i)
			table[0][i] = 0;
		else
		{
			table[0][i] = table[0][i-1]+data[0][i][0];
		}
	}
	for(i = 1;i < 10;i++)
	{
		if(len[i] == 0)
		{
			for(j = 0;j < k;j++)
			{
				table[i][j] = table[i-1][j];
			}
			continue;
		}
		if(table[i-1][0] < data[i][0][0])
		{
			table[i][0] = data[i][0][0];
		}
		else
		{
			table[i][0] = table[i-1][0];
		}
		for(j = 1;j < k;j++)
		{
			int max = 0;
			int sum = 0;
			for(l = 0;l <= j;l++)
			{
				if(sum + table[i-1][j-l] > max)
				{
					max = sum + table[i-1][j-l];
				}
				if(l == len[i])
					break;
				sum += data[i][l][0];
			}
			if(sum > max)max = sum;
			table[i][j] = max;
		}
	}
	return table[9][k-1];
}

int main()
{
	int n,k;
	int** list;
	int*** data;
	int* score;
	int i,j,l;
	scanf("%d %d",&n,&k);
	list = mem(int*,n);
	data = mem(int**,10);
	for(i = 0;i < n;i++)
	{
		list[i] = mem(int,2);
		scanf("%d %d",&list[i][0],&list[i][1]);
	}
	qsort(list,n,sizeof(int*),list_sort);
	j = 0;
	l = 0;
	int len[10];
	for(i = 0;i < 10;i++)
	{
		data[i] = &list[j];
		while(j < n && list[j][1] == i+1)
		{
			list[j][0] += l*2;
			j++;
			l++;
		}
		len[i] = l;
		l = 0;
	}
	int max = find(data,len,n,k);
	printf("%d\n",max);
	return 0;
}

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

using namespace std;

int main() {
	int n;
	int t[110];
	int sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		sum += t[i];
	}
	int ans[110];
	int m;
	int p[110];
	int x[110];
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> p[i] >> x[i];
		int k = p[i] - 1;
		ans[i] = sum - t[k] + x[i];
	}
	for (int i = 0; i < m; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

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

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

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

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)

var n, m, q int

var pairs [][]int

//https://youtu.be/C5_NnCp1CRI?t=1778
//組み合わせを全部列挙
func dfs(A []int) int {
	if len(A) == n+1 {
		var sum int
		for _, p := range pairs {
			if A[p[1]]-A[p[0]] == p[2] {
				sum += p[3]
			}
		}
		return sum
	}

	var ans int
	for i := 1; i <= m; i++ {
		//1つ前が、iより大きい場合はスキップ
		if A[len(A)-1] > i {
			continue
		}
		ans = maxInt(dfs(append(A, i)), ans)
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m, q = nextInt(), nextInt(), nextInt()
	for i := 0; i < q; i++ {
		pair := make([]int, 4)
		pair[0], pair[1], pair[2], pair[3] = nextInt(), nextInt(), nextInt(), nextInt()
		pairs = append(pairs, pair)
	}

	//dfsの処理がしやすいように、[1]で初期化
	A := []int{1}
	fmt.Println(dfs(A))
	//fmt.Println(N, M, Q, pairs)

}


Measured memory_bytes: 5012
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > G;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};
string Psb[2] = {"Impossible", "Possible"};
string psb[2] = {"impossible", "possible"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t));
    reverse(all(t));
    cout << Yes[s < t];
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
import math
X = int(input())
A, B = 1, 1


def is_ok(i, x):
    return pow(i, 5) >= x


def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok


ss = math.ceil(X ** (1 / 4)) + 10
for a in range(1, math.ceil(X ** (1 / 4)) + 10):
    tmp = abs(pow(a, 5) - X)
    b = bisect(-1, ss, tmp)
    if tmp == pow(b, 5):
        A = a
        if a ** 5 - X > 0:
            B = b
        else:
            B = -1 * b
        break
print(A, B)


Measured memory_bytes: 63260
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+5;
char s[N];
int main(){
	int num=0;scanf("%s",s);
	for(int i=0;s[i];i++)(num+=s[i]-'0')%=9;
	if(num)puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 3948
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
 
        if( x-r < 0 || x+r > W || y-r < 0 || y+r > H){
        System.out.println("No");
        }else System.out.println("Yes");{
}   
}
}


Measured memory_bytes: 26216
#include <iostream>

int main(){
    using namespace std;

    int n , res{};
    cin >> n;

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

    for(int i = 1 ; i < n - 1 ; i++){
        int temp[3];
        for(int j = -1 ; j < 2 ; j++)
            temp[j + 1] = arr[i + j];

        for(int j = 0 ; j < 3 ; j++){
            for(int k = j + 1 ; k < 3 ; k++)
                if(temp[j] > temp[k])
                    swap(temp[j] , temp[k]);
        }

        if(arr[i] == temp[1])
            res++;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
 
public class Main{
	
	static final Scanner s=new Scanner(System.in);
	
	
	static final int[]
			dx={0,1,0,-1},
			dy={-1,0,1,0};
	
	public static void main(String[]args){
		int r=s.nextInt(),c=s.nextInt();
		Point start=new Point(0,0);
		Point goal =new Point(r-1,c-1);
		
		char[][] f=new char[r][];
		for(int i=0;i<r;i++) f[i]=s.next().toCharArray();
		
		ArrayDeque<Point> deque=new ArrayDeque<>();
		deque.add(start);
		
        int count=0;
        int siro=0;
        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
                if(f[i][j]=='.'){
                    siro++;

                }
            }
        }
        boolean yey=true;
		outer:
		for(;true;count++){
			for(int i=deque.size();i>0;i--) {
				Point poll=deque.poll();
				if(poll.equals(goal)) {
					break outer;
				}
				for(int j=0;j<4;j++) {
                    if((poll.x+dx[j]>=0)&&(poll.x+dx[j]<r)&&(poll.y+dy[j]>=0)&&(poll.y+dy[j]<c)){
					if(f[poll.x+dx[j]][poll.y+dy[j]]=='.') {
						f[poll.x+dx[j]][poll.y+dy[j]]='#';
						deque.add(new Point(poll.x+dx[j],poll.y+dy[j]));
						
						//for(char[]ch:f)System.out.println(Arrays.toString(ch));
					}}
                }
                if(deque.size()==0){
                    yey=false;
                    System.out.println(-1);
                    break outer;
                }
			}
        }
        if(yey){
        System.out.println(siro-1-count);}
		
	}
}


Measured memory_bytes: 23888
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
using ll = long long;

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

int main(){
    char str;
    cin >> str;
    if(str == 'a' ||str == 'i' ||str == 'u' ||str == 'e' ||str == 'o' )
        cout << "vowel" << endl;
    else 
        cout << "consonant" << endl;

    return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> adj[n + 1];
    int h[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    int ans=0;
    for (int i = 1; i <= n; i++)
    {
        int hi = 0;
        for (auto it : adj[i])
        {
            hi = max(hi, h[it]);
        }
        if(h[i]>hi)
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 9092
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#define _GLIBCXX_DEBUG
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 long long INF = 100100100100100;
const int MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int main() {
    int X;cin >> X;
    long long ans = 1;
    for(int i = 1;i<X;i++){
        for(int j = 2;j<=10;j++){
            long long A = pow(i,j);
            if(A <= X) ans = max(ans,A);
        }
    }

    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}

Measured memory_bytes: 256
using System;

class Program
{
  static void Main()
  {
    var N = int.Parse(Console.ReadLine());
    var answer = "No";
    for (int i=0; i<=N/4; i++)
    {
      for (int j=0; j<=N/7; j++)
      {
        if ( 4*i + 7*j == N ) answer = "Yes";
      }
    }
    Console.WriteLine(answer);
  }
}

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

int main() {
	int n,m;
	string k = "No";
	cin >> n >> m;
	vector<string> a(n),b(m);
	for(int i = 0;i < n;i++)
	{
		cin >> a.at(i);
	}
	for(int i = 0;i < m;i++)
	{
		cin >> b.at(i);
	}
	for(int i = 0;i < n - m + 1;i++)
	{
		for(int j = 0;j < n - m + 1;j++)
		{
			int loo = 0;
			for(int l = 0;l < m;l++)
			{
				if(b.at(l) != a.at(j + l).substr(i,m))
				{
					loo = 1;
					break;
				}
			}
			if(loo == 0)
			{
				k = "Yes";
				break;
			}
		}
		if(k == "Yes")
		{
			break;
		}
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
# 2019 6/16
# ABC130 Rectangle Cutting

W, H, x, y = list(map(int, input().split()))

mid_W = W / 2
mid_H = H / 2

if x == mid_W and y == mid_H:
    print(W * H / 2, 1)

elif x == 0 or y == 0:
    square = W * H / 2
    print(square, 0)

else:
    # L = H * x
    # R = H * (W - x)
    # LR_div = min(L, R)
    #
    # U = W * (H - y)
    # D = W * y
    # UD_div = min(U, D)
    #
    # square = max(LR_div, UD_div)

    print(H * W / 2, 0)


Measured memory_bytes: 3060
n = gets.to_i

k = []
n.times do
  a, b = gets.split.map(&:to_i)
  k << [a, b]
end
k.sort_by! { |a, b| -a - b }
ans = 0
n.times do |i|
  ans += (i.even? ? k[i][0] : -k[i][1])
end
p ans

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

int main()
{
    int n;
    cin>>n;
    if(n>=400 && n<600) cout<<8<<endl;
    else if(n>=600 && n<800) cout<<7<<endl;
    else if(n>=800 && n<1000) cout<<6<<endl;
    else if(n>=1000 && n<1200) cout<<5<<endl;
    else if(n>=1200 && n<1400) cout<<4<<endl;
    else if(n>=1400 && n<1600) cout<<3<<endl;
    else if(n>=1600 && n<1800) cout<<2<<endl;
    else if(n>=1800 && n<2000) cout<<1<<endl;
   
}

/// A L H A M D U L I L L A H

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

    int n, m, a;

int main(){

    cin >> n >> m;

    for(int i=1; i<n; i++)
        a += i;

    for(int i=1; i<m; i++)
        a += i;

    cout << a;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;


const long long int mod = 1000000007, INF = 100000000000000;

//階乗先に計算
long long int kaizyou[200005] = { 1 };
long long int kai(long long int a, long long int b, long long int mod) {
	long long int tmp = 1;
	for (long long int i = a; i <= b; i++) {
		tmp *= i;
		tmp %= mod;

		kaizyou[i] = tmp;
	}
	return tmp;
}


//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
long long int rui(long long int a, long long int b, long long mod) {
	int memo[65] = {};
	long long int A[65] = {};
	long long int tmp = 1;
	for (int i = 0; i < 65; i++) {
		memo[i] = b % 2;
		b /= 2;
	}

	A[0] = a;
	A[0] %= mod;

	for (int i = 1; i < 65; i++) {
		A[i] = A[i - 1] * A[i - 1];
		A[i] %= mod;
	}
	for (int i = 0; i < 65; i++) {
		if (memo[i] == 1) {
			tmp *= A[i];
			tmp %= mod;
		}
	}
	tmp %= mod;
	return tmp;
}

//コンビネーション計算
long long int comb(long long int n, long long int r, long long int mod) {
	long long int tmp;

	tmp = (kaizyou[n] * rui(kaizyou[r], mod - 2, mod)) % mod;
	tmp *= rui(kaizyou[n - r], mod - 2, mod);
	tmp %= mod;
	if (tmp < 0) { tmp = (mod - tmp) % mod; }
	return tmp;
}



long long int N, M, Q, L[200005], R[200005], p[100005], q[100005], num[700][700] = {}, num2[700][700] = {};
int main() {
	cout << fixed << setprecision(10);
	kai(1, 200000, mod);
	cin >> N>>M>>Q;
	for (int i = 0; i < M; i++) {
		cin >> L[i] >> R[i];
		num[L[i]][R[i]]++;
	}

	for (int i = 0; i <= N-1; i++) {
		for (int j = 1; j <= N-i; j++) {
			num2[j][i + j] += num2[j][i - 1 + j];
			for (int k = j; k <= i+j; k++) {
				num2[j][i + j] += num[k][i + j];
			}
		}
	}

	for (int i = 0; i < Q; i++) {
		cin >> p[i] >> q[i];
		cout << num2[p[i]][q[i]] << endl;
	}
}


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

using namespace std;

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

  int N, M, s, c;
  cin >> N >> M;
  if (M == 0) {
    cout << vector<int>{0, 10, 100}[N-1] << endl;
    return 0;
  }

  string res = string(N, '0');
  vector<bool> seen(N, false);

  while (M--) {
    cin >> s >> c;
    --s;
    char cc = (char)('0'+c);
    if (seen[s] && res[s] != cc) {
      cout << -1 << endl;
      return 0;
    }
    if (N > 1 && s == 0 && c == 0) {
      cout << -1 << endl;
      return 0;
    }
    res[s] = cc;
    seen[s] = true;
  }

  if (N > 1 && res[0] == '0') res[0] = '1';
  cout << res << endl;

	return 0;
}



Measured memory_bytes: 256
use std::io::stdin;fn main(){let mut t=String::new();stdin().read_line(&mut t).unwrap();let s:Vec<char>=t.trim().chars().collect();let mut f:usize=0;let mut e:usize=1;let mut r:i64=1;for i in 2..(s.len()+1){if s[f..e]!=s[e..i]{f = e;e = i;r+=1;}};println!("{}", r)}

Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  int[] nums = new int[n+1];
	  nums[0] = sc.nextInt();
	  
	  for (int i = 1; i < n + 1; i++) {
		  nums[i] = sc.nextInt();
	  }
	    
	  Arrays.sort(nums);
	  if (nums.length == 2) {
		  System.out.println(nums[1] - nums[0]);
		  System.exit(0);
	  }
	  int gcd = nums[1] - nums[0];
	  int distance = nums[1] - nums[0];
	  boolean isAllTheSame = true;
	  
	  for (int i = 2; i < nums.length; i++) {
		  int d = nums[i] - nums[i-1];
		  gcd = gcd(gcd, d);
		  if (d != distance) { isAllTheSame = false; }
		  distance = d;
	  }
	  
	  if (isAllTheSame) {
		  System.out.println(distance);
		  System.exit(0);
	  }
	  
	  System.out.println(gcd);
	  System.exit(0);
  }
  
  private static int gcd(int m, int n) {
	  if (m < n) {
		  return gcd(n, m);
	  }
	  
	  if (n == 0) {
		  return m;
	  }
	  
	  return gcd(n, m % n);
  }
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

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

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

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 34936
using System;

class Program {
  static void Main(string[] args) {
    string[] buf = Console.ReadLine().Split(' ');
    int W = int.Parse(buf[0]);
    int H = int.Parse(buf[1]);
    int N = int.Parse(buf[2]);
    int x0 = 0;
    int y0 = 0;
    int rep = 0;

    for(int i = 0; i < N; ++i) {
      buf = Console.ReadLine().Split(' ');
      int x = int.Parse(buf[0]);
      int y = int.Parse(buf[1]);
      int a = int.Parse(buf[2]);

      if(a == 1 && x0 < x) x0 = x;
      if(a == 2 && W  > x) W  = x;
      if(a == 3 && y0 < y) y0 = y;
      if(a == 4 && H  > y) H  = y;
    }
    rep = (x0 < W && y0 < H) ? (W - x0) * (H - y0) : 0;
    
    Console.WriteLine(rep);
  }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) 
	{
		S.at(i) = 'x';
	}
	for (int i = 0; i < S.size(); i++) 
	{
		cout << S.at(i);
	}
	cout << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second


int main(){
    ll n;
    cin >> n;
    ll dp[3][10] = {};
    string s;
    cin >> s;
    rep(k,0,s.size()){
        ll i = s.size()-k-1;
        ll temp = 0,temp2 = 0;
        rep(j,0,10){
            temp += dp[0][j];
            temp2 += dp[1][j];
        }
        dp[0][s[i] - '0'] = 1;
        if(k > 0) dp[1][s[i] - '0'] = temp;
        if(k > 1) dp[2][s[i] - '0'] = temp2;
    }

    ll ans = 0;
    rep(i,0,10) ans += dp[2][i];
    cout << ans << endl;

    return 0;
}


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

int main()
{
	int N;
	cin >> N;
	int mi = 1e9+5, ma = 0;
	rep(i,N)
	{
		cin >> A[i];
		mi = min(mi,A[i]);
		ma = max(ma,A[i]);
	}
	cout << ma - mi << endl;
	return 0;
}

Measured memory_bytes: 256