akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// #define int long long

const int N=2005,inf=1e9;
int dp[N][N],a[3*N],mx[N],n,cnt=0,ans=0;

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n ;
    for(int i=0;i<3*n;i++)
        cin >> a[i];
    fill(*dp,*dp+N*N,-inf);
    dp[a[0]][a[1]]=0,dp[a[1]][a[0]]=0;
    mx[a[0]]=a[1],mx[a[1]]=a[0];
    for(int i=1;i<n;i++){
        int v[]={a[3*i-1],a[3*i],a[3*i+1]};
        vector <tuple <int,int,int> > vec;
        auto udt=[&](int x,int y,int z){
        	vec.push_back({x,y,z});
        };
        sort(v,v+3);
        if(v[0]==v[2]){
            cnt++;continue;
        }
        for(int j=0;j<3;j++){
            for(int k=0;k<j;k++)udt(v[j],v[k],ans);
            for(int k=1;k<=n;k++)udt(k,v[j],dp[k][mx[k]]);
        }
        if(v[0]==v[1]){
            int x=v[0],y=v[2];
            for(int k=1;k<=n;k++){
            	udt(y,k,dp[x][k]+1);
            }
        }
        if(v[1]==v[2]){
            int x=v[1],y=v[0];
            for(int k=1;k<=n;k++){
            	udt(y,k,dp[x][k]+1);
            }
        }
        for(int j=0;j<3;j++){
            int x=v[j],y=v[(j+1)%3],z=v[(j+2)%3];
            udt(y,z,dp[x][x]+1);
        }
        for(auto [x,y,z]:vec){
        	dp[x][y]=max(dp[x][y],z),dp[y][x]=dp[x][y];
            ans=max(ans,z);
            if(dp[x][y]>dp[x][mx[x]])mx[x]=y;
            if(dp[x][y]>dp[y][mx[y]])mx[y]=x;
        }
    }
    ans=max(ans,dp[a[3*n-1]][a[3*n-1]]+1);
    cout << ans+cnt;
}


Measured memory_bytes: 19476
#include <stdio.h>
#include <stdlib.h>

int nextSel (int *sel, int n)
{
    int i, j, k, tmp;
    for (i = n - 1; (i > 0) && (sel[i - 1] <= sel[i]); i--);
    if (i == 0) return 0;
    tmp = sel[i - 1]; sel[i - 1] = sel[i]; sel[i] = tmp;
//    printf ("swap %d %d\n", i - 1, i);
    if (i < n - 1) {
        for (j = 1; (i + j) <= ((i + n)/2); j++) {
//            printf ("swap %d %d\n", i + j, n - j);
            tmp = sel[i + j]; sel[i + j] = sel[n - j]; sel[n - j] = tmp;
        }
    }
    return 1;
}

