akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(x) for(int i=0;i<x;i++)
#define reprev(x) for(int i=x-1;i>=0;i--)
#define repdef(x,n) for(int i=x;i<n;i++)
#define Debug(x) cout<<x<<"\n";
#define Debug2(x,y) cout<<x<<" "<<y<<"\n";
#define mod 1000000007
#define MAX 100005
int fast_exp(ll base,ll exp){
	if(exp==1){
		return base%mod;
	}
	if(exp&1){
		int ans=fast_exp(base,exp-1);
		return (base%mod*ans%mod)%mod;
	}else{
		int ans=fast_exp(base,exp/2);
		return (ans%mod*ans%mod)%mod;
	}
}
int fast_exp_itr(ll base,ll exp,ll p){
	ll ans=1;
	base=base%p;
	while(exp>0){
		if(exp&1){
			ans=((ans%p)*(base%p))%p;
		}
		exp>>=1;
		base=((base%p)*(base%p))%p;
	}
	return ans;
}
int euclid_gcd(int a,int b){
	if(b==0){
		return a;
	}
	return euclid_gcd(b,a%b);
}
bool comp(pair<int,pair<int,int>> a,pair<int,pair<int,int>> b){
	if(a.first==b.first){
		return a.second.second<b.second.second;
	}
	return a.first<b.first;
}
int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	string arr[]={"Sunny","Cloudy","Rainy"};
	for(int i=0;i<3;i++){
		if(arr[i]==s){
			cout<<arr[(i+1)%3]<<"\n";
		}
	}
	return 0;
}

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

int main()
{
    //宮殿建設候補の数
    int N;
    cin >> N;
    
    //平均気温を求める基準温度、希望の温度
    int T, A;
    cin >> T >> A;
    
    
    int result = 0;
    int oldPos = 1000000;
    
    //建設候補
    int H[N];
    for (int i = 1; i <= sizeof(H)/sizeof(*H); i++) 
    {
        cin >> H[i];
        
        int sum = (T * 1000 - H[i] * 6) - A * 1000;
        if (sum < 0) {
            sum = abs(sum);
        }
        if (sum < oldPos) {
            oldPos = sum;
            result = i;
        }
        
    }
    //sort(H, H + N);
    //sort(H, H + N, greater<int>());
    
    
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
k=int(input())
line="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
nums=line.split(",")
#print(nums)
print(nums[k-1])

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, K: int, A: "List[int]", B: "List[int]"):
    SA = [0]
    SB = [0]
    for i in range(N):
        SA.append(SA[-1]+A[i])
    for i in range(M):
        SB.append(SB[-1]+B[i])
    acount = 0
    acost = 0
    for i in range(1,len(SA)):
        if SA[i] <= K:
            acount += 1
            acost = SA[i]
        else:
            break
    bcost = 0
    bcount = 0
    for i in range(1,len(SB)):
        if SB[i] + acost <= K:
            bcount += 1
            bcost = SB[i]
        else:
            break
    # print(f"acount{acount},bcount{bcount} acost{acost} bcost{bcost}")
    if acount == N and bcount == M:
        print(acount+bcount)
    else:
        mb = 0
        bi = 0
        for aindex in range(acount,-1,-1):
            acost = SA[aindex]
            while bi < M and acost + SB[bi+1] <=K:
                bi += 1
            # print(f"aindex{aindex} - acost{acost} bi{bi} bcost{SB[bi]}")
            mb = max(mb,aindex+bi)
        print(mb)


    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 64308
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int 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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

vector<mint> fac(2000003, 1);
void calc(int n){
  rep(i, n){
    fac.at(i+1) = fac.at(i) * (i+1);
  }
  return;
}

mint mcom(int r, int c){ // (r+c)!/(r!c!)
  mint a = fac.at(r+c);
  mint b = fac.at(r);
  mint d = fac.at(c);
  mint ans = a / (b * d);
  return ans;
}

mint mpow(mint x, ll y){
  if(y == 0){
    return 1;
  }
  if(y % 2 == 0){
    mint a = mpow(x, y / 2);
    return a * a;
  }
  else{
    mint a = mpow(x, y / 2);
    return a * a * x;
  }
}

