akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<(k) ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=(k) ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

int x, y;
int rw[1003] = {0, 300000, 200000, 100000};
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    cin >> x >> y;

    int sum = rw[x] + rw[y];
    if (sum == 300000 * 2) {
        sum += 400000;
    }

    cout << sum << endl;
    return 0;
}


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

const long long MOD = 1000000007;

int main() {
    int N, M; cin >> N >> M;
    long long broken[100010];
    for (int i = 0; i <= 100010; i++) {
        broken[i] = 0;
    }
    for (int i = 0; i < M; i++) {
        int a; cin >> a;
        broken[a]++;
    }
    long long dp[100010];
    for (int i = 0; i < 100010; i++) {
        dp[i] = 0;
    }
    dp[0] = 1;
    if (broken[1]) {
        dp[1] = 0;
    } else {
        dp[1] = 1;
    }
    for (int i = 2; i <= N; i++) {
        if (broken[i]) {
            dp[i] = 0;
        } else {
            if (broken[i-2] == 0 && broken[i-1] == 0) {
                dp[i] += (dp[i-2] + dp[i-1]);
            } else if (broken[i-2] == 0 && broken[i-1] == 1) {
                dp[i] += dp[i-2];
            } else if (broken[i-2] == 1 && broken[i-1] == 0) {
                dp[i] += dp[i-1];
            } else if (broken[i-2] == 1 && broken[i-1] == 1) {
                dp[i] = 0;
            }
            dp[i] %= MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define int ll
int N,M;

int32_t main(){
	fast;
	cin>>N>>M;
	
	if (N == 1){
		cout<<M;
		return 0;
	}
	int ans = 1;
	FOR(i,2,sqrt(M)+1){
		if (M % i == 0){
			if (M/i * N <= M) ans = max(ans,int(M/i));
			if (i * N <= M) ans = max(ans,int(i));
		}
	}
	
	cout<<ans;
	
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 100
#define INF (1<<21)
#define W 0
#define G 1
#define B 2
int n,m[N][N];
void in(){
  int i,j,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&k);
      if(k==-1)m[i][j]=INF;
      else m[i][j]=k;
    }
  }
}
int prim(){
  int x,min,i,j;
  int c[N],d[N],p[N];
  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=-1;
    c[i]=W;
  }
  d[0]=0;
  while(1){
    min=INF;
    x=-1;
    for(i=0;i<n;i++){
      if(min>d[i] && c[i]!=B){
        x=i;
        min=d[i];
      }
    }
    if(x==-1)break;
    c[x]=B;
    for(j=0;j<n;j++){
      if(c[j]!=B && m[x][j]!=INF){
        if(d[j]>m[x][j]){
          d[j]=m[x][j];
          p[j]=x;
          c[j]=G;
        }
      }
    }
  }
  int sum=0;
  for(i=0;i<n;i++){
    if(p[i]!=-1)sum+=m[i][p[i]];
  }
  return sum;
}
int main(){
  in();
  printf("%d\n",prim());
  return 0;
}



Measured memory_bytes: 2112
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

}

Measured memory_bytes: 24368
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
const int mod = 1e9 + 7;
int n;

int add(int x, int y) {
	if (x + y >= mod) {
		return x + y - mod;
	}
	return x + y;
}

int sub(int x, int y) {
	if (x - y < 0) {
		return x - y + mod;
	}
	return x - y;
}

int mul(int x, int y) {
	return (long long) x * y % mod;
}