int main (void)
{
    int N;
    long A[100], selA[2];
    int select[100];
    long result, tmp;
    scanf("%d", &N);
    int i, j;
    for (i = 0; i < N; i++) {
        scanf("%ld", &A[i]);
        select[i] = 0;
    }
    for (i = 0; i < 2; i++) {
            select[i] = 1;
    }
    result = selA[0] = selA[1] = 0;
    do {
        j = 0;
        for (i = 0; i < N; i++) {
            if (select[i] == 1) {
                selA[j] = A[i] * select[i];
                j++;
            }
        }
        tmp = labs(selA[1] - selA[0]);
        result = (result < tmp)? tmp: result;
    } while (nextSel(select, N));

    printf("%ld", result);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>

using namespace std;

int main(void){

  int N;
  cin >> N;

  vector<int> X(N);
  vector<int> X_origin(N);  
  
  for(int i=0;i<N;i++){
    cin >> X[i];
    X_origin[i]=X[i];
  }

  sort(X.begin(),X.end());
  
  for(int i=0;i<N;i++){
    if(X[N/2-1] >= X_origin[i] ){
      cout << X[N/2 ] << endl;
    }
    else{
      cout << X[N/2 -1] << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

int main (void) {

  int N, M, Q; std::cin >> N >> M >> Q;

  std::vector<std::vector<int>> K(N, std::vector<int>(N));
  std::vector<std::vector<int>> S(N, std::vector<int>(N));
  for(int i=0; i<M; i++) {
    int L, R; std::cin >> L >> R;
    K[L-1][R-1] += 1;
  }

  // build Sum
  S[0][0] = K[0][0];
  for(int i=0; i<N; i++) {
    for(int j=0; j<N; j++) {
      if ( j == 0 && i == 0 ) S[0][0] = K[0][0];
      else if ( j == 0 && i != 0 ) S[i][j] = S[i-1][j] + K[i][j];
      else if ( j != 0 && i == 0 ) S[i][j] = S[i][j-1] + K[i][j];
      else if ( i != 0 ) S[i][j] = S[i][j-1] + S[i-1][j] + K[i][j] - S[i-1][j-1];
    }
  }

  for(int i=0; i<Q; i++) {
    int l, r; std::cin >> l >> r;
    l-=1; r-=1;
    if ( l != 0 ) std::cout << S[r][r] - S[l-1][r] - S[r][l-1] + S[l-1][l-1] << std::endl;
    else std::cout << S[r][r] << std::endl;
  }

  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
    int main(){
        int a, b, c;
        int sum = 0;
            cin >> a >> b;
        c = b - a;
            for(int i = 1; i <= c; i++){
                sum += i;
            }
                cout << sum - b;
        /*int sum = 0;
        for(int i = 1; i < 1000; i++){
            sum += i;
        }
            cout << sum;*/
    }


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

using namespace std;

#define ll long long
#define ull unsigned long long

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

    int n, k;
    cin >> n >> k;
    vector<int> cnt(n + 1, 0);
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int x;
            cin >> x;
            cnt[x]++;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (cnt[i] == 0);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
  int N, T, A, H, dN;
  double tmp, diff_tmp, diff=1000000;
  cin >> N >> T >> A;
  for (int i=0; i < N; i++) {
    cin >> H;
    tmp = T - H * 0.006;
    diff_tmp = (double)abs(A - tmp);
    if(diff_tmp < diff) {
      diff = diff_tmp;
      dN = i;
    }
  }
  cout << dN + 1 << endl;
  return 0;
}



Measured memory_bytes: 256
while True:
    try:
        board=[[0 for i in range(14)],[0 for i in range(14)],[0 for i in range(14)]]
        for i in range(8):
            row=[0,0,0]+[int(j) for j in input()]+[0,0,0]
            board.append(row)
        board.append([0 for i in range(14)])
        board.append([0 for i in range(14)])
        board.append([0 for i in range(14)])

        for i in range(3,11):
            for j in range(3,11):
                if board[i][j]==0:
                    continue

                if board[i][j]==1 and board[i+1][j]==1 and board[i][j+1]==1 and board[i+1][j+1]==1:
                    block="A"
                elif board[i][j]==1 and board[i+1][j]==1 and board[i+2][j]==1 and board[i+3][j]==1:
                    block="B"
                elif board[i][j]==1 and board[i][j+1]==1 and board[i][j+2]==1 and board[i][j+3]==1:
                    block="C"
                elif board[i][j]==1 and board[i+1][j]==1 and board[i+1][j-1]==1 and board[i+2][j-1]==1:
                    block="D"
                elif board[i][j]==1 and board[i][j+1]==1 and board[i+1][j+1]==1 and board[i+1][j+2]==1:
                    block="E"
                elif board[i][j]==1 and board[i+1][j]==1 and board[i+1][j+1]==1 and board[i+2][j+1]==1:
                    block="F"
                elif board[i][j]==1 and board[i][j+1]==1 and board[i+1][j-1]==1 and board[i+1][j]==1:
                    block="G"
        print(block)
        input()


    except EOFError:
        break



Measured memory_bytes: 5632
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int Max = 10 + 1e8;
int main()
{ 
	int n;
	cin >> n;
	int ans = 0;
	int cnt = 0;
	rep(i, n) {
		int a; cin >> a;
		int t = cnt + 1;
		if (t != a)
			ans++;
		else
			cnt++;
	}
	if (cnt == 0)
		cout << -1;
	else
		cout << ans;
}



Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,k;
  cin >> n >> k;
  
  if (k == 0) {
    cout << n * n << endl;
    return 0;
  }
  
  long l=0;
  for (int b = k + 1; b <= n; b++) {
    l += (b - k) * (n / b) + max(n % b - k + 1, (long)(0));
  }
    
  cout << l << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A,B;
    cin>>A>>B;
        if(A>=13){
            cout<<B<<endl;
        }
        if(A>=6&&A<=12){
            B/=2;
            cout<<B<<endl;
        }
        if(A<=5){
            cout<<0;
            }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  string s;
  cin >> s;
  if (s == "AAA" || s == "BBB")
  {
    cout << "No" << endl;
  }
  else
  {
    cout << "Yes" << endl;
  }
  
  return 0;
}


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>constexpr bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>constexpr bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
constexpr int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
constexpr int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
constexpr int32_t LCM(int32_t a, int32_t b){return a / GCD(a, b) * b;}
constexpr int64_t LCM(int64_t a, int64_t b){return a / GCD(a, b) * b;}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

#define int int64_t

/*global*/



signed main()
{
	int a,b,c,d; cin >> a >> b >> c >> d;--a;
	auto f = [&](int c){
		return b/c-a/c;
	};
	cout << b-a-(f(c)+f(d)-f(LCM(c,d))) << '\n';
}

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

using namespace std;

#define int long long

int n,a,b,ans;

signed main(){
	cin>>n>>a>>b;
	if((a&1)==(b&1)){
		cout<<(max(a,b)-min(a,b))/2<<endl;
		return 0;
	}
	else{
		if(a>b) swap(a,b);
		if(a>(n-b)){
			ans+=n-b+1;
			a=a+(n-b+1);
			ans+=(n-a)/2;
		}
		else{
			ans+=a;
			b-=a;
			ans+=(b)/2;
		}
		cout<<ans<<endl;
		return 0;
	}
}


Measured memory_bytes: 256
mod = 10**9+7
N = int(input())
C = list(map(int,input().split()))
C.sort(reverse=True)
ans = 0
for i in range(N):
    ans += (i+2)*C[i]
    ans %= mod
ans *= pow(2,2*N-2,mod)
print(ans%mod)

Measured memory_bytes: 87628
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

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

int main() {
	VI v(3);
	REP(i, 3) {
		cin >> v[i];
	}

	SORT(v);

	ANS(v[0] * v[1] / 2);

	return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt();
		String res=BigDecimal.valueOf((b*Math.pow(b-1, a-1))).toPlainString();
		if(res.substring(res.length()-2, res.length()-1).equals(".")) {
			System.out.println(res.substring(0, res.length()-2));//BigDecimal.valueOf(d1).toPlainString()
		}else {
			System.out.println(res);
		}
	}
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  vector<int> v = {2,5,5,4,5,6,3,7,6};
  
  int n,m;
  cin >> n >> m;
  int use = 0;
  rep(i,m){
    int a;
    cin >> a;--a;
    use |= (1<<a);
  }
//  cout << bitset<9>(use) << endl;
  vector<int> dp(n+1,-INT_MAX/5);
  dp[0] = 0;
  rep(i,n+1){
    for(int j=8;j>=0;j--){
      if((1<<j) & use) {
	int nidx = i + v[j];
	if(nidx<=n){
	  dp[nidx] = max(dp[nidx],dp[i]+1);
	  //	  cout << "i ni dpni " << i << " " << nidx << " " << dp[nidx] << endl;
	}
      }
    }
  }
  int cidx = n;
  while(cidx!=0){
    for(int j=8;j>=0;j--){
      if((1<<j) & use) {
	int nidx = cidx - v[j];
	if(nidx>=0 && dp[nidx] +1 == dp[cidx]){
	  cidx=nidx;
	  cout << j+1;
	  break;
	}
      }
    }
  }
  cout << endl;
  //  cout << dp[n] << endl;

  
  return 0;
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}

int main() {    
    ll n;
    cin >> n;
    ll ans = 1;
    vector<ll>che(n+1,1);
    ll check = 0;
    for(int i=2;i<=n;i++){
        ll d = i;
        while(d<=n){
            che.at(d)++;
            d+=i;
            check++;
        }
    }
    for(int k=1;k<=n;k++){
        ans+=k*che.at(k);
    }
    ans--;
    cout<<ans<<endl;
}
    



Measured memory_bytes: 81400
n=int(input())
a=[]
x=[]
for _ in range(n):
    A=int(input())
    X=[list(map(int,input().split())) for _ in range(A)]
    a.append(A)
    x.append(X)
ans=0

for i in range(2**n):
    tmp=[0]*n
    for j in range(n):
        if (i>>j)&1:
            tmp[j]=1
    for k in range(n):
        # if a[k]==0:
        #     continue
        for h in range(a[k]):
            hito=x[k][h][0]-1
            singi=x[k][h][1]
            if tmp[k]==1:
                if tmp[hito]!=singi:
                    break
        else:
            continue
        break
    else:
        ans=max(ans,sum(tmp))

print(ans)




Measured memory_bytes: 9108
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(N: int, A: "List[int]"):
    c = Counter()
    c[1] = 0
    for a in A:
        c[a] += 1
    for i in range(len(A) + 1):
        print(c[i+1])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N-2+1) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 48952
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

pair<int, int> update(pair<int, int> a, pair<int, int> b) {
    if(a.first > b.first) {
        return mp(a.first, max(a.second, b.first));
    }
    else {
        return mp(b.first, max(a.first, b.second));
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(1 << N);
    vector<pair<int, int>> dp(1 << N); // first > second
    rep(i, 1 << N) {
        cin >> A[i];
        dp[i] = mp(A[i], 0);
    }
    
    rep(j, N) {
        rep(i, 1 << N) {
            if(i & (1 << j)) {
                dp[i] = update(dp[i], dp[i ^ (1 << j)]);
            }
        }
    }
    
    int cur = 0;
    rep(i, 1, 1 << N) {
        cur = max(cur, dp[i].first + dp[i].second);
        output(cur);
    }
    
    
    return 0;
}


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

int main(){
 double r, a, b;
 cin >> r;
 a = r * r * 3.141592653589;
 b = r * 2 * 3.141592653589;
 printf("%.6lf %.6lf\n" , a, b);
 return 0;
}
 


Measured memory_bytes: 3196
using System;
using System.Collections.Generic;
/*using System.Linq;
using System.Text;
using System.Threading.Tasks;*/
class Program
{
    static void Main(string[] args)
    {
        String s = Console.ReadLine();
        String[] sarray = s.Split(' ');          //?????????????????????????´?

        int a = int.Parse(sarray[0]);
        int b = int.Parse(sarray[1]);
        int c = int.Parse(sarray[2]);
                                                 //a??¨b??¨c???????´?????????????
        if (a <b && b < c)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }

    }
}

Measured memory_bytes: 8768
// 6/4
// 3-1-1. lower_bound 類題
// ARC084-Aと同じ問題
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

// ai >= kとなる最小のiを返す
int lower_bound(vector<int> &A, int v) {
    int n = A.size();
    int left = -1;
    int right = n;
    while (right - left > 1) {
        int mid = (right + left) / 2;

        if (A[mid] >= v) right = mid;
        else left = mid;
    }
    return right;
}

// ai <= kとなる最大のiを返す
int upper_bound(vector<int> &A, int v) {
    int n = A.size();
    int left = -1;  // 左側が常に条件を満たす。最終的に解となる。
    int right = n;  // 右側は常にai>kとなる。
    while (right - left > 1) {
        int mid = (left + right) / 2;
        if (A[mid] <= v) left = mid;
        else right = mid;
    }
    return left;
}

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

    vector<int> A(N), B(N), C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    ll ans = 0;

    // rep(i, N) {
    //     int minj = lower_bound(B, A[i] + 1);
    //     // printf("A[%d]+1, minj = %d, %d\n", i, A[i] + 1, minj);
    //     for (int j = minj; j < N; j++) {
    //         int mink = lower_bound(C, B[j] + 1);
    //         ans += N - mink;
    //     }
    // }

    rep(i, N) {
        ll maxa = upper_bound(A, B[i] - 1);
        ll minc = lower_bound(C, B[i] + 1);
        ans += (maxa + 1) * (N - minc);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=200002;

void solve(){
	int n;
	cin>>n;
	cout<<powz(n,3);	
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 



Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string str;
    cin >> str;
    if (str == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}

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

void print_vi(vector<int> vi)
{
	rep(i, vi.size())
	{
		printf("%d ", vi[i]);
	}
}

static const int N = 100;

signed main()
{
	int n, p[N + 1], m[N + 1][N + 1];
	cin >> n;
	for (int i=1; i<=n; i++)
	{
		cin >> p[i - 1] >> p[i];
	}

	for (int i=1; i<=n; i++) m[i][i] = 0;
	for (int l=2; l<=n; l++)
	{
		for (int i=1; i<=n-l+1; i++)
		{
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for (int k=i; k<=j-1; k++)
			{
				m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k]* p[j]);
			}
		}
	}

	cout << m[1][n] << endl;
}

Measured memory_bytes: 1200
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int x[5];
int ans;

int main(){
	for (int i = 0; i < 5; i++){
		cin >> x[i];
		if (x[i] == 0){
			ans = i + 1;
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

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

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String list[] = br.readLine().split(" ");
			int x = Integer.parseInt(list[0]);
			int y = Integer.parseInt(list[1]);
			System.out.println(x * y + " " + ((x * 2) + (y * 2)));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16896
from collections import deque
N = int(input())
g = [[] for _ in range(N)]
d = {}
for i in range(N-1):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
    d[i] = (min(a,b)-1,max(a,b)-1)

q = deque([])
m = 0
s = 0
for i in range(N):
    if len(g[i])>m:
        s = i
        m = len(g[i])
done = [-1]*N
done[s] = 0
ans = {}
cnt = 1
for i in g[s]:
    done[i] = cnt
    ans[(min(i,s),max(i,s))] = cnt
    cnt += 1
    q.append(i)

while q:
    cnt = 1
    i = q.popleft()
    for j in g[i]:
        if done[j]==-1:
            if done[i]==cnt:
                cnt += 1
            ans[min(i,j),max(i,j)] = cnt
            done[j] = cnt
            cnt += 1
            q.append(j)
m = 0
for k in ans:
    m = max(m,ans[k])
print(m)
for i in range(N-1):
    print(ans[d[i]])

Measured memory_bytes: 96800
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli d[300][300];
	REP(i,0,300)REP(j,0,300)d[i][j]=INF;

	lli N,M,R;
	cin>>N>>M>>R;
	vector<lli> r(R);
	REP(i,0,R){
		cin>>r[i];
		r[i]--;
	}

	REP(i,0,M){
		lli a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		d[a][b] = min(d[a][b],c);
		d[b][a] = min(d[b][a],c);
	}

	REP(k,0,N)REP(i,0,N)REP(j,0,N)d[i][j] = min(d[i][j],d[i][k]+d[k][j]);

	vector<lli> per(R);
	REP(i,0,R)per[i]=i;

	lli ans = INF;
	do{
		lli nowPos = r[per[0]];
		lli sum= 0;
		REP(i,1,R){
			sum += d[nowPos][r[per[i]]];
			nowPos = r[per[i]];
		}
		ans = min(ans,sum);
	}while(next_permutation(per.begin(),per.end()));

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
//#define int long long
#define mod 1000000007
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f(i,n) for(ll i=0;i<n;i++)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define ms(v,n) memset((v),n,sizeof(v));
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define maxi(a,b,c) max(a,max(b,c))
#define maxii(a,b,c,d) max(max(a,b),max(c,d))
#define mini(a,b,c) min(a,min(b,c))
#define md(a,b)  ((a%mod)*(b%mod)+mod)%mod 
#define ad(a,b)  (a%mod+b%mod+mod)%mod
#define nl endl
#define inf 1e18
#define cases ll t;cin>>t;while(t--)
#define BLOCK 500
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
 
using namespace std;



int main()
{
    
    fast

    ll n,k;
    cin>>n>>k;
    ll a[n];
    f(i,n)
    cin>>a[i];

    vector<bool> dp(k+1);

    //dp[i]=true if the first player to move wins and i stones left

    for(ll i=0;i<=k;i++)
    {
        for(auto x:a)
        {
            if(x<=i&&!dp[i-x])
            dp[i]=true;
        }
    }

    if(dp[k])
    cout<<"First";
    else
    cout<<"Second";



    

       
    return 0;
    
}



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

	int main(void){
		int b[3];
		for(int i = 0; i < 3; i++){
			cin >> b[i];
		}
		if((b[0] == 1 && b[1] == 1) && b[2] == 0){
			cout << "Open" << endl;
		}else if((b[0] == 0 && b[1] == 0) && b[2] == 1){
			cout << "Open" << endl;
 		}else{
 			cout << "Close" << endl;
 		}
		
		return 0;	
	}

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

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;
ll mem[3005][3005][2];

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}
    
ll dp(ll i, ll j, ll k)
{
	if(mem[i][j][k]!=-1)
		return mem[i][j][k];
	if(i==j)
		mem[i][j][k]=v[i];
	else
		mem[i][j][k]=max(v[i]-dp(i+1,j,k^1),v[j]-dp(i,j-1,1-k));
	return mem[i][j][k];
}

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

	ll n,i,m,j,k,x,y,a,b;
	string s;
	
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> x;
		v.pb(x);
	}
	memset(mem,-1,sizeof(mem));
	cout << dp(0,n-1,0);
	return 0;
}


Measured memory_bytes: 141568
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); //number 
#define ll long long                      //of element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after 
using namespace std;                      // sort use as s.f();
using namespace __gnu_pbds;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll k,n,a[200001];
		cin>>k>>n;
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
			}
		ll ans=999999999999;
		
	for(ll i=0;i<n-1;i++)
	{
		ll p1=a[i];
		ll p2=a[i+1];
		ll z=(k-p2+p1);
		ans=min(ans,z);				
	}	
	ans=min(a[n-1]-a[0],ans);
		
		cout<<ans<<endl;		
	}
	
