akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
struct edge{
    int to, cost;
    edge(int a = 0, int b = 0) : to(a), cost(b) {}
};
template<class E>
vector<ll> dijkstra(int s, const vector<vector<E>> &g){
    int n = (int)g.size();
    vector<ll> dist(n, 1LL<<60);
    using ll_i = pair<ll, int>;
    priority_queue<ll_i,vector<ll_i>,greater<ll_i>> pq;
    dist[s] = 0;
    pq.push({dist[s], s});
    while(!pq.empty()){
        auto a = pq.top();
        pq.pop();
        int v = a.second;
        if(a.first > dist[v])continue;
        for(auto &x : g[v]){
            if(dist[x.to] > dist[v] + x.cost){
                dist[x.to] = dist[v] + x.cost;
                pq.push({dist[x.to], x.to});
            }
        }
    }
    return dist;
}
int main(){
    int h, w;
    cin >> h >> w;
    vector<string>s(h);
    rep(i,h){
        cin >> s[i];
    }
    vector<vector<edge>> g(h * w);
    rep(i,h){
        rep(j,w-1){
            if(s[i][j] == '.' and s[i][j+1] == '#'){
                g[i * w + j].emplace_back(i * w + j + 1, 1);
            }else{
                g[i * w + j].emplace_back(i * w + j + 1, 0);
            }
        }
    }
    rep(i,h-1){
        rep(j,w){
            if(s[i][j] == '.' and s[i+1][j] == '#'){
                g[i * w + j].emplace_back((i + 1) * w + j, 1);
            }else{
                g[i * w + j].emplace_back((i + 1) * w + j, 0);
            }
        }
    }
    auto d = dijkstra(0,g);
//    rep(i,h){
//        rep(j,w){
//            cerr << d[i * w + j] << " ";
//        }
//        cerr << endl;
//    }
    ll ans = d[(h - 1) * w + w - 1];
    if(s[0][0] == '#')ans++;
    cout << ans << endl;
}



Measured memory_bytes: 896
n, m = map(int, input().split())
a_list = list(map(int, input().split()))

sum_a = sum(a_list)
# print(sum_a)
border = (1 / (4 * m)) * sum_a
# print(border)

count = 0
for a in a_list:
  if a >= border:
    count += 1
# print(count)

if count >= m:
  print("Yes")
else:
  print("No")

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

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

#define vt          vector
#define rep(i, n)   for (int i = 0; i < (n); i++)
#define sz(x)       (int)(x).size()
#define pb          push_back
#define eb          emplace_back
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

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

    int n;
    cin >> n;
    vt<int> a(n);
    for (int& i : a) cin >> i;

    int cnt = 0;
    rep(i, n) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (a[i] != a[j] &&
                    a[j] != a[k] &&
                    a[i] != a[k] &&
                    (a[i] + a[j] > a[k] &&
                     a[j] + a[k] > a[i] &&
                     a[i] + a[k] > a[j])) cnt++;
            }
        }
    }

    cout << cnt;
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 n;
    cin >> n;

    vector<i64> p(n);
    rep(i,0,n) cin >> p[i];

    i64 ans=0;
    rep(i,1,n-1){
        if(p[i-1]<p[i] and p[i]<p[i+1]) ++ans;
        else if(p[i-1]>p[i] and p[i]>p[i+1]) ++ans;
    }

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }


int main(){
  int n,m; cin>>n>>m;
  int a[n][m]; CINA2(a,n,m);
  int b[m]; CINA(b,m);
  REP(i,n){
    int ans = 0;
    REP(j,m){
      ans += a[i][j]*b[j];
    }
    printf("%d\n",ans);
  }
}


Measured memory_bytes: 3220
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        string str;
        cin>>str;
        lld a=0;
        for(i=0;i<str.length();i++)
            a=a+lld(str[i])-lld('0');
        if(a%9==0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}





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