int exp(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) {
			ans = mul(ans, x);
		}
		x = mul(x, x);
		y >>= 1;
	}
	return ans;
}

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

	cin >> n;

	int ans = exp(10, n);
	ans = sub(ans, mul(2, exp(9, n)));
	ans = add(ans, exp(8, n));
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define toInt(x) (x - '0')
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
  string n;
  cin >> n;
  for (char c : n) {
    if (c == '1') {
      cout << 9;
    } else {
      cout << 1;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
  char s[3];
  int sum = 700;
  for (int i = 0; i < 3; i++){
    std::cin >> s[i];
    if (s[i] == 'o')
      sum += 100;
  }
  std::cout << sum << std::endl;
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  
  int sum = 0;
  
  if(A>B){
    sum += A;
    A--;
  }else{
    sum += B;
    B--;
  }
  
  if(A>B){
    sum += A;
    A--;
  }else{
    sum += B;
    B--;
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

cnt_a = [0] * N
for i in range(N):
    cnt_a[i] = bisect_left(A, B[i])
    
cnt_b = [0] * N
for i in range(N):
    cnt_b[i] = bisect_right(C, B[i])
    
ans = sum(v * (N - w) for v, w in zip(cnt_a, cnt_b))
print(ans)



Measured memory_bytes: 107876
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            long MOD = 1000000007;

            int N = sc.nextInt();
            int A = sc.nextInt();
            int B = sc.nextInt();

            long ans = pow(2, N, MOD) - 1;
            ans -= combination(N, A, MOD);
            ans -= combination(N, B, MOD);

            while (ans < 0) {
                ans += MOD;
            }

            System.out.println(ans);
        }
    }

    static long combination(int N, int K, long MOD) {
        K = Math.min(K, N - K);

        long up = 1;
        long down = 1;
        for (int i = 0; i < K; i++) {
            up = up * (N - i) % MOD;
            down = down * (K - i) % MOD;
        }

        return up * pow(down, MOD - 2, MOD) % MOD;
    }

    static long pow(long A, long B, long MOD) {
        if (B == 0) {
            return 1;
        } else if (B % 2 == 0) {
            long C = pow(A, B / 2, MOD);
            return C * C % MOD;
        } else {
            long C = pow(A, B - 1, MOD);
            return A * C % MOD;
        }
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
    vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    string s;
    cin >> s;
    auto it = find(days.begin(), days.end(), s);

    cout << (days.end() - it) << endl;
}

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

using namespace std;

//#define FILE_IO

typedef long double LD;
typedef long long LL;

int N, M;
LL K;
int v[100005], op[100005];
int d[100005];
int pos[100005], aux[100005];
int nxt[65][100005];

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

    scanf("%d", &N);
    for(int i = 1; i <= N; i++) scanf("%d", &v[i]);
    for(int i = 1; i < N; i++)  d[i] = v[i + 1] - v[i], pos[i] = i;

    scanf("%d%lld", &M, &K);
    for(int i = 1; i <= M; i++)
    {
        scanf("%d", &op[i]);
        swap( pos[ op[i] ], pos[ op[i] - 1 ] );
    }

    for(int i = 1; i < N; i++)  nxt[0][ pos[i] ] = i;
    for(int i = 1; i < N; i++)  pos[i] = i;

    for(int b = 0; b < 60; b++)
    {
        if( (K >> b) & 1 )
        {
            for(int i = 1; i < N; i++)  aux[i] = pos[i];
            for(int i = 1; i < N; i++)  pos[ nxt[b][i] ] = aux[i];
        }

        for(int i = 1; i < N; i++)  nxt[b + 1][i] = nxt[b][ nxt[b][i] ];
    }

    LL x = v[1];
    printf("%lld.000\n", x);
    for(int i = 1; i < N; i++)
    {
        x += d[ pos[i] ];
        printf("%lld.000\n", x);
    }

    return 0;
}


Measured memory_bytes: 28928
string = str(input())
newstring = ""

for i in string:
    if (i.isupper()) == True:
        newstring += (i.lower())
    elif (i.islower()) == True:
        newstring += (i.upper())
    elif (i.isspace()) == True:
        newstring += i
    else:
        newstring += i

print(newstring)


Measured memory_bytes: 5552
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

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


class Graph{
    struct edge{
        int vertice;
        ll weight;
    };

    vector<vector<edge>> g;
    unsigned int n;

public:
    Graph(unsigned int n): n{n}{
        g.resize(n);
    }

    void add_edge(int u, int v){
        g[u].emplace_back(edge{v, 1});
    };

    void add_edge(int u, int v, ll w){
        g[u].emplace_back(edge{v, w});
    }

    vector<edge>& get_edge(int v){
        return g[v];
    }

    unsigned int size(){
        return n;
    }

    vector<edge>& operator[](int v){
        return get_edge(v);
    }
};