int main()
{
    ll K;
    string S;
    cin >> K >> S;
    calc(2000002);
    mint ans = 0;
    rep(i, K+1){
      ans += mcom(i, sz(S)-1) * mpow(25, i) * mpow(26, K-i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 20920
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int a[212345];

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
//    vector<int> a(n);
    rep(i, n) cin >> a[i];
//    sort(a.begin(), a.end());
    sort(a, a+n);
    int ans;
    double half_num = a[n-1] * 1.000 / 2.00;
    double dist = 1e9;
    rep(i, n) {
        if ( abs(half_num - a[i]) < dist ) {
            dist = abs(half_num - a[i]);
            ans = a[i];
        }
    }
    cout << a[n-1] << " " << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


n = int(input())
d = defaultdict(int)
for i in range(n):
    s = input()
    d[s] += 1

for a in ["AC", "WA", "TLE", "RE"]:
    print(f"{a} x {d[a]}")


Measured memory_bytes: 70140
from math import gcd
N, X = map(int, input().split())
L = list(map(lambda x: abs(int(x) - X), input().split()))
L.sort()
if N == 1:
  print(L[0])
elif N == 2:
  print(gcd(L[0], L[1]))
else:
  ans = gcd(L[0], L[1])
  for l in L[2:]:
    ans = gcd(ans, l)
  print(ans)

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

int main() {
    int n, x = 0, maxv = x;string s;
    cin >> n >> s;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'I') x++;
        else if(s[i] == 'D') x--;
        maxv = max(maxv, x);
    }
    cout << maxv << endl;
    return 0;
}

Measured memory_bytes: 256
mod = 10**9 + 7
n, k = map(int,input().split())
cnt = [0]*(k+1)

for i in range(k, 0, -1):
  cnt[i]+=pow(k//i,n,mod)
  for j in range(2, k//i+1):
    cnt[i]-=cnt[i*j]
ans = 0
for i in range(1, k+1):
  ans+=i*(cnt[i])%mod
  ans%=mod
  
print(ans)

Measured memory_bytes: 11308
#include<iostream>
#include<stdio.h>
using namespace std;

int selectionSort(int A[100], int n) {
    int minj = 0, count = 0;
    for (int i = 0; i < n - 1; i++) {
        minj = i;
        for (int j = i; j < n; j++) {
            if(A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            int t = 0;
            t = A[i];
            A[i] = A[minj];
            A[minj] = t;
            count++;
        }
    }
    return count;
}

int main() {
    int A[100];
    int n, count;
    
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    
    count = selectionSort(A, n);
    
    for (int i = 0; i < n; i++) {
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;;
    
    return 0;
}


Measured memory_bytes: 3104
n=int(input())
h=list(map(int, input().split()))
cnt1=0
cnt2=0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt1 += 1
    elif h[i]<h[i+1]:
        cnt2=max(cnt2,cnt1)
        cnt1=0
print(max(cnt2,cnt1))

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
constexpr const ll INF = 1e15;
constexpr const ll MOD = 1000000007;
constexpr ll nx[4] = {1,0,-1,0};
constexpr ll ny[4] = {0,1,0,-1};
typedef pair<ll,ll> P;
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    cins(all(a));
    ll g = a[0]/2;
    rep(i,n){
        g = g*(a[i]/2)/gcd(g,a[i]/2);
        if (g > m){
            PRINT(0);
            return 0;
        }
    }
    rep(i,n){
        if (g%a[i] == 0){
            PRINT(0);
            return 0;
        }
    }
    g = m/g;
    if (g%2) PRINT(g/2+1);
    else PRINT(g/2);
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long M = long.Parse(str[1]);
		long[] X = new long[N];
		long[] Y = new long[N];
		long[] Z = new long[N];
		long[] A1 = new long[N];
		long[] A2 = new long[N];
		long[] A3 = new long[N];
		long[] A4 = new long[N];
		long[] A5 = new long[N];
		long[] A6 = new long[N];
		long[] A7 = new long[N];
		long[] A8 = new long[N];
		for(var i=0;i<N;i++){
			string[] str2 = Console.ReadLine().Split();
			X[i] = long.Parse(str2[0]);
			Y[i] = long.Parse(str2[1]);
			Z[i] = long.Parse(str2[2]);
			A1[i] = X[i]+Y[i]+Z[i];
			A2[i] = X[i]+Y[i]-Z[i];
			A3[i] = X[i]-Y[i]+Z[i];
			A4[i] = X[i]-Y[i]-Z[i];
			A5[i] = -X[i]+Y[i]+Z[i];
			A6[i] = -X[i]+Y[i]-Z[i];
			A7[i] = -X[i]-Y[i]+Z[i];
			A8[i] = -X[i]-Y[i]-Z[i];
		}
		Array.Sort(A1);
		Array.Sort(A2);
		Array.Sort(A3);
		Array.Sort(A4);
		Array.Sort(A5);
		Array.Sort(A6);
		Array.Sort(A7);
		Array.Sort(A8);
		long []count = new long[8];
		for(var i=N-1;i>=N-M;i--){
			count[0] += A1[i];
			count[1] += A2[i];
			count[2] += A3[i];
			count[3] += A4[i];
			count[4] += A5[i];
			count[5] += A6[i];
			count[6] += A7[i];
			count[7] += A8[i];
		}
		long countm = 0;
		for(var i=0;i<8;i++){
			if(countm < count[i]){
				countm = count[i];
			}
		}
		Console.WriteLine(countm);
	}
}

Measured memory_bytes: 11380
// in case of multiple test cases and N=1e5 don't intialize arrays as global except for graph vector-array
// always check whether or not you are doing mod of a negative number
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		int n;
		double d;
		cin >> n >> d;
		int ans = 0;
		rep(i,1,n)
		{
			double x,y;
			cin >> x >> y;
			double f = sqrt(x*x + y*y);
			if(f<=d)
				ans++;
		}
		cout << ans;
	}
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end()
const ll INF=1e18;
const double PI=4*atan(1);

#define SpeedForce                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base,ll exp);
void solve();
ll POW(ll base,ll exp);
ll gcd(ll a,ll b);

ll modInverse(ll n) { 
    return mpow(n, mod-2); 
}
 
ll nCr(ll n, ll r){ 
   if (r==0) 
      return 1; 
    ll fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = (fac[i-1]*i)%mod; 
    return ((fac[n]* modInverse(fac[r]) % mod * 
            modInverse(fac[n-r]) % mod)%mod)%mod; 
}

int32_t main(){
    SpeedForce
    ll i = 0,j = 0;

    int t;
    t=1;
    //cin >> t;
    while (t--){
        cout << fixed << setprecision(11);
        solve();
    }
}



void solve(){
    ll n;
    cin >> n;
    ld a[n],b[n];
    loop(i,0,n) cin >> a[i] >> b[i];

    ld ans=0;
    loop(i,0,n){
        loop(j,i,n){
            ld cur=sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
            ans+=cur;
        }
    }

    ans=(2.0)*ans/n;
    cout << ans << endl;

}

ll POW(ll base,ll exp){
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base);
        base = ((ll)base * base);
        exp >>= 1;
    }
    return result;
}

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll a,b;cin>>a>>b;
  ll ans=a;
  cout<<a*b/gcd(a,b)<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

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