int main(int argc, char *argv[])
{
    int y, m, d;
    int ans;

    scanf("%d/%d/%d", &y, &m, &d);

    if (y >= 2019 && m >= 5) {
        printf("TBD\n");
    } else {
        printf("Heisei\n");
    }

    return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(int(1e6))

s = input()
t = input()

len_s = len(s)
set_s = set(s)
set_t = set(t)

if len(set_t - set_s) != 0:
    print(-1)
    sys.exit()

n = {}
ss = s + s
ans = 0
for c in t:
    i = ans % len_s
    if not c in n:
        n[c] = [0] * len_s
    if n[c][i] == 0:
        n[c][i] = ss[i:].find(c) + 1
    ans += n[c][i]

print(ans)


Measured memory_bytes: 24368
package main

import (
	"fmt"
	"strconv"
)

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var s string
	fmt.Scan(&s)
	min := 753
	maxI := len(s) - 2
	for i := 0; i < maxI; i++ {
		x, _ := strconv.Atoi(s[i : i+3])
		diff := abs(x - 753)
		if diff < min {
			min = diff
		}
	}
	fmt.Println(min)
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s,t;
    cin>>s>>t;
    if(s.size()+1 != t.size())return cout<<"No",0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i] != t[i])return cout<<"No",0;
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 3652
D, N = [int(x) for x in input().split(" ")]

if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(100 * N)
elif D == 2:
    if N == 100:
        print(1010000)
    else:
        print(10000 * N)



Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <algorithm>
using Int = long long;
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)

//http://www.prefield.com/algorithm/container/fenwick_tree.html
template <class T>
struct fenwick_tree {
  vector<T> x;
  fenwick_tree(int n) : x(n, 0) { }
  T sum(int i, int j) {
    if (i == 0) {
      T S = 0;
      for (j; j >= 0; j = (j & (j + 1)) - 1) S += x[j];
      return S;
    } else return sum(0, j) - sum(0, i-1);
  }
  void add(int k, T a) {
    for (; k < x.size(); k |= k+1) x[k] += a;
  }
};

int main()
{
    Int N, K; cin >> N >> K;
    fenwick_tree<Int> ft(100001);
    REP(i, N) {
        int a, b; cin >> a >> b;
        ft.add(a, b);
    }
    int i = 0;
    while (ft.sum(0, i) < K) i++;
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 1024
import copy
h, w, k = map(int, input().split())
c = []
p = 0
pattern = []
for i in range(h):
    t = list(input())
    c.append(t)
for i in range(2 ** h):
    for j in range(2 ** w):
        s = copy.deepcopy(c)
        count = 0
        for x in range(h):
            for y in range(w):
                if (i >> x & 1) and (j >> y  & 1 ):
                    if s[x][y] == "#":
                # print(s)
                        count += 1
        if count == k:
            p += 1
print(p)

Measured memory_bytes: 9288
#include <stdio.h>
#include <string.h>
#include <algorithm>

#define rep(i,st,ed) for (int i=st;i<=ed;++i)

typedef long long LL;
const int MOD=998244353;
const int N=5005;

int C[N][N],bin[N];

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):v,ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void pre() {
	C[0][0]=bin[0]=1;
	rep(i,1,N-1) {
		bin[i]=2LL*bin[i-1]%MOD;
		C[i][0]=C[i][i]=1;
		rep(j,1,i-1) C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
	}
}

LL calc(int x,int y,int n) {
	LL res=0;
	rep(i,0,std:: min(x,n)) {
		LL tmp=(LL)C[x][i]*bin[i]%MOD*C[n+y-1][y+i-1]%MOD;
		res=(res+tmp)%MOD;
	}
	return res;
}