int main(){
    int n, m;   cin >> n >> m;
    Graph g(n+m);
    for(int i = 0; i < n; i++){
        int k;  cin >> k;
        for(int j = 0; j < k; j++) {
            int l;
            cin >> l;
            l--;
            g.add_edge(i, l + n);
            g.add_edge(l + n, i);
        }
    }

    vector<bool> state(n+m, false);
    function<void(int)> dfs = [&](int v){
        state[v] = true;
        for(auto e: g[v]){
            if(state[e.vertice])    continue;
            dfs(e.vertice);
        }
    };

    dfs(0);
    for(int i = 0; i < n; i++){
        if(!state[i]){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;





    return 0;
}


Measured memory_bytes: 9584
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int d,t,s;
  cin >>d>>t>>s;
  int tmp=d/s;
  if(d%s!=0) tmp++;
  if(tmp>t) cout <<"No\n";
  else cout <<"Yes\n";
  return(0);
}

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int table[] = { 0,1,2,3,5,7,8,9 };
	unsigned long long n;
	while (cin >> n, n) {
		vector<int>out;
		while (n > 0) {
			out.push_back(table[n % 8]);
			n /= 8;
		}
		for (int i = out.size() - 1; i >= 0; i--)cout << out[i];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in();
    cout<<(n-1)/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n;
    int a[10001] = {0}; //10001個
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
  long long int min = 1000000, max = -1000000, sum = 0;
    for(int i = 0; i < n; i++){
        if(a[i]<min){
            min = a[i];
        }
        if(a[i]>max){
            max = a[i];
        }
        sum = sum + a[i];
        }
        cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3124
use std::io::{self, Read};

pub struct Scanner<R>
where
    R: Read,
{
    reader: R,
}

impl<R> Scanner<R>
where
    R: Read,
{
    pub fn new(reader: R) -> Self {
        Scanner { reader: reader }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: ::std::str::FromStr,
        <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
    {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .unwrap()
    }
}

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let n: i32 = sc.next();
    let mut v: Vec<i64> = (0..n).map(|_| sc.next()).collect();

    for i in 0..n {
        if i == 0 {
            v[i as usize] -= 1;
        } else {
            match v[i as usize] - v[(i - 1) as usize] {
                n if n >= 1 => v[i as usize] -= 1,
                n if n == 0 => (),
                _ => {
                    println!("No");
                    return;
                }
            }
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;
string s;
int n;

signed main(){

    cin >> s;
    
    rep(i,s.size()-1){
        int x = 0;
        if(s[i] == s[i+1]) x = 1;  
        if(i <= s.size()-3 && s[i] == s[i+2]) x = 2;  
        

        if(x != 0){
            cout << i+1 << " " << i+1+x;
            return 0;
        } 
    }
    cout << "-1 -1" <<endl;
    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n, m, l;
	int A[100][100], B[100][100];
	long long c;
	
	cin >> n >> m >> l;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> A[i][j];
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> B[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			c = 0;
			for (int k = 0; k < m; k++) {
				c += A[i][k] * B[k][j];
			}
			cout << c;
			if (j == l - 1)
				cout << endl;
			else
				cout << " ";
		}
	}
	return (0);
}

Measured memory_bytes: 1232
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdlib>5
#include<string>
#include<algorithm>
#define LL long long
#define INF 1000000009
using namespace std;
int main()
{
int n,d;
scanf("%d",&n);
int min1=INF,max1=0;
while(n--)
{
    scanf("%d",&d);
    min1=min(min1,d);
    max1=max(max1,d);
}
printf("%d\n",max1-min1);
}

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
const ll MOD = 998244353;
const ld PI = 3.141592653589793;
const int maxn = 600001;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

ll fac[maxn];
ll inv[maxn];

ll pw(ll a, ll b) {
    ll res = 1;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
    }
    return res;
}

void prep(int n) {
    fac[0] = 1;
    for (int i = 1; i <= n; ++i) {
        fac[i] = fac[i - 1] * i % MOD;
    }
    inv[n] = pw(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        inv[i] = inv[i + 1] * (i + 1) % MOD;
    }
}

ll C(int n, int k) {
    if (k > n || k < 0) {
        return 0;
    }
    return fac[n] * inv[k] % MOD * inv[n - k] % MOD;
}

ll dp[3001][3011];

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");
    mt19937 mt(234793824);
    auto solve = [&mt](int _) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        dp[a][b] = 1;
        auto add = [](ll a, ll b) {
            a += b;
            if (a >= MOD) {
                a -= MOD;
            }
            return a;
        };
        for (int i = a; i <= c; ++i) {
            for (int j = b; j <= d; ++j) {
                if (i > a && j > b) {
                    dp[i][j] = add(dp[i][j], dp[i - 1][j]);
                    dp[i][j] = add(dp[i][j], dp[i][j - 1]);
                    dp[i][j] = add(dp[i][j], dp[i][j - 1] * (i-1) % MOD);
                    dp[i][j] = add(dp[i][j], dp[i - 1][j] * (j-1) % MOD);
                    dp[i][j] = add(dp[i][j], MOD - (i - 1) * (j - 1) * dp[i - 1][j - 1] % MOD);
                } else if (i > a) {
                    dp[i][j] = add(dp[i][j], dp[i - 1][j] * j % MOD);

                } else if (j > b) {
                    dp[i][j] = add(dp[i][j], dp[i][j - 1] * i % MOD);
                }
                debug(i,j, dp[i][j]);
            }
        }
        cout << dp[c][d] << "\n";
    };


    fast_io();

    cout.precision(9);
    cout <<
         fixed;
    for (int i = 1; i <= 1; ++i)
        solve(1);


}


Measured memory_bytes: 74044
#include<bits/stdc++.h>
#define PROB "c"
using namespace std;
int n,k;
void init()
{
    freopen(PROB".inp","r",stdin);
    freopen(PROB".out","w",stdout);
}

void Nhap()
{
    scanf("%d %d",&n,&k);
}

void XuLi()
{
    int dem1=0,dem2=0,h=k/2;
    for(int i=k; i<=n; i+=k) dem1++;
    if(k%2==0) for(int i=h; i<=n; i+=k) dem2++;
    long long kq1=1,kq2=1,kq;   
    for(int i=1; i<=3; i++) kq1*=dem1;
    for(int i=1; i<=3; i++) kq2*=dem2;
    if(k%2==0) kq=kq1+kq2;
    else kq=kq1;
    printf("%lld",kq);
}

int main()
{
    Nhap();
    XuLi();
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
    int x, y;
    while(true){
        scanf("%d %d", &x, &y);
        if(x == 0 && y == 0) break;
        if(x > y) printf("%d %d\n", y, x);
        else printf("%d %d\n", x, y);
    }
    return 0;
}


Measured memory_bytes: 2568
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a,b,c;
	while(cin>>a>>b>>c,a+b+c){
		vector<bool>in(a+1);
		in[0]=true;
		if(b>c)swap(b,c);
		rep(i,a+1){
			if(i-b<0)continue;
			if(in[i-b])in[i]=true;;
			if(i-c<0)continue;
			if(in[i-c])in[i]=true;;
		}
		int co=0;
		loop(i,1,a+1)if(!in[i])co++;
		cout<<co<<endl;
	}
}

