akhauriyash/Code-Regression huggingface dataset:
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll a,b;
  cin >> a >> b;

  ll aa = a / 0.08;
  ll bb = b / 0.1;
  for(ll i = 1;i <= 1100; i++)
  {
    if((ll)(i * 0.08) == a && (ll)(i * 0.1) == b)
    {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
	int a, b, count;
	scanf("%d%d",&a,&b);
	int c = b;
	while (c != 0)
	{
		c = c / 10;
		count++;
	}
	while (count--)
	{
		a *= 10;
	}
	a = a + b;
	if (a == (int)sqrt(a) * (int)sqrt(a))
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


/*
Euclidean Algorithm
 */
ll euclid(ll a, ll b){
  while (b>0){
    a = a % b;
    swap(a, b);
  }
  return a;
}



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

  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i,N){ cin >> A[i];}

  //unordered_map<ll, bool> seen_map;
  vector<ll> primes(0);
  REP(i,N){
    ll ai = A[i];
    //if (seen_map.find(ai) != seen_map.end()) continue;
    //seen_map[ai] = 1;
    //bool seen = false;
    for(ll& p : primes){
      //seen_map[ai] = 1;
      if (ai%p==0){
        ai /= p;
        //if (seen_map.find(ai) != seen_map.end()){
        //  seen = true;
        //  break;
        //}
      }
      if (ai==1) break;
    }

    //if (seen) continue;

    if (ai>0){
      /*
      Prime factorization
      */
      for(ll i=2; i*i<=ai; i++) {
        if (ai%i == 0) {
          while(ai%i==0) {
            //seen_map[ai] = 1;
            ai/=i;
            primes.push_back(i);
          }
        }
      }
    }
    if(ai>1){
      primes.push_back(ai);
      //seen_map[ai] = 1;
    }
  }

  sort(primes.begin(), primes.end());
  //for (ll& p : primes){ cout << p << " "; }
  //cout << "\n";

  ll ans = 0;
  REP(i,N){
    ll ai = A[i];
    ll bi = 1;
    for (ll& p : primes){
      if (ai%p==0){
        ai /= p;
      } else {
        bi *= p;
        bi %= MOD;
      }
    }
    ans += bi;
    ans %= MOD;
  }


  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 512
object Main {
  def main (args: Array[String]) {
    val input =  scala.io.StdIn.readLine().split(" ").map(_.toInt)
 
    val v = (input(0), input(1), input(2)) match{
      case (n1, n2, n3 ) => List(n1, n2, n3).sorted(Ordering[Int])
      case _ =>  List()
    }

    println( v.mkString(" ") )
  }
}

Measured memory_bytes: 43732
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[30][30];
char atari[30];
ll dp[101];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	ll res = 0;
	while (res < s.length()) {
		if (s[res] == 'r' && s[res + 1] == 'e' && s[res + 2] == 'm' && s[res + 3] == 'a' && s[res + 4] == 'e' && s[res + 5] == 'r' && s[res + 6] == 'd') {
			res += 7;
		}
		else if (s[res] == 'r' && s[res + 1] == 'e' && s[res + 2] == 's' && s[res + 3] == 'a' && s[res + 4] == 'r' && s[res + 5] == 'e') {
			res += 6;
		}
		else if (s[res] == 'e' && s[res + 1] == 's' && s[res + 2] == 'a' && s[res + 3] == 'r' && s[res + 4] == 'e') {
			res += 5;
		}
		else if (s[res] == 'm' && s[res + 1] == 'a' && s[res + 2] == 'e' && s[res + 3] == 'r' && s[res + 4] == 'd') {
			res += 5;
		}
		else {
			break;
		}
	}
	if (res == s.length()) {
		puts("YES");
	}
	else {
		puts("NO");
	}
	return 0;
}


Measured memory_bytes: 3748
import java.util.*;
import java.io.*;