int main()
{
    int n, k;
    long long count{};
    scanf("%d%d", &n, &k);
    for (int b = k + 1; b <= n; b++)
    {
        int quo = n / b, rem = n - b * quo;
        count += (b - k) * quo;
        if (k == 0) count--;
        if (rem >= k) count += rem - k + 1;
    }
    printf("%lld\n", count);

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

char S[100001];

int main(void){
    char c;
    long i, ans = 0;
    
    scanf("%s", S);
    
    c = S[0];
    
    for(i = 1; S[i] != '\0'; i++){
        if(c != S[i]) ans++;
        c = S[i];
    }
    
    printf("%ld\n", ans);
    
    return 0;
}

Measured memory_bytes: 256
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', function(input) {
    lines.push(input);
});

rl.on('close', function() {
    var inputStr = lines[1].split('');
    var map = {};
    inputStr.forEach(function(inputChar) {
        if(!map[inputChar]){
            map[inputChar] = 1;
        } else {
            map[inputChar]++;
        }
    });

    var outputStr = map['R'] > map ['B'] ? 'Yes' : 'No';
    console.log(outputStr);
});


Measured memory_bytes: 21320
#include<iostream>
#include<vector>
#include<cstdlib>
#include<algorithm>
#include<climits>
#include<string>
#include<stack>
#include<queue>

const unsigned long MOD = 1000000007;

typedef long long ll;

using namespace std;

char arr[1001][1001]; // H,W
int DP[1001][1001];

int solve(int H, int W){
	DP[1][1]=1;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			if(i==1&&j==1)
				continue;
			if(arr[i][j] =='.')
				DP[i][j] = ( DP[i-1][j] +DP[i][j-1] ) % MOD;
		}
	}
	return DP[H][W];
}

int main(){
	int H,W;
	cin>>H>>W;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin >> arr[i][j];
		}
	}
	cout<<solve(H,W)<<endl;

}