int main(void) {
	pre();
	int k=read(),n=read();
	rep(i,2,2*k) {
		int cnt=0; LL ans;
		rep(j,1,k) cnt+=(i-j>=1&&i-j<=k);
		if (i&1) ans=calc(cnt/2,k-cnt,n);
		else ans=calc(cnt/2,k-cnt,n)+calc(cnt/2,k-cnt,n-1);
		printf("%lld\n", ans%MOD);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;

struct UnionFind {
  vector<int> par;

  UnionFind(int N) : par(N) { rep(i, N) par[i] = i; }

  int root(int x) { 
    if (par[x]== x) return x;
    else return par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx==ry) return;
    par[rx] = ry;
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

};

int main() {
  int N, K, L; cin >> N >> K >> L;
  UnionFind load(N), train(N);
  rep(i,K) {
    int p, q; cin >> p >> q; p--; q--;
    load.unite(p, q);
  }
  rep(i,L) {
    int r, s; cin >> r >> s; r--; s--;
    train.unite(r, s);
  }

  map<ll, ll> p;
  ll pn[N];
  rep(i,N) {
    ll lr = load.root(i), tr = train.root(i);
    p[lr*N+tr]++;
    pn[i] = lr*N+tr;
  }

  rep(i,N) cout << p[pn[i]] << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 998244353;

int gcd(int a,int b){
  if(b > a)swap(a,b);
  if(a % b == 0)return b;
  else gcd(b,a % b);
}

int a[100010];
int gcdlr[100010];
int gcdrl[100010];

int main(void){
  int n;
  cin >> n;
  for(int i = 0;i < n;++i){
    cin >> a[i];
  }
  gcdlr[0] = a[0];
  for(int i = 1;i < n;++i){
    gcdlr[i] = gcd(gcdlr[i-1],a[i]);
  }
  gcdrl[n-1] = a[n-1];
  for(int i = n-2;i >= 0;--i){
    gcdrl[i] = gcd(gcdrl[i+1],a[i]);
  }
  int res = max(gcdlr[n-2],gcdrl[1]);
  for(int i = 1;i <= n-2;++i){
    res = max(res, gcd(gcdlr[i-1],gcdrl[i+1]));
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
const long long mod=1000000007;

long long modpow(long long a, long long n, long long mod){
  long long res =1;
  while(n>0){
    if(n &1) res= res* a % mod;
    a= a* a%mod;
    n>>=1;
  }
  return res;
}
long long modinv(long long x, long long mod){
  return modpow(x, mod -2, mod);
}

int main() {
  long long x,y;
  cin>>x>>y;
  if((x+y)%3!=0) {
    cout<<0<<endl;
    return 0;
  }
  int a,b;
  a=(-x+2*y)/3;
  b=(2*x-y)/3;
  if(a<0||b<0){
    cout<<0<<endl;
    return 0;
  }
  if(a>b) swap(a,b);
  long long ans=1;
  for(int i=a+b; i>b; i--){
    ans =ans*i%mod;
    if(ans<0) ans+=mod;
  }
  for(int i=1; i<=a; i++){
    ans =ans* modinv(i, mod)%mod;
    if(ans<0) ans+=mod;
  }
  cout<<ans<<endl;
  
}
      

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <cfenv>
#include <cinttypes>
#include <cstdint>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif

#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};



int main(){
 
    int n;
    cin >> n;
    if(n >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3108
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    N = int(inp.readline().strip())

    a = int((N - 1) / 2) + 1
    return str(a)


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,n) for(int i=1;i<=(n);++i)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=200005;
int n,a,b,c,d;
char s[maxn];

bool check(int x,int y){
	int i=x;
	while(i<y){
		if(i+1<=y&&s[i+1]=='.')++i;
		else if(i+2<=y&&s[i+2]=='.')i+=2;
		else return false;
	}
	assert(i==y);
	return true;
}

bool only(int x,int y){
	int i=x;
	while(i<y){
		if(i+1<=y&&s[i+1]=='.'&&i+2<=y&&s[i+2]=='.')return false;
		if(i+1<=y&&s[i+1]=='.')++i;
		else i+=2;
	}
	return true;
}

int main(){
	scanf("%d%d%d%d%d%s",&n,&a,&b,&c,&d,s+1);
	if(!check(a,c)||!check(b,d)){
		puts("No");
		return 0;
	}
	if(d<c&&(s[b-1]=='#'||s[b+1]=='#')&&(s[d-1]=='#'||s[d+1]=='#')&&only(b,d))puts("No");
	else puts("Yes");
	return 0;
}

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

int main() {
  int a; string s;
  cin >> a >> s;
  if(a >= 3200) cout << s << endl;
  else puts("red");
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
bar = [int(n) for n in input().split(' ')]
count = 0
if N >= 3:
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                if (bar[i] != bar[j]) and (bar[j] != bar[k]) and (bar[k] != bar[i]):
                    if (bar[i] + bar[j] > bar[k]) and (bar[i] + bar[k] > bar[j]) and (bar[k] + bar[j] > bar[i]):
                        count += 1

print(count)

Measured memory_bytes: 9212
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		int diffh = H-h;
		int diffw = W-w;
		
		System.out.println(diffh*diffw);
		
	}

}


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

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		InputReader in = new InputReader(System.in);
		int n = in.readInt();
		int t = in.readInt();
		HashMap<Integer,Integer> map = new HashMap<>();
		
		while(n-- > 0) {
			int c = in.readInt();
			int b = in.readInt();
			if( b <= t) map.put(c,b);
			
		}
		if(map.isEmpty()) {
			System.out.println("TLE"); 
			return; 
		}
	    int min = Integer.MAX_VALUE; 
	    for(Integer x : map.keySet()) {
	    	min = Math.min(min, x);
	    }
	    System.out.println(min);
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int A = nextInt();
		int B = nextInt();




		System.out.println(A*B%2==0?"No":"Yes");

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21076
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B;
	std::cin >> A >> B;
	
	if (A * B % 2 != 0) {
		std::cout << "Yes\n";
	} else {
		std::cout << "No\n";
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
ll dp[200][200];
int main() {
  int H, W, K;
  cin >> H >> W >> K, K--;
  dp[0][0] = 1;
  REP(i, H) {
    REP(j, 1 << (W - 1)) {
      int tmp = 0, tmp2 = j;
      bool ng = false;
      while (tmp2 != 0) {
        if (tmp2 & 1) {
          tmp++;
          if (tmp >= 2) {
            ng = true;
          }

        } else {
          tmp = 0;
        }
        tmp2 = tmp2 >> 1;
      }
      if (ng) continue;
      REP(k, W) {
        if ((j >> k) & 1) {
          dp[i + 1][k + 1] += dp[i][k];
          dp[i + 1][k + 1] %= MOD;
          continue;
        }
        if ((j >> (k - 1)) & 1 && k > 0) {
          dp[i + 1][k - 1] += dp[i][k];
          dp[i + 1][k - 1] %= MOD;
          continue;
        }
        dp[i + 1][k] += dp[i][k];
        dp[i + 1][k] %= MOD;
      }
    }
  }
  cout << dp[H][K] << endl;
}

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

main()
{
  int N,*x,*y,*h,i,j,k,init;
  int H,C,a,b,c;
  scanf("%d",&N);
  x = malloc(sizeof(int)*N);
  y = malloc(sizeof(int)*N);
  h = malloc(sizeof(int)*N);
  for(i=0; i<N; i++)
    scanf("%d%d%d",&x[i],&y[i],&h[i]);
  for(i=0; i<=100; i++)
    for(j=0; j<=100; j++)
    {
      init = 0;
      while(h[init]==0)
        init++;
      H = h[init] + abs(i-x[init]) + abs(j-y[init]);
      for(k=0; k<N; k++)
      {
        C = h[k] + abs(i-x[k]) + abs(j-y[k]);
        if(h[k]==0)
        {
          if(H - abs(i-x[k]) - abs(j-y[k]) >0)
            break;
        }
        else
        {
          if(H!=C)
            break;
        }
      }
      if(k==N)
      {
        a = i;b = j;c = H;
      }
    }
      
  printf("%d %d %d\n",a,b,c);
}

Measured memory_bytes: 128
import sys
S = input()
S_List = list(S)

S_o = S_List[0::2]

S_e = S_List[1::2]


for i in S_o:
    if(i != 'R' and i != 'U' and i != 'D'):

        print('No')
        sys.exit()

for i in S_e:
    if(i != 'L' and i != 'U' and i != 'D'):

        print('No')
        sys.exit()

print('Yes')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2000 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll n, h, w;
ll X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
ll field[MAX_N*2][MAX_N*2];
vector<ll> xs, ys, xunzip, yunzip;
map<ll,ll> xzip, yzip;

void compress(vector<ll> &x, map<ll, ll> &zip, vector<ll> &unzip) {
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    unzip.resize(x.size());
    for (int i = 0; i < x.size(); i++) {
        zip[x[i]] = i;
        unzip[i] = x[i];
    }
}

int main() {
    cin >> n;
    REP(i,n){
        cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
        xs.push_back(X1[i]);
        xs.push_back(X2[i]);
        ys.push_back(Y1[i]);
        ys.push_back(Y2[i]);
    }

    compress(xs, xzip, xunzip);
    compress(ys, yzip, yunzip);

    w = xzip.size();
    h = yzip.size();

    REP(i,n){
        field[yzip[Y1[i]]][xzip[X1[i]]]++;
        field[yzip[Y1[i]]][xzip[X2[i]]]--;
        field[yzip[Y2[i]]][xzip[X1[i]]]--;
        field[yzip[Y2[i]]][xzip[X2[i]]]++;
    }
    REP(i,h+1)REP(j,w){
        field[i][j+1] += field[i][j];
    }
    REP(j,w+1)REP(i,h){
        field[i+1][j] += field[i][j];
    }
    ll ans = 0;
    REP(i,h)REP(j,w){
        if(field[i][j]>0) 
            ans += (yunzip[i+1]-yunzip[i])*(xunzip[j+1]-xunzip[j]);
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;

typedef long long int ll;
 
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; }
 
typedef pair<int,int> pair;

int gcd(int a,int b){
    return (a%b==0) ? b : gcd(b,a%b); 
}

int main(){
    int n; cin >> n;
    vector<string> s(n); for(int i=0;i<n;i++) cin >> s[i];

    sort(s.begin(),s.end());

    int ans=1;
    for(int i=1;i<n;i++){
        if(s[i-1]!=s[i]) ans++;
    }

    cout << ans << endl;
}

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

int main() {
  
  int n,h;
  cin >> n >> h;
  
  int idou = 0,saidai = 0,next;
  
  for ( int i = 1; i < n; i++){
    cin >> next;
    if ( h >= next ){
      idou++;
      saidai = max(saidai,idou);
    }else{
      idou = 0;
    }
    h = next;
  }
  
  cout << saidai << endl;   
  
}

Measured memory_bytes: 256
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
	char ch;
	cin>>ch;
	ch++;
	cout<<ch;
        
        












    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static final int MOD = 1000000007;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		boolean[] a = new boolean[N + 1];
		for (int i = 0; i < M; i++) {
			a[Integer.parseInt(sc.next())] = true;
		}
		sc.close();

		long[] ans = new long[N + 1];
		ans[0] = 1;
		ans[1] = a[1] ? 0 : 1;
		for (int i = 2; i <= N; i++) {
			if (a[i]) {
				ans[i] = 0;
			} else {
				ans[i] = getMod(ans[i - 1] + ans[i - 2]);
			}
		}
		System.out.println(getMod(ans[N]));

	}

	static long getMod(long a) {
		return a >= 0 ? a % MOD : MOD + a % MOD;
	}

}

Measured memory_bytes: 46972
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> a(n+1),b(n);
    for(int i=0; i<=n; i++)cin >> a[i];
    for(int i=0; i<n; i++)cin >> b[i];
    long long ans=0;
    for(int i=0; i<=n; i++){
        if(i!=0){
            if(a[i]<=b[i-1]){
                ans+=a[i];
                a[i]=0;
            }
            else {
                ans+=b[i-1];
                a[i]-=b[i-1];
            }
        }
        if(i==n)break;
        if(a[i]<=b[i]){
            ans+=a[i];
            b[i]-=a[i];
        }
        else{
            ans+=b[i];
            b[i]=0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main implements Runnable { //クラス名はMain1

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 1024 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	/**
	 * for (int i = 0; i < N; i++) {}
	 * System.out.println();
	 * HashMap<Integer, Integer> hm = new HashMap<>();
	 * int[] s = new int[M];
	 * ArrayDeque<Integer> deq = new ArrayDeque<>();
	 *
	 * 文字列のSort
	 * String sorted = S.chars()
						.sorted()
						.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
						.toString();
	 * for (char i = 'a'; i <= 'z'; i++) {}
	 */
	public void run() {
		FastScannerMainA sc = new FastScannerMainA(System.in);

		try {
			String S = sc.nextLine().trim();
			//int[] a = new int[N];
			//long l = sc.nextLong();
			//ArrayList<Integer> arr = new ArrayList<Integer>();
			//for (int i = 0; i < N; i++) {}
			//for (char i = 'a'; i <= 'z'; i++) {}

			boolean s34 = false;
			boolean s56 = false;

			//System.out.println(S.substring(2, 3));
			//System.out.println(S.substring(3, 4));
			if (S.substring(2, 3).equals(S.substring(3, 4))) {
				s34 = true;
			}

			if (S.substring(4, 5).equals(S.substring(5, 6))) {
				s56 = true;
			}

			if (s34 && s56) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

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

	public FastScannerMainA(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: 28884
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define HSORT(V,n) sort(V,V+n)
#define RSORT(V) sort((V).rbegin(), (V).rend())
#define INF 1000000001
#define MININF -INF
using namespace std;
using ll = long long;
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; }

int d[305][305] = {0};
void warshall_floyd(int n) {
  for (int k = 0; k < n; k++){
    for (int i = 0; i < n; i++) {    
      for (int j = 0; j < n; j++) {  
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}
int main(void){
    int n,m,l;
    cin >> n >> m >> l;
    int a,b,c;
    rep(i,305){
        rep(j,305){
            d[i][j] = INF;
        }
    }
    rep(i,m){
        cin >> a >> b >> c;
        if (c <= l){
            d[a-1][b-1] = c;
            d[b-1][a-1] = c;
        }
    }
    warshall_floyd(n);
    rep(i,305)rep(j,305){
        if (i != j && d[i][j] <= l){
            d[i][j] = 1;
        }
    }
    warshall_floyd(n);
    int q,s,t;
    cin >> q;
    rep(i,q){
        cin >> s >> t;
        if (d[s-1][t-1] >= INF) PRINT(-1);
        else PRINT(d[s-1][t-1] - 1);
    }
}


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

int main() {

    int k, a, b; cin >> k >> a >> b;
    bool can = false;
    for (int i = a; i <= b; i++) {
        if (i % k == 0) can = true;
    }
    if (can) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3592
n,k = map(int,input().split())
d = list(map(int,input().split()))

while True:
    a = []
    m = n
    while m > 0:
        a.append(m % 10)
        m = m // 10
    
    j = 0
    for i in range(len(a)):
        if a[i] in d:
            break
        j += 1
        
    if j == len(a):
        print(n)
        exit(0)
    else:
        n += 1

Measured memory_bytes: 9100
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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; }

using ll = long long;
using namespace std;

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll N, M;

int main()
{
  scanf( "%lld%lld", &N, &M );

  if( abs(M-N) > 1 )
  {
    puts("0");

    return 0;
  }

  if( M > N )
    std::swap( M, N );

  combination comb( 100010 );

  mint ans = comb.fact[N]*comb.fact[M]*(abs(M-N)==1 ? 1 : 2);

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

  return 0;
}

Measured memory_bytes: 1792
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
M = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, M + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

a, b = map(int, input().split())
N = (a+b)//3
A = (N -abs(a-b))//2
B = (N +abs(a-b))//2
if (a+b)%3!=0 or A<0 :
    print(0)
else :
    print(cmb(N, A, p))

Measured memory_bytes: 122196
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A,B;
LL S[100002];
LL dp[100002];
LL MOD=1000000007;
//binary index tree
const int MAX_N=100001;
LL bit[MAX_N+1];
//[1,i]の和
LL sum(int i){
    LL s=0;
    while(i>0){
       s=(bit[i]+s+MOD)%MOD;
       i-=(i&-i);
    }
    return s;
}
//i番目の要素にxを挿入
void add(int i,LL x){
     while(i<=N+1){
        bit[i]=(bit[i]+x+MOD)%MOD;
        i+=(i&-i);
     }
}

int main(){
        REP(i,100002){
            dp[i]=0;
        }
        dp[0]=1;
	cin>>N;
	cin>>A>>B;
	if(A>B){
	   LL temp=A;
	   A=B;
	   B=temp;
	}
	S[0]=-1000000000000000001;
	REP(i,N){
	    cin>>S[i+1];
	}
	//A+S[i]>S[i+2]は解なし
	REP(i,N-1){
	    if(A+S[i]>S[i+2]){
	       cout<<0<<endl;
	       return 0;
	    }
	}
	
	int p=0;
	int s0=0;
	add(1,1);
	REP(i,N){
	   //S[i+1]をYに振り分ける時
	   int pp=((upper_bound(S,S+N+1,S[i+1]-B))-S);//S[i+1]-Bを超える最初のS[pp]のppを求める
	   if(0<pp){
	      dp[i+1]=sum(pp)%MOD;
	      add(i+1+1,dp[i+1]);
	   }
	   //S[i+1]をXに振り分ける時
	   //S[i+1]-S[i]<Aなら，S[i]はYに振り分けないといけない．
	   //よって，dp[0]=dp[1]=...=dp[i-1]=0
	   if(S[i+1]-S[i]<A){
	      for(int j=s0;j<=i-1;j++){
	         add(j+1,-dp[j]);
	         dp[j]=0;
	      }
	      s0=i-1;//0にした最後の位置を更新
	   }
	}
	//場合の数を計算
	LL ans=0;
	REP(i,N+1){
	    ans=(ans+dp[i])%MOD;
	}
        cout<<ans<<endl;
	return(0);
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<Pii>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

  int n, k;
  cin >> n >> k;

  int m = n * (n - 1) / 2 - k;
  if (m < n - 1) {
    cout << -1 << endl;
    return 0;
  }

  cout << m << endl;
  rep(i, n) rep2(j, i + 1, n) {
    cout << i + 1 << " " << j + 1 << endl;
    m--;
    if (m == 0) {
      return 0;
    }
  }
}


Measured memory_bytes: 256
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//


int main() {
	int N, M;
	cin >> N >> M;
	
	vector<int> wa(N, 0);
	vector<bool> ac(N, false);
	
	for (int i=0; i<M; ++i) {
		int p;
		string S;
		cin >> p >> S;
		--p;
		if (S == "WA" and !ac[p]) ++wa[p];
		if (S == "AC") ac[p] = true;
	}
	
	int a = 0, b = 0;
	for (int i=0; i<N; ++i) {
		if (ac[i]) {
			++a;
			b += wa[i];
		}
	}
	
	cout << a << " " << b << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 640
#include<stdio.h>

int ar[200005];
int br[200005];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ar[i]);
    br[i] = -1;
  }
  int tot = 0;
  for (int i = n; i >= 1; i--) {
    int cnt = 0;
    for (int j = n / i * i; j >= i; j -= i) {
      if (j > i) {
        cnt = (cnt + br[j]) % 2;
      } else {
        br[i] = cnt ^ ar[i];
        tot += cnt ^ ar[i];
      }
    }
  }
  printf("%d\n", tot);
  for (int i = 1; i <= n; i++) {
    if (br[i]) printf("%d ", i);
  }
  return 0;
}

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

int main(){
    ll d, t, s;
    cin >> d >> t >> s;
    if(d <= s*t)    cout<<"Yes"<<endl;
    else        cout<<"No"<<endl;
    // while(t--){

    // }
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
using namespace std;
const int MAXN = 1e5 + 5;
int n, tot = 0;
LL ai[MAXN], b[MAXN];
void clean() {
}
void solve() {
	clean();
	for (int i = 1; i <= n; i++) cin >> ai[i];
	sort(ai + 1, ai + 1 + n);
	int flag = false;
	for (int i = 1; i <= n; i++) {
		if (ai[i] == ai[i + 1] && !flag) b[++tot] = ai[i], flag = true; else flag = false;
	}
	if (tot < 2) printf("0\n"); else {
		sort(b + 1, b + 1 + tot);
		cout << b[tot] * b[tot - 1] << endl;
	}
}
int main() {
	scanf("%d", &n), solve();
	return 0;
}

Measured memory_bytes: 1408
import math

A, B, H, M = map(int, input().split())

minute = H * 60 + M
theta = 360 / 12 / 60 * minute
phi = 360 / 60 * M

C = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(theta-phi)))

print(C)

Measured memory_bytes: 9372