return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int A = input.nextInt();
		int B = input.nextInt();
		int X = input.nextInt();
		System.out.println(A+B>=X&&A<=X?"YES":"NO");
	}
}

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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  string S;
  cin >> S;
  REP(i, 3){
    cout << S[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3636
import heapq
INFTY = 10**3
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
dist = {(i,j):{(k,l):INFTY for k in range(H) for l in range(W)} for j in range(W) for i in range(H)}
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            hist = {(k,l):0 for k in range(H) for l in range(W)}
            heap = [(0,i,j)]
            dist[(i,j)][(i,j)]= 0
            hist[(i,j)] = 1
            while heap:
                d,k,l = heapq.heappop(heap)
                if d>dist[(i,j)][(k,l)]:continue
                hist[(k,l)] = 1
                if l+1<W and S[k][l+1]=="." and hist[(k,l+1)]==0:
                    if dist[(i,j)][(k,l+1)]>d+1:
                        dist[(i,j)][(k,l+1)] = d+1
                        heapq.heappush(heap,(d+1,k,l+1))
                if l-1>-1 and S[k][l-1]=="." and hist[(k,l-1)]==0:
                    if dist[(i,j)][(k,l-1)]>d+1:
                        dist[(i,j)][(k,l-1)]=d+1
                        heapq.heappush(heap,(d+1,k,l-1))
                if k+1<H and S[k+1][l]=="." and hist[(k+1,l)]==0:
                    if dist[(i,j)][(k+1,l)]>d+1:
                        dist[(i,j)][(k+1,l)]=d+1
                        heapq.heappush(heap,(d+1,k+1,l))
                if k-1>-1 and S[k-1][l]=="." and hist[(k-1,l)]==0:
                    if dist[(i,j)][(k-1,l)]>d+1:
                        dist[(i,j)][(k-1,l)]=d+1
                        heapq.heappush(heap,(d+1,k-1,l))
dmax = 0
for i in range(H):
    for j in range(W):
        for k in range(H):
            for l in range(W):
                if dist[(i,j)][(k,l)]<INFTY:
                    dmax = max(dmax,dist[(i,j)][(k,l)])
print(dmax)

Measured memory_bytes: 167004
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    cin >> n;
    x = 1;
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            for(k = 1; k <= n; k++){
                y = __gcd(i,j);
                z = __gcd(y,k);
                sum += z;
            }
        }
    }
    cout << sum;

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int n, m=0, s=0,l;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> l;
        s += l;
        m = max(m, l);
    }
    if (s - m > m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

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

const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int n, m; // 変数
string s, t;
int dp[3001][3001];
string ans;

void dp_solve() {
    if (s.size() < t.size()) swap(s, t);
    s = ' ' + s;
    t = ' ' + t;
    n = s.size();
    m = t.size();
    rep(i, n) {
        rep(j, m) {
            if (i == 0 || j == 0) {
                dp[i][j] = 0;
                continue;
            } else {
                if (s[i] == t[j]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    int x = dp[i-1][j];
                    int y = dp[i][j-1];
                    dp[i][j] = max(x, y);
                }
            }
            // printf("%d ", dp[i][j]);
        }
        // printf("\n");
    }
    int i = n-1, j = m-1;
    while (i-1 >= 0 && j-1 >= 0) { 
        if (s[i] == t[j]) {
            ans.push_back(s[i]);
            i--;
            j--;
        } else if (dp[i][j] == dp[i-1][j]) {
            i--;
        } else if (dp[i][j] == dp[i][j-1]) {
            j--;
        }
    }
    reverse(ALL(ans));
}

int main() {
// input
    cin >> s;
    cin >> t;
// solve
    dp_solve();
// output
    cout << ans << "\n";
}

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

int main () {
  int K ;
  vector<int> line(3) ;
  for(int i = 0 ; i < 3 ;i++) cin >> line[i] ;
  cin >> K ;
  for(int i = 0 ; i < K ; i++){
    sort(line.begin(),line.end()) ;
    line[2] *=2 ;
  }
  cout << line[0] + line[1] + line[2] << endl ;
}

Measured memory_bytes: 256
let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let _ = Array.fast_sort (fun x y -> y-x) arr in
  let ((alice,bob),_) = Array.fold_left 
                     (fun ((a,b),i) x -> 
          if i mod 2 = 1 then ((a+x,b),i+1) else ((a,b+x),i+1)) ((0,0),1) arr in
  Printf.printf "%d\n" (alice-bob)

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

namespace Competitive
{
    internal class Solution
    {
        public int A, B;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                A = line[0];
                B = line[1];
            }

            Console.WriteLine((A - 1) * (B - 1));
        }
    }

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


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

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

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

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

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

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

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

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int main(){
    int n,k,ans=0;
    cin >> n >> k;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());
    for(int i=0;i<k;i++){
        ans+=p.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

 
//typedef tuple <int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
 
#define siz(x) (int)(x).size()
#define Y second
#define X first
#define IN insert
#define PB push_back
#define P pop_back
#define PU push
#define PO pop
//#define F find
#define ED end()
#define MP( a, b) make_pair( a, b )
 
//#define MOD 1000000007ll
#define INF 1000000000
#define endl "\n"
#define rep(a,i,b) for (ll i = (a); i < (b); ++i)
#define reps(a,i,b) for (ll i = (a); i <= (b); ++i)
#define repd( num, i, ed ) for(ll (i)= (num)-1; (i) >= ed; --(i))
#define repkt( bg, i, num, kt ) for(ll (i)= (bg); (i) < (num) && (kt); ++(i))
#define repchar( i ) for(char (i)= 48; (i) <= 122; (i)++)   
#define in(n) scanf("%lld", &n)
#define out(n) printf("%lld\n", n)
#define outS(s) printf("%s\n", s)
#define setA(a,n) for(ll i= 0, j= sizeof(a)/sizeof(a[0]); i < j; ++i) a[i]= n;
#define repe(num,i,ed) for(ll (i)= (num); (i) >= ed; --(i))
// const int INF=0x3f3f3f3f;
const db PI=acos(-1);
const ll mod=1e9+7;
const ll N=2e6+5,K=105;
const int si=(1<<20);
const ll add=1e4;
const ll M=100+5;
const double INFdb=1e10;

ll inv[N],f1[N],f2[N];
 
void init(){
    inv[1]=1;
    for(int i=2;i<N;++i){
        inv[i]=mod-mod/i*inv[mod%i]%mod;
    }
    f1[0]=f2[0]=1;
    for(int i=1;i<N;++i){
        f1[i]=f1[i-1]*i%mod;
        f2[i]=f2[i-1]*inv[i]%mod;
    }
}
 
ll binomial(ll n,ll k){
    return f1[n]*f2[n-k]%mod*f2[k]%mod;
}

ll sum_of_matrix(ll l,ll r){
    return (binomial(l+r+2,l+1)%mod-1+mod)%mod;
}


int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
    vector<ll> r(2),c(2);
    init();
    cin>>r[0]>>c[0]>>r[1]>>c[1];
    --r[0];
    --c[0];
    ll ans=(((sum_of_matrix(r[1],c[1])-sum_of_matrix(r[0],c[1])+mod)%mod-sum_of_matrix(c[0],r[1])+mod)%mod+sum_of_matrix(r[0],c[0]))%mod;
    cout<<ans;
    cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";                                                                          
    return 0;
}