Measured memory_bytes: 1316
import java.util.*;

public class Main {


    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();
        int k = sc.nextInt();
        int[] candle = new int[n];
        for (int i = 0; i < n;i++)
            candle[i] = sc.nextInt();
        int index =0;
        for (; index < n;index++)
            if (candle[index]>= 0)
                break;
        int min =Integer.MAX_VALUE;
        if (index == n){
            System.out.println(-candle[n-k]);
            return;
        }
        int i = n - index  >= k+1? 0: k-(n- index);
        for(; i<= index; i++){
            int l = i <=0 ? 0 : Math.abs(candle[index -i]);
            int r = i >=n? 0: Math.abs(candle[index+k-i-1]);
            if(r==0 || l == 0)
                min = Math.min(min, Math.max(l,r));
            else {
                int t = Math.min( l*2 + r , l+ r*2);
                min = Math.min(min, t);
            }

        }
        System.out.println( min);

    }

}

Measured memory_bytes: 50312
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const{ return cost < b.cost; }
	bool operator>(const P &b) const{ return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const{ return cost < b.cost; }
	bool operator>(const E &b) const{ return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const{
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const{
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const{ return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const{ return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int a[40];
signed main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int t;
			cin >> t;
			a[t]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < 40; i++) {
		if (a[i] == n) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<utility>
#include<stdlib.h>
#include<limits.h>
#include<cmath>
#include<set>
#include<initializer_list>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<iomanip>
#include<algorithm>

#define sze 1000005
#define ld long double
#define ll long long
#define endl "\n"
#define pb push_back
#define mkp make_pair
#define mod 1000000007
#define ff first
#define ss second
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)

using namespace std;

int main(int argc, const char *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,w; cin>>n>>w;
    ll v[n+1],w1[n+1];
    for(ll i=0;i<n;i++)
    {
        cin>>w1[i]; cin>>v[i];
    }
    ll mx = 51e4;
    ll dp[mx+5];
    memset(dp,mx,sizeof(dp));
    dp[0]=0;
    for(ll i=0;i<n;i++)
    {
        for(ll val = mx;val>=0;val--)
        {
            dp[val] = min(dp[val],(val>=v[i])?dp[val-v[i]]+w1[i]:INT_MAX);
        }
    }
    ll fin = 0;
    for(ll i=0;i<=mx;i++)
    {
        if(dp[i]<=w) fin = i;
    }
    cout<<fin<<endl;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

Map prime;

void factrization(ll n) {
    for(ll i=2; i*i<=n; i++) {
        while(n%i==0) {
            prime[i]++;
            n/=i;
        }
    }
    
    if(n>1) prime[n]++;
}

int main(void) {
    ll N;
    ll i;
    cin >> N;
    for(i=2; i<=N; i++)
        factrization(i);
    
    ll ans=1;
    for(auto it=prime.begin(); it!=prime.end(); it++)
        moC(ans, *, it->se+1);
    
    pt(ans);
    
}







Measured memory_bytes: 256
#ABC141-E Who Says a Pun?
"""
最長共通部分文字列を求める問題。
最長共通接頭辞(z-algorithm)を用いて、O(N**2)で求まる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

def Z_algorithm(s):
    N = len(s)
    Z_alg = [0]*N
    Z_alg[0] = N
    i = 1
    j = 0
    res = 0 #文字列非重複の場合の最大共通部分
    while i < N:
        while i+j < N and s[j] == s[i+j]:
            j += 1
        if i+1 > j:
            res = max(res,j)
        else:
            res = max(res,i)
        Z_alg[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < N and k + Z_alg[k]<j:
            Z_alg[i+k] = Z_alg[k]
            k += 1
        i += k
        j -= k
    return res
n = int(readline())
s = readline().rstrip().decode('utf-8')
ans = 0
i = 0
while True:
    ans = max(ans,Z_algorithm(s))
    if len(s)<=2:
        break
    s = s[1:]
    i += 1

print(ans)

Measured memory_bytes: 48988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if(s=="ani"){
		cout << "square1001" << endl;
	}else{
		cout << "e869120" << endl;
	}
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

int main(){

ios::sync_with_stdio(false);
cin.tie(0);
long long int n,m;
cin>>n>>m;

long long int a[n];
long long int num=0;

int amfl=0;

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



if(num%(4*m)==0){num/=(4*m);}
else{
num/=(4*m);
amfl=1;
}

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

if(amfl==0){
if(a[i]>=num)fl++;
}else{
if(a[i]>num)fl++;
}

}
if(fl>=m){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}



}


Measured memory_bytes: 256
Scanf.scanf "%d %d %d %d" (fun n a b c ->
    let l = Array.init n (fun _ -> Scanf.scanf " %d" (fun l -> l)) in

    let arr = Array.make 4 0 in

    let calc_cost cost arr =
        let enl k q =
            if k = 0 then 100000 else abs (k - q)
        in
        cost + (enl arr.(0) a) + (enl arr.(1) b) + (enl arr.(2) c)
    in

    let rec loop i c cost min_cost =
        if i = n then min min_cost (calc_cost cost arr) else
            if c = 4 then min_cost else (
                arr.(c) <- arr.(c) + l.(i);
                let newcost = if c = 3 || arr.(c) = l.(i) then cost else cost + 10 in
                let mi = loop (i + 1) 0 newcost min_cost in
                arr.(c) <- arr.(c) - l.(i);
                loop i (c + 1) cost mi
            )
    in
    loop 0 0 0 max_int |> Printf.printf "%d\n"
)

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B;
    cin >> A >> B;
    array<array<bool, 100>, 100> c;
    rep(i, 0, 100)
    {
        rep(j, 0, 100)
        {
            c[i][j] = i < 50 ? true : false;
        }
    }

    --A;
    --B;

    for (int i = 0; i < 50; i += 2)
    {
        for (int j = 0; j < 100; j += 2)
        {
            if (A == 0)
            {
                break;
            }
            else
            {
                c[i][j] = false;
                --A;
            }
        }
        if (A == 0)
        {
            break;
        }
    }

    for (int i = 51; i < 100; i += 2)
    {
        for (int j = 0; j < 100; j += 2)
        {
            if (B == 0)
            {
                break;
            }
            else
            {
                c[i][j] = true;
                --B;
            }
        }
        if (B == 0)
        {
            break;
        }
    }

    cout << 100 << " " << 100 << endl;
    rep(i, 0, 100)
    {
        rep(j, 0, 100)
        {
            cout << (c[i][j] ? '#' : '.');
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int map[100]={0};//既に出た色かを記録する配列(いわゆるフラグ)
    int a,n=3,cnt=0;
    for(;n--;){//nを1づつ減らして、nが0になるまで繰り返す。(n回繰り返す)
        scanf("%d",&a);
        if(map[a-1]==0){//もし、新しい色なら
            cnt++;
            map[a-1]=1;//a-1番目のフラグを立てる
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
    cin >> n >> s;
    int slen = s.length();
    for(int i = 0; i < slen; ++i) {
        int no = (int)s.at(i) + n;
        if(no >= 91) {
            no -= 26;
        }
        s.at(i) = (char)no;
    }

    cout << s << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int len = s.size();
    cout << s.substr(0, len - 8) << endl;
    
    return 0;
}



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

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main(){
	string s;
	cin >> s;
	int cnt = 0, ans = 0;
	for(int i = 0; i < s.size(); i++){
		if('A' == s[i] || 'C' == s[i] || 'G' == s[i] || 'T' == s[i]){
			cnt++;
		}else{
			if(cnt > ans){
				ans = cnt;
			}
			cnt = 0;
		}
	}
	if(cnt > 0){
		if(cnt > ans){
			ans = cnt;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N;
    cin >> N;
    map<string, ll>cnt;
    ll tmp = 0;
    rep(i, N){
        string s;
        cin >> s;
        cnt[s]++;
        chmax(tmp, cnt[s]);
    }
    for(auto p : cnt)if(p.second == tmp)cout << p.first << endl;

    return 0;
}

Measured memory_bytes: 25216
// AtCoder Regular Contest 072
// C - Sequence

#include <cstdio>
#include <cmath>
#include <algorithm>
#define MAX_N 100000
using namespace std;
typedef long long int ll;


int N;
ll a[MAX_N];
ll ans;

int main() {

  ll sum, tmp_ans;
  bool pm;

  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }

  ans = (ll)1e14;
  for (int j = 0; j < 2; j++) {
    sum = 0;
    tmp_ans = 0;
    pm = (j == 0);
    for (int i = 0; i < N; i++) {
      sum += a[i];
      if (sum == 0) {
        tmp_ans++;
        sum = pm ? 1 : -1;
      } else if ((sum > 0) == pm) {
        if (sum > 0) {
          tmp_ans += sum + 1;
          sum = -1;
        } else {
          tmp_ans += 1 - sum;
          sum = 1;
        }
      }
      pm = (sum > 0);
    }
    ans = min(ans, tmp_ans);
  }

  printf("%lld\n", ans);

  return 0;

}




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

#define int long long int
#define vi vector<int>
#define pb push_back
#define vvi vector<vi>

signed main() {
    int a, b;
    vi v(4, 0);
    cin >> a >> b;
    v[a] = 1; v[b] = 1;
    for(int i = 1; i <= 3; i++) {
        if(!v[i]) {
            cout << i << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 3632
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;
fn ex_gcd(x: i64, y: i64) -> (i64, i64) {
    let mut r0 = x;
    let mut a0 = 1;
    let mut b0 = 0;

    let mut r = y;
    let mut a = 0;
    let mut b = 1;

    while r > 0 {
        let r2 = r0 % r;
        let a2 = a0 - r0 / r * a;
        let b2 = b0 - r0 / r * b;
        r0 = r; r = r2;
        a0 = a; a = a2;
        b0 = b; b = b2;
    }
    (a0, b0)
}

fn mod_inv(x: i64, m: i64) -> i64 {
    let mut a = ex_gcd(x, m).0;
    while a < 0 { a += m; }
    a
}

fn comb(n: i64, k: i64, m: i64) -> i64 {
    if k == 0 { return 1; }
    if k == 1 { return n % m; }
    if n - k < k { return comb(n, n - k, m); }

    (((comb(n - 1, k - 1, m) * n) % m) * mod_inv(k, m)) % m
}

fn main() {
    let mut sc = Scanner::new();
    let n: i64 = sc.cin();
    let m: i64 = sc.cin();
    let k: i64 = sc.cin();
    let x = {
        let mut s = 0;
        for i in 1..n {
            s += i * (n - i);
        }
        (((s * m) % M) * m) % M
    };
    let y = {
        let mut s = 0;
        for i in 1..m {
            s += i * (m - i);
        }
        (((s * n) % M) * n) % M
    };
    trace!(x, y);
    trace!(comb(n * m - 2, k - 2, M) );
    let ans = (comb(n * m - 2, k - 2, M) * ((x + y) % M)) % M;
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

int main() {
	//入力
	int n;
	cin >> n;
	int d[100];
	for (int i = 0; i < n; i++) cin >> d[i];

	//dを大きい順に並び変え
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (d[i] < d[j]) {
				int tmp = d[i];
				d[i] = d[j];
				d[j] = tmp;
			}
		}
	}

	//数え上げ
	int count = 1;
	for (int i = 0; i < n - 1; i++) {
		if (d[i] > d[i + 1]) count++;
	}

	//出力
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
//March

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
using g = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    vecrep(n,s,string);
    ll ans = 0;
    vector<ll>r(5,0);
    rep(i,0,n){
        if(s[i][0]=='M')r[0]++;
        if(s[i][0]=='A')r[1]++;
        if(s[i][0]=='R')r[2]++;
        if(s[i][0]=='C')r[3]++;
        if(s[i][0]=='H')r[4]++;
    }
    rep(i,0,5)rep(j,i+1,5)rep(k,j+1,5)ans+=r[i]*r[j]*r[k];
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 6144
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

int mex(vector<int>& v){
  int a=0,n=v.size();
  rep(i,n){
    if(v[i]==a)a++;
    else break;
  }
  return a;
}

int main(){
  int x,n; cin >>x >>n;
  vector<int> a(n); rep(i,n) cin >>a[i];
  rep(i,n) a[i]-=x;
  sort(a.begin(),a.end());
  if(df)print("a",a);
  int flag=1;
  vector<int> po,ne;
  rep(i,n){
    if(a[i]>=0) po.push_back(a[i]);
  }
  if(df)print("a",po);
  reverse(a.begin(),a.end());
  rep(i,n){
    if(a[i]<=0) ne.push_back(-a[i]);
  }
  if(df)print("a",ne);
  int pm=mex(po),nm=mex(ne);
  if(df)print("a",pm,nm);
  if(nm<=pm){
    print(x-nm);
  }else{
    print(x+pm);
  }
}


Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <utility>
#include <queue>

using namespace std;
typedef long long signed int ll;

constexpr int inf = INT32_MAX / 2;
constexpr int mod = 1000000007;
constexpr int maxn = 100000;

int h, w, k;
ll dp[101][8][8];

int pow2(int n) {
	return n == 0 ? 1 : pow2(n - 1) * 2;
}

int main() {
	cin >> h >> w >> k;
	for (int i = 0; i < pow2(w - 1); i++) {
		bool f = false;
		for (int j = 0; j < w - 2; j++) {
			if ((i & (1 << j)) && (i & (1 << (j + 1)))) f = true;
		}
		if (f) continue;
		for (int j = 0; j < w; j++) {
			if (i & (1 << j)) {
				dp[1][j][j + 1]++;
			}
			else if ((j > 0) && (i & (1 << (j - 1)))) {
				dp[1][j][j - 1]++;
			}
			else {
				dp[1][j][j]++;
			}
		}
	}
	for (int i = 2; i <= h; i++) {
		for (int s = 0; s < w; s++) {
			for (int t = 0; t < w; t++) {
				for (int u = 0; u < w; u++) {
					dp[i][s][t] = (dp[i][s][t] + dp[i - 1][s][u] * dp[1][u][t]) % mod;
				}
			}
		}
	}
	cout << dp[h][0][k-1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

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



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	ll x, t; cin >> x >> t;
	ll ans = x - t;
	cout << (ans >= 0 ? ans : 0) << endl;
	return 0;
}

Measured memory_bytes: 256