Measured memory_bytes: 5120
m=10**9+7
f=max
r=range
p=print
for _ in r(int(input())):
	x,y=sorted(map(int,input().split()))
	s=-1
	i=j=1
	while j<=x and i+j<=y:
		i,j=j,i+j
		s+=1
	if x==1 or y<3:p(1,x*y%m)
	else:
		a=max(0,(y-j)//i+1)+f(0,(x-j)//i+1)
		i=j=1
		for c in r(s):
			k,l=j,i+j*2
			for _ in r(s-c):k,l=l,k+l
			if x>=k:a+=f(0,(y-l)//k+1)
			if y>=k:a+=f(0,(x-l)//k+1)
			i,j=j,i+j
		p(s+1,a%m)

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

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

    int x, h = 0;
    cin >> x;
    h += (x/500) * 1000;
    x %= 500;
    h += (x/5) * 5;
    cout << h << "\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r;
        r = sc.nextInt();
        if (r<1200){
            System.out.println("ABC");
        } else if (r<2800){
            System.out.println("ARC");
        } else {
            System.out.println("AGC");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;
  cin>>N;
  long ans=LONG_MAX;
  for(long i=1;i*i<=N;i++){
    if(N%i!=0)continue;
    long A=i;
    long B=N/i;
    ans=min(ans,max((long)log10(A)+1,(long)log10(B)+1));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 512
#define KAKUSUKO

#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X, Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 300, MAX_M = MAX_N * (MAX_N - 1) / 2, MAX_Q = MAX_N * (MAX_N - 1);
int N, M, Q;
ll L;
int A[MAX_M], B[MAX_M];
ll C[MAX_M];
int S[MAX_Q], T[MAX_Q];

const int MAX_V = MAX_N;
int V;
ll d[MAX_V][MAX_V];

void warshall_floyd() {
    for (int k = 0; k < V; ++k) {
        for (int i = 0; i < V; ++i) {
            for (int j = 0; j < V; ++j) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}


int main() {

    cin >> N >> M >> L;
    rep(i, M) {
        cin >> A[i] >> B[i] >> C[i];
        --A[i];
        --B[i];
    }
    cin >> Q;
    rep(i, Q) {
        cin >> S[i] >> T[i];
        --S[i];
        --T[i];
    }
    V = N;
    rep(i, N)rep(j, N) d[i][j] = INFLL;
    rep(i, N) d[i][i] = 0;
    for (int i = 0; i < M; ++i) {
        int u = A[i], v = B[i];
        d[u][v] = d[v][u] = C[i];
    }

    warshall_floyd();


    vector<Pii> new_paths;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            if (d[i][j] <= L) new_paths.emplace_back(i, j);
        }
    }


    rep(i, N)rep(j, N) d[i][j] = INFLL;
    rep(i, N) d[i][i] = 0;
    for (int i = 0; i < len(new_paths); ++i) {
        int u = new_paths[i].fi, v = new_paths[i].sc;
        d[u][v] = d[v][u] = 1;
    }

    warshall_floyd();

    for (int i = 0; i < Q; ++i) {
        int u = S[i], v = T[i];
        if (d[u][v] == INFLL) {
            cout << -1 << endl;
        } else {
            cout << d[u][v] - 1 << endl;
        }
    }

    return 0;
}












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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  while (K--) {
    if (A >= B) B *= 2;
    else C *= 2;
  }
  if (A < B && B < C) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3632
def solve(Mi,i):
	if Mi == 0: return True
	if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
		r1 = solve(Mi-A[i],i+1)
		if r1: return r1
		r2 = solve(Mi,i+1)
		if r2: return r2
n = input()
A = map(int,raw_input().split())
q = input()
M = map(int,raw_input().split())
for Mi in M:
	print "yes" if solve(Mi,0) else "no"

Measured memory_bytes: 4228
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	X, Y, A, B, C := ReadInt(), ReadInt(), ReadInt(), ReadInt(), ReadInt()
	p := ReadInts(A)
	q := ReadInts(B)
	r := ReadInts(C)

	sort.Sort(sort.Reverse(sort.IntSlice(p)))
	sort.Sort(sort.Reverse(sort.IntSlice(q)))
	sort.Sort(sort.Reverse(sort.IntSlice(r)))
	s := make([]int, 0)
	s = append(s, p[:Min(X, A)]...)
	s = append(s, q[:Min(Y, B)]...)
	s = append(s, r...)
	sort.Sort(sort.Reverse(sort.IntSlice(s)))
	sum := 0
	for i := 0; i < X+Y; i++ {
		sum += s[i]
	}
	fmt.Println(sum)
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 11808
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vv vector<ll>
#define pp pair<ll,ll>
#define ff first
#define ss second
#define vp vector<pp>
#define ld long double
#define pb push_back
#define mp make_pair
const ll mod=7+1e9;
ll power(ll a,ll n)
{
	ll ans=1;
	a=a%mod;
	while(n>0)
	{
		if(n&1)
		{
			ans=(ans*a)%mod;
		}
		n=n>>1;
		a=(a*a)%mod;
	}
	return ans;
}
int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(a>=13)
    {
    	cout<<b;
	}
	else if(a<13 && a>=6)
	{
		cout<<b/2;
	}
	else
	{
		cout<<"0";
	}
return 0;
}

Measured memory_bytes: 256
import java.io.IOException
import java.lang.NumberFormatException
import java.lang.StringBuilder
import kotlin.math.max
import kotlin.math.pow

object AMain{
    fun solve(){
        val h = nextInt()
        val w = nextInt()
        val m = nextInt()

        val numh = IntArray(h)
        val numw = IntArray(w)
        val map = HashMap<Pair<Int, Int>, Int>()

        for(i in 1..m){
            val mh = nextInt() - 1
            val mw = nextInt() - 1
            numh[mh]++
            numw[mw]++
            map[mh to mw] = 1
        }

        val maxh = numh.max()!!
        val maxw = numw.max()!!

        val listh = ArrayList<Int>()
        val listw = ArrayList<Int>()
        for (i in 0 until h){
            if(numh[i] == maxh) listh.add(i)
        }
        for (i in 0 until w){
            if(numw[i] == maxw) listw.add(i)
        }

        var ans = maxh + maxw - 1
        for(i in 0 until listh.size){
            for(j in 0 until listw.size){
                if(!map.containsKey(listh[i] to listw[j])){
                    ans = maxh + maxw
                    break;
                }
            }
        }

        println(ans)
    }





    // Scanner based on uwi-san's Java code
    val stream = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0

    fun hasNextByte(): Boolean{
        if(ptr < buflen){
            return true
        }else{
            ptr = 0
            try{
                buflen = stream.read(buffer)
            }catch (e: IOException){
                e.printStackTrace()
            }
            if(buflen <= 0){
                return false
            }
        }
        return true
    }

    fun readByte() =
        if(hasNextByte()) buffer[ptr++]
        else -1

    fun isPrintableChar(c: Byte) = c in 33..126

    fun hasNext(): Boolean{
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++
        return hasNextByte()
    }

    fun next(): String{
        if(!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while(isPrintableChar(b)){
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun nextLong(): Long{
        if(!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if(b == '-'.toByte()){
            minus = true
            b = readByte()
        }
        if(b !in '0'.toByte()..'9'.toByte())
            throw NumberFormatException()
        while(true){
            if(b in '0'.toByte()..'9'.toByte()){
                n *= 10
                n += b - '0'.toByte()
            }else if(!isPrintableChar(b)){
                return if(minus) -n else n
            }else{
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextInt(): Int{
        val n1 = nextLong()
        if(n1 !in Int.MIN_VALUE..Int.MAX_VALUE)
            throw NumberFormatException()
        return n1.toInt()
    }

    fun NextDouble() = next().toDouble()
}

fun main(){
    AMain.solve()
}



Measured memory_bytes: 101172
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <vector>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll nmax=50;


int main(){
    ll a,b,c;
    cin>>a>>b;
    if(a==2||b==2)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>

#pragma warning(disable : 4996)

#define mod 100000

using namespace std;

int H, W, dp[2][1 << 19][2][2], bits[10946], maxbits;

string M[20];

void rec(int pos, int bit)
{
	bits[maxbits++] = bit;

	for (int i = pos + 2; i < W - 1; i++)
	{
		rec(i, bit + (1 << i));
	}
}

int main()
{
	scanf("%d", &H);
	scanf("%d", &W);

	for (int i = 0; i < H; i++) cin >> M[i];

	if (M[0][0] == 'J' || M[0][0] == '?') dp[0][0][0][0] += 1;
	if (M[0][0] == 'O' || M[0][0] == '?') dp[0][0][1][0] += 1;
	if (M[0][0] == 'I' || M[0][0] == '?') dp[0][0][1][0] += 1;

	maxbits = 1; bits[0] = 0;

	for (int i = 0; i < W - 1; i++)
	{
		rec(i, 1 << i);
	}

	for (int i = 0; i < H * W - 1; i++)
	{
		for (int j = 0; j < maxbits; j++)
		{
			dp[(i ^ 1) & 1][bits[j]][0][0] = 0;
			dp[(i ^ 1) & 1][bits[j]][0][1] = 0;
			dp[(i ^ 1) & 1][bits[j]][1][0] = 0;
			dp[(i ^ 1) & 1][bits[j]][1][1] = 0;
		}

		for (int j = 0; j < maxbits; j++)
		{
			char c = M[(i + 1) / W][(i + 1) % W];

			int nxt = (bits[j] << 1) % (1 << (W - 1));

			int sum0 = (dp[i & 1][bits[j]][0][0] + dp[i & 1][bits[j]][1][0]) % mod;
			int sum1 = (dp[i & 1][bits[j]][0][1] + dp[i & 1][bits[j]][1][1]) % mod;

			if (c == 'J' || c == '?')
			{
				dp[(i ^ 1) & 1][nxt][0][0] += sum0;
				dp[(i ^ 1) & 1][nxt][0][1] += sum1;
			}

			if (c == 'O' || c == '?')
			{
				if ((M[i / W][i % W] == 'J' || M[i / W][i % W] == '?') && i % W != W - 1)
				{
					dp[(i ^ 1) & 1][nxt + 1][1][0] += dp[i & 1][bits[j]][0][0];
					dp[(i ^ 1) & 1][nxt + 1][1][1] += dp[i & 1][bits[j]][0][1];

					dp[(i ^ 1) & 1][nxt + 1][1][0] %= mod;
					dp[(i ^ 1) & 1][nxt + 1][1][1] %= mod;

					dp[(i ^ 1) & 1][nxt][1][0] += (sum0 - dp[i & 1][bits[j]][0][0] + mod);
					dp[(i ^ 1) & 1][nxt][1][1] += (sum1 - dp[i & 1][bits[j]][0][1] + mod);
				}
				else
				{
					dp[(i ^ 1) & 1][nxt][1][0] += sum0;
					dp[(i ^ 1) & 1][nxt][1][1] += sum1;
				}
			}

			if (c == 'I' || c == '?')
			{
				if (bits[j] & (1 << (W - 2)))
				{
					dp[(i ^ 1) & 1][nxt][1][1] += sum0;
				}
				else
				{
					dp[(i ^ 1) & 1][nxt][1][0] += sum0;
				}

				dp[(i ^ 1) & 1][nxt][1][1] += sum1;
			}

			dp[(i ^ 1) & 1][nxt][1][0] %= mod;
			dp[(i ^ 1) & 1][nxt][1][1] %= mod;
		}
	}

	int ret = 0;

	for (int i = 0; i < maxbits; i++)
	{
		ret += dp[(H * W - 1) % 2][bits[i]][0][1];
		ret += dp[(H * W - 1) % 2][bits[i]][1][1];

		ret %= mod;
	}

	printf("%d\n", ret);

	return 0;
}

Measured memory_bytes: 5772
#include<bits/stdc++.h>
using namespace std;
const long long  mod = 1e9+7;
map<long long ,long long>dp;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
long long Dp(long long x)
{
    if(dp[x])return dp[x];
    else
    {
        return dp[x] = ((Dp(x/2)+Dp((x-1)/2)+Dp((x-2)/2)) )%mod;
    }
}
int main()
{
    dp[0] = 1;
    dp[1] = 2;
    long long n;
    cin>>n;
    cout<<Dp(n);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}







vector<int> color;
using Edge = P;
using Graph = vector<vector<Edge>>;
int N;
Graph G;

void dfs(int v, int cur){
  color[v] = cur;
  for(auto e : G[v]){
    if(color[e.first] != -1) continue;
    if(e.second & 1) dfs(e.first, 1-cur);
    else dfs(e.first, cur);
  }
}

int main(){
  cin >> N;
  G.assign(N,vector<Edge>());
  rep(i,N-1){
    int u,v,w;
    cin >> u >> v >> w;
    u--,v--;
    G[u].push_back(Edge(v,w));
    G[v].push_back(Edge(u,w));
  }
  color.assign(N,-1);
  dfs(0,1);
  for(auto v : color) cout << v << endl;
  
}


Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <cstdio>
int main() {
    std::string s;
    std::string ans = "TBD";
    std::cin >> s;
    if ( std::stoi( s.substr(0, 4) ) < 2019 ) ans = "Heisei";
    else {
        if ( std::stoi( s.substr(5, 2) ) < 5 ) ans = "Heisei";
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);

    if (a == 1 && b == 1)
    {
        printf("1");
        return 0;
    }
    if (a == 1)
    {
        printf("%d", b - 2);
        return 0;
    }
    if (b == 1)
    {
        printf("%d", a - 2);
        return 0;
    }

    printf("%lld", (long long int)(a - 2) * (b - 2));
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <inttypes.h>

uint64_t gcd(uint64_t a, uint64_t b) {
	while (b > 0) {
		uint64_t r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main(void) {
	uint64_t A, B;
	if (scanf("%" SCNu64 "%" SCNu64, &A, &B) != 2) return 1;
	printf("%" PRIu64 "\n", A / gcd(A, B) * B);
	return 0;
}


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

using namespace std;
const int N = 2e5 + 1;
long long k;
int n,a[N];
bool avail[N];
vector <int> V;
int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    V.push_back(0);
    int start = 1; bool run = false;
    while (avail[a[start]] == false){
        start = a[start];
        avail[start] = true;
        V.push_back(start);
    }
    V.push_back(a[start]);
    //for (int i = 1; i < V.size(); i++) cout << V[i] << " "; cout << "\n";
    int d , c = V.size() - 2;
    for (int i = 1; i < V.size() - 1; i++)
        if (a[start] == V[i]) d = i;
    //cout << d << " " << c << "\n";
    if (k < d) cout << V[k];
    else{
        k = k - d + 1;
        k = k % (c - d + 1);
        if (k == 0) cout << V[c];
        else cout << V[d + k - 1];
    }
    return 0;
}


Measured memory_bytes: 5180
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int x, y;
  while (scanf("%d %d", &x, &y) != EOF)
  {
    bool can = true;
    int b = (y - 2*x) / 2;
    if (((y - 2*x) & 1) || b < 0) can = false;
    if (x - b < 0) can = false;
    printf("%s\n", can ? "Yes" : "No");
  }
  return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n;
        int m;
        int x;

        n = sc.nextInt();
        m = sc.nextInt();
        x = sc.nextInt();
        Book[] books = new Book[n];
        int[] skill = new int[m];

        for (int i = 0; i < n; i++) {
            int cost = sc.nextInt();

            for (int j = 0; j < m; j++) {
                skill[j] = sc.nextInt();
            }
            books[i] = new Book(cost, skill);
        }
        
        System.out.println(solve(books, m, x));
    }
    
    /**
     * 全てのアルゴリズムスキルがx以上となるような最適な本の選択を行った場合の最小金額を返します。
     * @param books 本の種類
     * @param x 目標値
     * @return 全てのアルゴリズムが目標値以上となるような最低金額     
     */
    private static int solve(Book[] books, int m, int x) {
        int bit = books.length;
        int max = 1 << (bit + 1);
        int[] bitSet = {
            1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4056
        };

        int minCost = 1 << 30;
        for (int selectBit = 1; selectBit < max; selectBit++) {
            int[] skill = new int[m];
            int cost = 0;

            for (int i = 0; i < bit; i++) {
                if ((selectBit & bitSet[i]) != 0) {
                    cost += books[i].price;
                    for (int s = 0; s < m; s++) {
                        skill[s] += books[i].skill[s];
                    }
                }
            }
            
            boolean ok = true;
            for (int s = 0; s < m; s++) {
                if (skill[s] < x) {
                    ok = false;
                    break;
                }
            }
            
            if (ok && cost < minCost ) {
                minCost = cost;
            }
        }
        
        return minCost == (1 << 30) ? -1 : minCost;
    }
}

/**
 * 本を表すクラス。
 */
class Book {
    /** 値段 */
    int price;
    /** 各スキルアップ値 */
    int[] skill;
    
    public Book(int price, int[] skill) {
        this.price = price;
        this.skill = new int[skill.length];
        
        for (int i = 0; i < skill.length; i++) {
            this.skill[i] = skill[i];
        }
    }
}

Measured memory_bytes: 28688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll long long
//#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>


const int 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;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
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,a,b;
mint c(int n,int k){
  mint res=1;

  for(int i=1;i<=k;i++)
    res/=i;

  for(int i=0;i<k;i++)
    res*=n-i;

    return res;
}
int main(){
  cin>>n>>a>>b;
  mint ans=2;
  ans=ans.pow(n)-1;
  cout<<(ans-c(n,a)-c(n,b)).x<<endl;
  return 0;
}


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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define LEN(s)      (string(s)).length()
#define NPOS        string::npos
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)     for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<class T>string join(const vector<T>& v,string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(LEN(d));}

template<class T>ostream& operator<<(ostream& s,const vector<T>& v)
{s<<"{";if(SZ(v))s<<join(v,", ");s<<"}";return s;}

template<class T>bool contain(const string& s,const T& v)
{return s.find(v)!=NPOS;}

template<class T,class U>string& replace(string& s,const T& f,const U& t)
{for(auto p=s.find(f);p!=NPOS;p=s.find(f,p+LEN(t)))s.replace(p,LEN(f),t);}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    string w; cin >> w;
    
    vector<ll> abc(26, 0);
    ll n = LEN(w);
    REP(i, n) REP(j, 26) if (w[i] == j + 'a') abc[j]++;
    
    REP(i, 26) if (abc[i] % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
      String result = "NG";
              for (int i=a; i<=b; i++) {
                if(i % k == 0){
                  result = "OK";
                break;
                }
            }
            System.out.println(result);
    }
}

Measured memory_bytes: 35840
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

ll l,r,d,u ;

bool check(ll x,ll y){
	return l<=x&&x<r&&d<=y&&y<u ;
}

int main(){

	l = 0 ; r = 1 ; d = 0 ; u = 1 ;
	ll x,y ;
	cin >> x >> y ;
	ll cnt = 1 ;
	while(!check(x,y)){
		if(cnt%4==1){
			ll sub = u-d ;
			r += sub ;
		}
		if(cnt%4==2){
			ll sub = r-l ;
			u += sub ;
		}
		if(cnt%4==3){
			ll sub = u-d ;
			l -= sub ;
		}
		if(cnt%4==0){
			ll sub = r-l ;
			d -= sub ;
		}
		cnt++ ;
	}
	if(cnt%3==0) cout << 3 ;
	else cout << cnt%3 ;
	cout << endl ;
}



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

int main() {
    char s[100], p[100], z[300] = "";
    scanf("%s", s);
    scanf("%s", p);
    strcat(z, s);
    strcat(z, s);

    printf("%s\n", strstr(z, p) ? "Yes" : "No");
}

Measured memory_bytes: 1120
import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        aaa(a)
        return
    dividend(a, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    return

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

inline int nextInt() { int d; cin >> d; return d; }

bool isUsed[(int)1e6 + 1];

int getNext(int n) {
  int ret = -1;
  for (int d = 10; d < n; d *= 10) {
    int n1 = n % d;
    int n2 = (n - n1) / d;
    ret = max(ret, n1 * n2);
  }

  return ret;
}

int solve(int n) {
  int step = 0;
  memset(isUsed, false, (int)1e6 + 1);
  while (true) {
    if (n < 10) {
      return step;
    }
    if (isUsed[n]) {
      return -1;
    }
    isUsed[n] = true;
    n = getNext(n);
    step++;
  }
  return 0;
}

int main() {
  int Q = nextInt();

  for (int i = 0; i < Q; i++) {
    int R = nextInt();
    int ans = solve(R);
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 2148
#include<stdio.h>

int gcd(int a, int b){
    int tmp = a%b;
    if(tmp==0) return b;
    
    a=b;
    b=tmp;
    
    return gcd(a, b);
}

int main(void){
    int N;
    int a[200000];
    
    scanf("%d", &N);
    for(int i=0; i<N; i++) scanf("%d", &a[i]);
    
    int i;
    int j=0;
    for(i=1; ; i++){
        for(; j<N; j++){
            if(a[j]==i) break;
        }
        if(j==N){
            i--;
            break;
        }
        j++;
    }
    
    if(i==0) printf("-1");
    else     printf("%d", N-i);
}

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();

        int minus = 0;
        for (int i = a; i <= b; i++) {
            if (i == 0) {
                minus = -1;
                break;
            }
            if (i < 0) {
                minus++;
            }
        }

        if (minus < 0) {
            out.printf("Zero\n");
        } else if (minus % 2 == 0) {
            out.printf("Positive\n");
        } else {
            out.printf("Negative\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<cstdio>
#include<stack>
#include<algorithm>
using namespace std;
int main(void){
    int j=0;
	int k;
	int b[1000]={0};
	stack<int> a;
	
	while(cin>>k){



        if(k==0){
            cout<<a.top()<<endl;

            a.pop();
        }
        else a.push(k);
	}
	/*for(int i=0;i<j;i++){
        cout<<b[i]<<endl;
	}
*/

	return 0;
}

Measured memory_bytes: 1200