Measured memory_bytes: 47104
N,a,b=map(int, raw_input().split())
 
mod=10**9+7
inv_fact=[1]
fact_tmp = 1
for i in range(1, b+1):
    fact_tmp *= i
    fact_tmp %= mod
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
fact=[1]
fact_tmp = 1
for i in range(N,N-b-2,-1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)

def ncr(n,r):
    return (fact[r]*inv_fact[r])%mod

ans=pow(2,N,mod)-ncr(N,a)-ncr(N,b)-1
if 0<=ans:
    print ans%mod
else:
    while ans<0:
        ans+=mod
    print ans%mod


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

dic = {}
dic["AC"] = 0
dic["WA"] = 0
dic["TLE"] = 0
dic["RE"] = 0

for i in range(N):
    S = input()
    dic[S] += 1

print("AC x {}".format(dic["AC"]))
print("WA x {}".format(dic["WA"]))
print("TLE x {}".format(dic["TLE"]))
print("RE x {}".format(dic["RE"]))

Measured memory_bytes: 69872
import sys
w = list(input())
w.sort()

if len(w) == 1:
    print("No")
    sys.exit()

count = 1
for i in range(1, len(w)):
    if w[i] == w[i-1] :
        count += 1
    else:
        if count % 2 == 1:
            print("No")
            sys.exit()
        count = 1