public class Main {
	static final int mod = (int) 1e9 + 7;
	static final int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int[] DX8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, DY8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	static final String nextLine = "\n";

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		long l = fs.nextLong();
		long t = l*l*l;
		double ans = (double)t/27;
		System.out.println(ans);
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
#define N 50009
using namespace std;

int read(); ll readll();
int n,m,cnt,type,a[N<<1],b[N<<1]; bitset<N> C,c[N];
char ans[N<<1],ch[N<<2]; bool bo[N];
pair<pii,int> last[N<<2]; map<pair<pii,int>,int> mp;
bool check(int x,int y,int u,int v){
	return min(x,y)==min(u,v) && max(x,y)==max(u,v);
}
void opt(pair<pii,int> o){
	if (!o.se) return;
	opt(last[mp[o]]); putchar(ch[mp[o]]);
}
void dfs(int x,int y,int k,int u,int v,char c){
	if (x>y) swap(x,y); if (x==y) return;
	auto o=mpr(mpr(x,y),k);
	if (mp[o]) return; mp[o]=++cnt;
	last[cnt]=mpr(mpr(u,v),k-1); ch[cnt]=c;
	if (k==m){ opt(o); puts(""); exit(0); }
	k++;
	if (check(x,y,a[k],b[k])) return;
	if (x==a[k] || x==b[k]){
		dfs(x,y,k,x,y,(x==a[k]?'^':'v'));
		dfs(x^a[k]^b[k],y,k,x,y,(x==a[k]?'v':'^'));
		return;
	}
	if (y==a[k] || y==b[k]){
		dfs(x,y,k,x,y,(y==a[k]?'^':'v'));
		dfs(x,y^a[k]^b[k],k,x,y,(y==a[k]?'v':'^'));
	}
	dfs(x,y,k,x,y,'^');
}
int main(){
	scanf("%d%d%d",&n,&m,&type);
	int i,j;
	for (i=1; i<=m; i++) scanf("%d%d",&a[i],&b[i]);
	if (type==2){
		if (n==2){ puts("-1"); return 0; }
		int x=a[1],y=b[1],z=1;
		while (z==x || z==y) z++;
		dfs(x,z,1,0,0,'^'); dfs(y,z,1,0,0,'v');
		return 0;	
	}
	for (i=1; i<=n; i++) c[i].set(i);
	for (i=1; i<=m; i++){
		C=c[a[i]];
		c[a[i]]|=c[b[i]]; c[b[i]]|=C;
	}
	for (i=1; i<=n; i++) C.set(i);
	for (i=1; i<=n; i++) if ((c[i]^C).none()){
		bo[i]=1;
		for (j=m; j; j--) if (bo[a[j]]){
			ans[j]='^'; bo[b[j]]=1;
		} else{
			ans[j]='v'; bo[a[j]]=bo[b[j]];
		}
		puts(ans+1); break;
	}
	if (i>n) puts("-1");
	return 0;
}

int read(){
	int x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
ll readll(){
	ll x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}


Measured memory_bytes: 307328
h,w,a,b=[int(_) for _ in input().split()]

ans=[[0 for i in range(w)]for j in range(h)]

for i in range(a,w):
  for j in range(b):
    ans[j][i]=1
for i in range(a):
  for j in range(b,h):
    ans[j][i]=1
    
for i in range(h):
  for j in range(w):
    print(ans[i][j],end="")
  print()

Measured memory_bytes: 14196
#include<bits/stdc++.h>
using namespace std;
int main() {
	string input;
	vector<char> v;
	cin >> input;
	for (auto c : input) {
		if (c == 'B'&&v.size()>0) {
			v.erase(v.end() - 1);
		}
		else if(c != 'B'){
			v.push_back(c);
		}
	}
	for (auto i : v) {
		cout << i;
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  cout << ((abs(b-a)<=d && abs(c-b)<=d) || abs(c-a)<=d ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

struct RUQ{
	using T = int;
	T operator()(const T &a, const T &b) { return min(a,b); };
	static constexpr T identity() { return INT_MAX; }
};

template<class Monoid>
class rangeUpdateQuery{
	private:
		using T = typename Monoid::T;
		Monoid op;
		const int n;
		vector<T> dat, lazy;
		int query(int a, int b, int k, int l, int r){
			evaluate(k);

			if(b <= l || r <= a) return INT_MAX;
			else if(a <= l && r <= b) return dat[k];
			else{
				int vl = query(a, b, k * 2, l, (l + r) / 2);
				int vr = query(a, b, k * 2 + 1, (l + r) / 2, r);
				return min(vl, vr);
			}
		}
		inline void evaluate(int k){
			if(lazy[k] == op.identity()) return;
			dat[k] = lazy[k];
			if(k < n){
				lazy[2 * k] = lazy[k];
				lazy[2 * k + 1] = lazy[k];
			}
			lazy[k] = op.identity();
		}
		void update(int a, int b, int k, int l, int r, int x){
			evaluate(k);
			if(r <= a || b <= l) return;
			if(a <= l && r <= b){
				lazy[k] = x;
			}else if(l < b && a < r){
				evaluate(k);
				update(a, b, k * 2, l, (l + r) / 2, x);
				update(a, b, k * 2 + 1, (l + r) / 2, r, x);
			}
		}
		int power(int n){
			int res = 1;
			while(n >= res) res*=2;
			return res;
		}
	public:
		rangeUpdateQuery(int n) : n(power(n)), dat(4 * n, op.identity()), lazy(4 * n, op.identity()) {}
		rangeUpdateQuery(const vector<T> &v) : n(v.size()), dat(4 * n), lazy(4 * n, op.identity()){
			copy(begin(v), end(v), begin(dat) + n);
			for(int i = n - 1; i > 0; i--) dat[i] = op(dat[2 * i], dat[2 * i + 1]);
		}
		int query(int a, int b){ return query(a,b,1,0,n); }
		void update(int s, int t, int x){ update(s, t, 1, 0, n, x); }
		int get(int a){ return query(a, a + 1); };
};

int main(){
	int n, q;
	cin >> n >> q;

	rangeUpdateQuery<RUQ> seg(n);
	rep(i,q){
		int com;
		cin >> com;
		if(not com){
			int s, t, x;
			cin >> s >> t >> x;
			//cout << s << ' ' << t << endl;
			seg.update(s + 1, t + 2, x);
		}else{
			int p;
			cin >> p;
			cout << seg.get(p + 1) << endl;
		}
	}
}



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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro = 0;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro + " " + hanako);
    }
}

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

int main() {
	int n, k;
	long long int ans = 0, anst = 0;
	cin >> n >> k;
	vector<int> v(n), t;
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	for (int i = 0; i <= min(n, k); ++i) {
		for (int j = 0; j <= min(n, k) - i; ++j) {
			anst = 0;
			for (int m = 0; m < i; ++m) {
				t.push_back(v[m]);
				anst += v[m];
			}
			for (int m = 0; m < j; ++m) {
				t.push_back(v[n - 1 - m]);
				anst += v[n - 1 - m];
			}
			sort(t.begin(), t.end());
			for (int m = 0; m < min(k - i - j, (int)t.size()); ++m) {
				if (t[m] < 0) anst -= t[m];
				else break;
			}
			ans = max(ans, anst);
			t.clear();
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 100000

#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

int main()
{
    int N = 0;
    
    cin >> N;
    
    cout << N * N * N << endl;

    return 0;
}


Measured memory_bytes: 256
from functools import reduce
from operator import xor
from itertools import chain

def main():
    M,K = map(int,input().split())

    if K >= 2**M:
        print(-1)
        return

    if M >= 2:
        def it():
            for i in reversed(range(2**M)):
                if i != K:
                    yield i
            yield K
            for i in range(2**M):
                if i != K:
                    yield i
            yield K
        print(*it())
    elif M == 1:
        if K == 0:
            print(0,0,1,1)
        else:
            print(-1)
    else:
        print(0, 0)

if __name__ == '__main__':
    main()

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

int main() {
    int l, r, d, cnt = 0;
    cin >> l >> r >> d;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<int, int> pii;  // pair<int, int> に pii という別名を付ける
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vi num(3);
  for (int i = 0; i < 3; i++) cin >> num.at(i);
  cout << num.at(2) << " " << num.at(0) << " " << num.at(1) << endl;
}

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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k; cin >> k;
    int ans = 1;
    ll tmp = 7;
    while (true) {
        if (ans == k + 1 || tmp % k == 0) break;
        else {
            tmp = (tmp * 10 + 7) % k;
            ans++;
        }
    }
    if (ans == k + 1) ans = -1;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                if (input[0] == 0) break;

                DateTime dateValue = new DateTime(2004, input[0], input[1]);
                sb.AppendLine(dateValue.DayOfWeek.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9324
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
  int n;
  scanf("%d",&n);
  vector<int> A(n),B(n);
  for(int i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(int i=0;i<n;i++){
    scanf("%d",&B[i]);
  }
  vector<pair<int,int> > a(n),b(n);
  for(int i=0;i<n;i++){
    a[i]=make_pair(A[i],i);
    b[i]=make_pair(B[i],i);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int ans=-1;
  for(int i=0;i<n;i++){
    if(a[i].first>b[i].first){
      ans=0;
      break;
    }
  }
  if(ans!=0){
    for(int i=0;i<n;i++){
      if(i+1<n&&a[i+1].first<=b[i].first){
	ans=1;
	break;
      }
    }
  }
  if(ans==-1){
    ans=0;
    vector<int> ra(n);
    for(int i=0;i<n;i++){
      ra[a[i].second]=i;
    }
    for(int i=0;i<n-1;i++){
      if(ra[b[i].second]==i){
	ans=1;
	break;
      }
      int rabi=ra[b[i].second];
      swap(ra[b[i].second],ra[a[i].second]);
      a[rabi].second=a[i].second;
      a[i].second=b[i].second;
    }
  }
  puts(ans==1?"Yes":"No");
  return 0;
}


Measured memory_bytes: 2944
#!/usr/bin/env ruby -wKU

while (h,w = gets.split.map(&:to_i)) != [0,0]
	t = ['#.'*(w/2) + '#'*(w%2) , '.#'*(w/2) + '.'*(w%2)]
	h.times do |i|
		puts t[ i % 2 ]
	end
	puts
end

Measured memory_bytes: 6104
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, N) for(int i = 0; i < N; i++)

int ans = 0;
int x = 0;
int N;
string S;

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

    rep(i, S.size()) {
        if (S[i] == 'I') x++;
        if (S[i] == 'D') x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }

  vector<vector<int>> L(H, vector<int>(W, 0));
  vector<vector<int>> R(H, vector<int>(W, 0));
  vector<vector<int>> U(H, vector<int>(W, 0));
  vector<vector<int>> D(H, vector<int>(W, 0));

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') continue;
      U[i][j] = i == 0 ? 1 : U[i - 1][j] + 1;
      L[i][j] = j == 0 ? 1 : L[i][j - 1] + 1;
    }
  }

  for (int i = H - 1; i > -1; i--) {
    for (int j = W - 1; j > -1; j--) {
      if (S[i][j] == '#') continue;
      D[i][j] = i == H - 1 ? 1 : D[i + 1][j] + 1;
      R[i][j] = j == W - 1 ? 1 : R[i][j + 1] + 1;
    }
  }

  int res = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      res = max(res, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 67328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const long double saved = 20 - 5*M_PI;

struct ST {
	int n;
	vi t;
	ST(int n) : n(n){
		t.resize(2*n);
	}
	int que(int l, int r){
		int ans = 0;
		for(l += n, r += n; l < r; l /= 2, r /= 2){
			if(l&1) ans = max(ans, t[l++]);
			if(r&1) ans = max(ans, t[--r]);
		}
		return ans;
	}
	void upd(int val, int pos){
		for(pos += n; pos; pos /= 2) t[pos] = max(t[pos], val);
	}
};

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.precision(15);
	
	int x1, y1, x2, y2, n;
	cin >> x1 >> y1 >> x2 >> y2 >> n;
	vector<pii> ps;
	rep(_,0,n){
		int x,y;
		cin >> x >> y;
		if(x < min(x1,x2) || x > max(x1,x2) || y < min(y1,y2) || y > max(y1,y2)) ;
		else ps.emplace_back(x,y);
	}
	n = sz(ps);
	if(x1 > x2) swap(x1,x2), swap(y1,y2);
	if(y1 > y2){
		swap(y1, y2);
		trav(pa, ps) pa.second = y1+y2 - pa.second;
	}
	x2 -= x1, y2 -= y1;
	trav(pa, ps) pa.first -= x1, pa.second -= y1;
	ll ans = 100LL * (x2 + y2);
	if(n == 1 + min(x2, y2)){
		sort(all(ps));
		rep(i,1,n) if(ps[i].second < ps[i-1].second) goto nope;
		cout << ans - (n-1)*saved + M_PI*10 - 20 << endl;
		return 0;
		nope: ;
	}
	map<int,int> ren;
	ren[y2] = 0;
	ren[0] = 0;
	trav(pa, ps) ren[pa.second] = 0;
	int ix = 0;
	trav(pa, ren) pa.second = ix++;
	trav(pa, ps) pa.second = ren[pa.second];
	sort(all(ps));
	ST st(ix);

	trav(pa, ps){
		st.upd(1+st.que(0,pa.second), pa.second);
	}
	cout << ans - saved*st.que(0,ix) << endl;
}

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

int main()
{
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;

    if (D2 == 1)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}


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

char addChar(int i, char s){
  int tmp = int(s) + i;
  if(tmp > 90) tmp -= 26;
  return char(tmp);
}

int main() {
	string S;
  	int N;
	cin >> N >> S;
 
  	string ans;
  	int ans2;
  	rep(i, S.size()) ans.push_back(addChar(N, S.at(i)));
  	
  	cout << ans << endl;
}


Measured memory_bytes: 3648
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
char str[100100];
int main(){
	scanf("%s",str+1);
	int n=strlen(str+1);
	for(int i=1;i<=n-8;i++)
		printf("%c",str[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    cout << (n % 1000 == 0 ? 0 : 1000 - n % 1000) << endl;

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int N;
    cin >> N;
    vint A(N);
    cin >> A;
    int ans = 0;
    for(auto a:A){
        ans += a;
    }
    if(0 != ans%10){
        cout << ans << endl;
        return 0;
    }
    sort(A.begin(),A.end());
    for(auto a:A){
        if(0 == a%10)continue;
        ans -= a;
        if(0!=ans%10){
            cout << ans << endl;
            return 0;
        }
    }
    cout << 0 << endl;

}

Measured memory_bytes: 3628
#-*- coding:utf-8 -*-

N, M = map(int, input().split())
L, R = [None for _ in range(M)], [None for _ in range(M)]
for i in range(M):
    L[i], R[i] = map(int, input().split())

# L < R
st = -1
end = N
for i in range(M):
    if L[i] > st:
        st = L[i]
    if R[i] < end:
        end = R[i]

r = end - st + 1
if r < 0:
    r = 0
print(r)



Measured memory_bytes: 11048
import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**8)

def main():
    n=int(input())
    grid=[list(map(int,input().split()))for i in range(n)]
    p=floyd_warshall(csgraph=csr_matrix(grid))
    q=[list(i) for i in p]
    
    if q!=grid:
        print(-1)
    else:
        for i in range(n):
            p[i][i]=float("inf")
        ans=0
        for i in range(n):
            for j in range(i):
                if i==j:
                    continue
                if p[i][j]<min(np.array(p[i])+np.array(p[j])):
                    
                    ans+=p[i][j]
        print(int(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 24284
def cal(sgn, n1, n2):
    return n1 + n2 if sgn == '+' else n1 - n2


A, B, C, D = map(int, list(input()))
sgns = []
for bit in range(1<<3):
    tmp = ['+'] * 3
    for i in range(3):
        if ((bit>>i) & 1) == 1:
            tmp[i] = '-'
    sgns.append(tmp)

for sgn in sgns:
    if cal(sgn[2], cal(sgn[1], cal(sgn[0], A, B), C), D) == 7:
        print('{0}{1}{2}{3}{4}{5}{6}=7'.format(A, sgn[0], B, sgn[1], C, sgn[2], D))
        exit()

Measured memory_bytes: 3064
{-
	AOJ ITP1_1_D
	title:watch
	@kankichi573
-}
main = do
   s <- getLine
   let sec1 = (read s :: Int)
   let sec  = mod sec1 60
   let min  = mod (div sec1 60) 60
   let hour = div sec1 3600
   putStrLn $ (show hour) ++ ":" ++ (show min) ++ ":" ++ (show sec)

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから

void solve(){
  int a,b,q;
  cin>>a>>b>>q;
  vector<ll>s(a),t(b);
  ll x;
  rep(i,a)cin>>s[i];
  rep(i,b)cin>>t[i];
  rep(i,q){
    cin>>x;
    ll ans=INF;
    int sr=lower_bound(all(s),x)-s.begin();
    int tr=lower_bound(all(t),x)-t.begin();
    int sl=max(0,sr-1);
    int tl=max(0,tr-1);
    chmin(sr,a-1);
    chmin(tr,b-1);
    chmin(ans,abs(s[sl]-t[tl])+min(abs(x-s[sl]),abs(x-t[tl])));
    chmin(ans,abs(s[sl]-t[tr])+min(abs(x-s[sl]),abs(x-t[tr])));
    chmin(ans,abs(s[sr]-t[tl])+min(abs(x-s[sr]),abs(x-t[tl])));
    chmin(ans,abs(s[sr]-t[tr])+min(abs(x-s[sr]),abs(x-t[tr])));
    cout<<ans<<"\n";
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 2944
#include <cstdio>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <time.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <memory.h>
#include <cstdlib>
#include <queue>
#include <iomanip>
#define P pair<int, int>
#define LL long long
#define LD long double
#define PLL pair<LL, LL>
#define mset(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i < b; i++)
#define PI acos(-1.0)
#define random(x) rand() % x
using namespace std;
const int inf = 0x3f3f3f3f;
const LL __64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 1e5 + 5;
const int Mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n)
        cin >> a[i];
    sort(a.begin(), a.end());
    int ans = inf;
    rep(i, 1, n)
    {
        ans = min(ans, __gcd(a[0], a[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<cmath>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<stdio.h>
#include<queue>
#define pb push_back
#define ll long long
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
int n,d,x,a;
int main()
{
  cin>>n>>d>>x;
  for(int i=1;i<=n;i++)
  {
    cin>>a;
    x+=1+(d-1)/a;
  }
  cout<<x<<endl;
  return 0;
}

Measured memory_bytes: 256
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

void solve(){
	 ll m,n;
	 cin>>m>>n;
	 ll l = max(-10000LL,n-m+1),r = min(10000LL,n+m-1);
	 rep(i,l,r+1)cout<<i<<" ";
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

MOD = 1000000007  # type: int

def solve(N: int, K: int, A: "List[int]"):
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            tmp = 0
            if A[i] > A[j]:
                tmp = K * (K + 1) // 2
            elif A[i] < A[j]:
                tmp = (K - 1) * K // 2
            ret += tmp
            ret %= MOD
    print(ret)
    return


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
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N-1-0+1) ]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, K = read_int()
h = read_int()
h.sort()

def bisect_find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect.bisect_left(a, x)
    # if i != len(a):
    return i
    # raise ValueError

def solve():
    ans = N - bisect_find_ge(h, K)
    return ans

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 12520
#include <iostream>
#include <iomanip>
#include <cmath>
int main(){
  int n,i;
  double k,temp=1,ans=0;
  std::cin>>n>>k;
  i=n;
  while(i>0){
    if (i>=k){
      ans+=temp;
      i--;
    }else{
      k/=2;
      temp/=2;
    }
  }
  std::cout << std::fixed;
  std::cout << std::setprecision(10) << ans/n<< '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int vy[] = {0, 1, 0, -1}, vx[] = {1, 0, -1, 0};
 
int main()
{
  bool prime[114515] = {};
  int L, R;
  cin >> L >> R;
 
  int V[1145141], sum[1145141] = {};
  for(int i = 0; i <= R - L; i++) V[i] = i + L;
  prime[0] = true;
  prime[1] = true;
  for(int i = 2; i <= 114514; i++) {
    if(!prime[i]) {
      for(int j = i + i; j <= 114514; j += i) {
        prime[j] = true;
      }
      for(int j = (L + i - 1) / i * i; j <= R; j += i) {
        while(V[j - L] % i == 0) {
          ++sum[j - L];
          V[j - L] /= i;
        }
      }
    }
  }
 
  int ret = 0;
  for(int i = 0; i <= R - L; i++) {
    if(V[i] > 1) ++sum[i];
    ret += prime[sum[i]] == 0;
  }
  cout << ret << endl;
}

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

const int md = (int) 1e9 + 7;

int a[200005],sum[200005],dp[200005];

inline void add(int &x, int y) {
	x += y;
	if (x >= md) x -= md;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	int m = *max_element(a, a+n) + 1;
	dp[0] = 1;
	for (int i = 0; i < n; ++i) {
		dp[i + 1] = dp[i];
		if (!i || a[i] != a[i - 1]) add(dp[i + 1], sum[a[i]]);
		if (!i || a[i] != a[i - 1]) add(sum[a[i]], dp[i]);
	}
	cout << dp[n] << "\n";
	return 0;
}

Measured memory_bytes: 2560
import numpy as np
A,B,H,M = map(int,input().split())

M_a = (H/6 + M/360) * np.pi
M_b = (M/30) * np.pi

r = max(M_a,M_b) - min(M_a,M_b)

c = np.sqrt(A**2+B**2-(2*A*B*np.cos(r)))

print(c)

Measured memory_bytes: 27164
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        long cnt1 = 0;
        long add1 = 0;
        //一番目を奇数スタートにする。
        for (int i = 0; i < n; i++) {
            add1 += a[i];
            if (i % 2 == 0 && add1 <= 0) {
                cnt1 += (long) 1 - add1;
                add1 = 1;
            } else if (i % 2 == 1 && add1 >= 0) {
                cnt1 += (long) add1 + 1;
                add1 = -1;
            }
        }

        long cnt2 = 0;
        long add2 = 0;
        for (int i = 0; i < n; i++) {
            add2 += a[i];
            if (i % 2 == 1 && add2 <= 0) {
                cnt2 += (long) 1 - add2;
                add2 = 1;
            } else if (i % 2 == 0 && add2 >= 0) {
                cnt2 += (long) add2 + 1;
                add2 = -1;
            }
        }

        System.out.println(Math.min(cnt1, cnt2));

    }

}

Measured memory_bytes: 51864
#include <stdio.h>
int main(void){
    int n, i;
    long long int a[1000000];
    int min, max;
    long long int sum;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%lld", &a[i]);
    }
    
    min = a[0];
    for(i = 1; i < n; i++){
        if(a[i] < min){
            min = a[i];
        }
    }
    printf("%d ", min);

    max = a[0];
    for(i = 1; i < n; i++){
        if(a[i] > max){
            max = a[i];
        }
    }
    printf("%d ",max);

    sum = 0;
    for(i = 0; i < n; i++){
        sum += a[i];
    }
    printf("%lld\n", sum);

    return 0;
}


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


int main() {
    int n,m;
    cin >> n >> m;
    int ans = (n-1)*(m-1);
    cout << ans << endl;
}

Measured memory_bytes: 3460
#include <stdio.h>
#define SIZE 1005
#define MOD int(1e9+7)

  bool isMarked[SIZE][SIZE];
  int matrix[SIZE][SIZE];

  int main(void) {
        int n,m;
        scanf("%d %d",&n,&m);
        for(int i=0; i<n; i++) {
          for(int j=0; j<m; j++) {
              char c;
              scanf(" %c",&c);
              if(c == '#') isMarked[i][j] = true;
              else isMarked[i][j] = false;
           }
        }

        for(int i=1; i<=n; i++){
                for(int j=1; j<=m; j++) {
                        if(isMarked[i-1][j-1]) matrix[i][j] = 0;
                        else if(i==1 && j==1)  matrix[i][j] = 1;
                        else matrix[i][j] = (matrix[i-1][j]+matrix[i][j-1])%MOD;
                }
        }

        printf("%d",matrix[n][m]);
        return 0;
  }






Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n;

int a[100010];
int b[100010];
int c[100010];

ll bc[100010];
ll ans;

int main()
{
	read(n);
	for(int i=1; i<=n; ++i) read(a[i]);
	for(int i=1; i<=n; ++i) read(b[i]);
	for(int i=1; i<=n; ++i) read(c[i]);
	sort(a+1, a+n+1);
	sort(b+1, b+n+1);
	sort(c+1, c+n+1);
	for(int i=n, p=n+1; 1<=i; --i){
		while(1<p && b[i]<c[p-1]) --p;
		bc[i]=n-p+1;
	}
	ll tmp = 0;
	for(int i=n, p=n+1; 1<=i; --i){
		while(1<p && a[i]<b[p-1]) tmp += bc[--p];
		ans += tmp;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>

template<typename T>inline void read(T &x)
{
	char c=x=0;
	for(c=getchar();!isdigit(c);c=getchar());
	for(;isdigit(c);c=getchar())x=(x<<3)+(x<<1)+(c^48);
}

namespace gg
{
	typedef long long ll;
	const int N=101000,MOD=1000000007;
	ll s[N],f[N],d[2];
	int pos[N][2],march[N][2];
	int to[N][2];
	int n;
	void calc_pos(int rag)
	{
		int ind=n+1;
		march[n+1][rag]=n+1;
		for(int i=n;i;i--)
		{
			while(s[ind-1]-s[i]>=d[rag])ind--;
			pos[i][rag]=ind;

			if(pos[i][rag]==i+1)march[i][rag]=march[i+1][rag];
			else march[i][rag]=i;
		}
	}
	void calc_edge(int p,int rag)
	{
		int x=pos[p][rag],y=march[p+1][rag^1];

		if(y>=x)to[p][rag]=x;
		else if(y==x-1)to[p][rag]=to[y][rag^1];
		else to[p][rag]=0;
	}
	void initialize()
	{
		read(n),read(d[0]),read(d[1]);
		for(int i=1;i<=n;i++)read(s[i]);
		calc_pos(0),calc_pos(1);
		for(int i=n;i;i--)calc_edge(i,0),calc_edge(i,1);
	}
	void solve()
	{
		initialize();

//		for(int i=1;i<=n;i++)printf("%d ",pos[i][0]);printf("\n");
//		for(int i=1;i<=n;i++)printf("%d ",pos[i][1]);printf("\n");

//		for(int i=1;i<=n;i++)printf("%d ",to[i][0]);printf("\n");
//		for(int i=1;i<=n;i++)printf("%d ",to[i][1]);printf("\n");

		f[n+1]=1;
		for(int i=n;i;i--)
			f[i]=(f[to[i][0]]+f[to[i][1]])%MOD;
		printf("%lld\n",f[1]);
	}
}
int main()
{
	gg::solve();
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  int a[n];
  rep(i,n) R a[i];
  int c[100001];mem(c);
  rep(i,n) c[a[i]]++;
  int k=n%2==0;
  ll ans=1;
  if(!k) c[k]*=2;
  for(int i=k; i<=n; i+=2) {
    if(c[i]!=2) {
      pr(0);
      return;
    }
    if(i) ans*=2;
    ans%=MAX;
  }
  pr(ans);
}

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


Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////


void solve(){
    ll n;
    cin >> n;
    ll xsum=0;
    Vi a(n);
    rp(i,n){
        cin >> a[i];
        if(i>=2) xsum^=a[i];
    }
    ll gap=a[0]+a[1]-xsum;
    if(gap&1){
        print(-1);
        return;
    }
    gap/=2;
    ll na=0,nb=0;
    rp(i,45){
        if(gap&(1ll<<i)){
            na+=1ll<<i;
            nb+=1ll<<i;
        }
    }
    if(na>a[0]){
        print(-1);
        return;
    }
    for(ll i=44; i>=0; i--){
        if(na&(1ll<<i)) {
            if(xsum&(1ll<<i)){
                print(-1);
                return;
            }
            continue;
        }
        if(xsum&(1ll<<i)){
            if(na+(1ll<<i)<=a[0]){
                na+=(1ll<<i);
            }else{
                nb+=(1ll<<i);
            }
        }
    }
    if(na==0){
        print(-1);
        return;
    }
    print(a[0]-na);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}

template <typename T>
struct Graph{
  int n;
  vector<vector<pair<int, T> > > es;
  vector<T> mincost;
  vector<bool> used;
  Graph(int n_){
    n = n_;
    es.resize(n);
    mincost.resize(n);
    used.resize(n);
  }
  void adde(int from, int to, T cost){
    es[from].push_back(make_pair(to, cost));
    es[to].push_back(make_pair(from, cost));
  }
  T prim(){
    fill(mincost.begin(), mincost.end(), numeric_limits<T>::max());
    fill(used.begin(), used.end(), false);
    T res = 0;
    priority_queue<pair<T, int>, vector<pair<T, int> >, greater<pair<T, int> > > pq;
    mincost[0] = 0;
    pq.push(make_pair(0, 0));
    while(!pq.empty()){
      pair<T, int> p = pq.top(); pq.pop();
      if(used[p.second])continue;
      used[p.second] = true;
      res += p.first;
      for(auto e: es[p.second]){
        if(!used[e.first] && mincost[e.first] > e.second){
          mincost[e.first] = e.second;
          pq.push(make_pair(mincost[e.first], e.first));
        }
      }
    }
    return res;
  }
};

using GraphI = Graph<int>;

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  GraphI graph(n);
  rep(i, m){
    int a, b, c;
    cin >> a >> b >> c;
    graph.adde(a, b, c);
  }
  cout << graph.prim() << endl;
	return 0;
}



Measured memory_bytes: 6208