print("Yes")


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

int main(){
    std::vector<ll> A;
    vector<ll> p={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
    
    ll N;
    cin>>N;
    map<ll,ll> m;
    for(ll i=0;i<N;++i){
        ll t;
        cin>>t;
        for(ll j=0;j<p.size();++j){
            if(t%p[j]==0){
                m[p[j]]++;
            }
            while(t%p[j]==0){
                t/=p[j];
            }
        }
        m[t]++;
    }
    bool setF=false;
    for (const auto& [k, v] : m){
        //std::cout << k << " => " << v << "\n";
        if(k!=1&&v==N){
            cout<<"not coprime";
            return 0;
        }else if(k!=1&&v>1){
            setF=true;
            //cout<<"setwise coprime";
        }
    }
    if(setF){
        cout<<"setwise coprime";
    }else{
        cout<<"pairwise coprime";
    }
    return 0;
}

Measured memory_bytes: 8468
#include <bits/stdc++.h>
#define NOP 20		//Number Of Fathers
using namespace std;

struct nodo
{
	int lv;
	set<int>Fx;
	vector<int>Pb;
	nodo()
	{
		lv = 0;
		Pb.assign(NOP,0);
	}
};

class tree
{
	private:
		vector<nodo> v;
		int root;
	public:	
	tree(int n)
	{
		v.assign(n,nodo());
		root = 0;
	}
	tree(int n , int r)
	{
		v.assign(n,nodo());
		root = r;
		v[r].Pb[0] = r;
	}
	void conect(int x , int y)
	{
		v[x].Fx.insert(y);
		v[y].Fx.insert(x);
		v[y].Pb[0] = x;
	}
	void LV(int x , int l , int p)
	{
//		cout << x << " , " << l << '\n';
		v[x].lv = l;
		set<int>::iterator it;
		for(it = v[x].Fx.begin() ; it != v[x].Fx.end() ; it++)
			if(*it != p)
				LV(*it , l + 1 , x);
	}
	void BinaryP()
	{
		for(int i = 1 ; i < NOP ; i++)
			for(int j = 0 ; j < v.size() ; j++)
				v[j].Pb[i] = v[v[j].Pb[i-1]].Pb[i-1];
	}
	int LCA(int x , int y)
	{
		int dif = abs(v[x].lv - v[y].lv);
		int p1 , p2;
		if(v[x].lv > v[y].lv)
		{
			p1 = x;
			p2 = y;
		}
		else
		{
			p1 = y;
			p2 = x;
		}
//		cout<< '\n' << dif << " , " << p1 << " , " << p2 << " DIF\n";
		if(dif > 0)
		{
			for(int i = 0 ; (1<<i) <= dif ; i++)
			{
				if(((1<<i)&dif) != 0)
					p1 = v[p1].Pb[i];
			}
		}
//		cout << p1 << " , " << p2 << " PS\n";
		if(p1 == p2)
			return p1;
		else
		{
			for(int i = NOP - 1 ; i >= 0 ; i--)
			{
		//		cout << v[p1].Pb[i] << " , " << v[p2].Pb[i] << " FIND\n";
				if(v[p1].Pb[i] != v[p2].Pb[i])
				{
					p1 = v[p1].Pb[i];
					p2 = v[p2].Pb[i];
				}
			}
			return v[p1].Pb[0];
		}
	}
};


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n , q , a , b;
	cin >> n;
	tree tr(n);
	for(int i = 0 ; i < n ; i++)
	{
		cin >> a;
		for(int j = 0 ; j < a ; j++)
		{
			cin >> b;
			tr.conect(i,b);
		}
	}
	tr.LV(0,0,0);
	tr.BinaryP();
	cin >> q;
	for(int i = 0 ; i < q ; i++)
	{
		cin >> a >> b;
		cout << tr.LCA(a,b) << '\n';
	}
	return 0;
}


Measured memory_bytes: 32296
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(void){
    char str[1201];
    int i;
    gets(str);
    for(i=0;str[i]!=EOF;i++){
        if(str[i]>='A' && str[i]<='Z')
            str[i]=tolower(str[i]);
        else if(str[i]>='a' && str[i]<='z')
            str[i]=toupper(str[i]);
    }
    printf("%s\n",str);
    return 0;
}

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

int divnum(int N){
    int ret = 0;
    for(int i=1; i*i<=N; i++){
        if(N%i == 0){
            ret += (i == N/i ? 1 : 2);
        }
    }
    return ret;
}

int main(){
    vector<int> num(100001, 0);
    for(int i=2; i<=100000; i++){
        num[i] = num[i-1];
        if(divnum(i) >= 5) num[i]++;
    }

    int Q;
    cin >> Q;
    while(Q--){
        int N;
        cin >> N;
        cout << num[N] << endl;
    }

    return 0;
}



Measured memory_bytes: 3104
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>
#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF 1e9
#define INFL 1e18
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class DDiceInLine {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N, K;
        in >> N >> K;
        double p[N];
        double q[N];
        double r[N+1];
        REP(i, N) in >> p[i];
        REP(i, N) {
            q[i] = (p[i]+1)/2;
        }
        r[0] = 0;
        REP(i, N) {
            r[i+1] = r[i] + q[i];
        }
        double ans = 0.0;
        REP(i, N - K + 1) {
            ans = max(ans, r[i+K] - r[i]);
        }
        out << setprecision(12) << ans << '\n';
	}
};


int main() {
	DDiceInLine solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4992