akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll a,b;
  cin >> a >> b;
  cout << max(a-2*b,0ll) << endl;
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3628
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;

vector<int> pos[30];

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
        pos[s[i] - 'a'].push_back(i);
    string ss;
    for (int i = 0; i < s.size(); i++)
        if (s[i] != 'x')
            ss += s[i];
    string rev = ss;
    reverse(rev.begin(), rev.end());
    if (rev != ss){
        cout << -1;
        return 0;
    }
    int ans = 0;
    int posl = 0, posr = s.size() - 1;
    while (posl <= posr){
        if (s[posl] == s[posr]){
            posl++;
            posr--;
        }else{
            ans++;
            if (s[posl] != 'x')
                posr--;
            else
                posl++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 1104
class Unionfind():
    def __init__(self, progsize):
        self.table = [-1 for _ in range(progsize)]
        self.size = [1 for _ in range(progsize)]
    def find(self, x):
        while(self.table[x] >= 0):
            x = self.table[x]
        return x
    def union(self, x, y):
        xl = self.find(x)
        yl = self.find(y)
        if xl != yl:
            if self.table[xl] <= self.table[yl]:
                self.table[yl] = xl
                self.table[xl] -= 1
                self.size[xl] += self.size[yl]
            else:
                self.table[xl] = yl
                self.table[yl] -= 1
                self.size[yl] += self.size[xl]

n, m = map(int, input().split())
bridge = [tuple(map(int, input().split())) for _ in range(m)]
bridge.reverse()
uf = Unionfind(n)
cur = n * (n-1) // 2
ans = [cur]
for a, b in bridge:
    ap = uf.find(a-1)
    bp = uf.find(b-1)
    if ap != bp:
        cur -= uf.size[ap] * uf.size[bp]
    uf.union(a-1, b-1)
    ans.append(cur)
for a in reversed(ans[0:m]):
    print(a)

Measured memory_bytes: 25604
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
 
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer n = scanner.nextInt();
        List<Integer> heightList = new ArrayList<Integer>();
        for(int k = 0; k <n;k++) {
          heightList.add(scanner.nextInt());
        }
       
        for (int j = n-1; 0 < j; j--) {
          Integer right = Integer.valueOf(heightList.get(j));
          Integer left = Integer.valueOf(heightList.get(j-1));
          int diff = right - left;
          if(diff <= -2) {
            System.out.println("No");
            return;
          } else if(diff == -1) {
            heightList.set(j-1, right);
          }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 63084
#include<iostream>
using namespace std;
int m,f,r,sum;


int main() {
while(1){
  cin>>m>>f>>r;
  if(m==-1 && f==-1 && r==-1) break;
  sum=m+f;
  if(m==-1 || f==-1 || sum<30) cout<<'F'<<endl;

  else if (sum>=80) cout<<'A'<<endl;
  else if (sum>=65 && sum<80) cout<<'B'<<endl;
  else if (sum>=50 && sum<65) cout<<'C'<<endl;
  
  else if (sum>=30 && sum<50 && r>=50) cout<<'C'<<endl;
  else if  (sum>=30 && sum<50) cout<<'D'<<endl; 
}
  return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    // オリジナルの回答
    long h, w;
    cin >> h >> w;
    long num = 0;

    // 縦か横が1マスのみの場合は1現在の位置から動けないので1マス固定
    if (h == 1 || w == 1) {
        num = 1;
    }
    else {
        // 奇数行のとき
        for (int i = 1; i <= h; i += 2) {
            num += (long)ceil((double)w / 2);
        }

        //偶数行のとき
        for (int i = 2; i <= h; i += 2) {
            num += w / 2;
        }
    }

    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

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

int main() {
  int N, M;
  ll p, y;
  cin >> N >> M;
  vector<pair<ll, pair<int, int> > > c; // number  

  rep(i, M){
    cin >> p >> y;
    c.push_back(make_pair(y, make_pair(i, p)));
  }
  sort(c.begin(), c.end());

  vector<pair<ll, pair<int, int> > > d;
  vector<int> n(N, 0);
  rep(i, M){
    n.at(c[i].second.second-1)++;
    d.push_back(make_pair(c[i].second.first, make_pair(c[i].second.second, n[c[i].second.second-1])));
  }
  sort(d.begin(), d.end());

  rep(i, M){
    printf("%06d%06d\n", d[i].second.first, d[i].second.second);
  }

}


Measured memory_bytes: 5872
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    int N;
    cin >> N;

    vector<int> v(N);
    REP(i, N) cin >> v[i];

    sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());

    cout << v.size() << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt();
        HashMap<Integer, Integer> m1 = new HashMap<>();
        long ans = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int cnt = m1.getOrDefault(i - a, 0);
            ans += cnt;
            int c = m1.getOrDefault(a + i, 0);
            m1.put(a + i, c + 1);
        }

        out.println(ans);

        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 70304
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
lint mod=998244353;
int main()
{
    int flag1=0,flag2=0,flag3=0;
   string s;
   cin>>s;
   string temp=s;
    reverse(temp.begin(),temp.end());
    if(temp==s) flag1=1;
  int len=s.size();
   string str1="",str2="";
   for(int i=0;i<(len-1)/2;i++)
    {
       str1+=s[i];
       str2+=s[i];
    }
    reverse(str1.begin(),str1.end());
    if(str1==str2) flag2=1;
    str1="";str2="";
    for(int i=(len+3)/2-1;i<len;i++)
    {
        str1+=s[i];
        str2+=s[i];
    }
    reverse(str1.begin(),str1.end());
    if(str1==str2) flag3=1;
    if(flag1*flag2*flag3==1) cout<<"Yes";
    else cout<<"No";
    



}


Measured memory_bytes: 256
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    ll x;
    cin>>x;
    ll ans = 1;
    set <ll> chk;
    ll curr = (7 % x);
    while (true) {
        if (curr == 0) {
            cout<<ans<<"\n";
            return;
        }
        curr = ((curr * 10) % x + 7) % x;
        if (chk.find(curr) != chk.end()) {
            break;
        } else {
            chk.in(curr);
        }
        ++ans;
    }
    cout<<"-1\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    //cin>>t;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


Measured memory_bytes: 50476
#include <iostream>
using namespace std;
int main(void){
    
    int r, g, b;
    cin >> r >> g >> b;
    
    int num = (r * 100) + (g * 10) + b;
    
    if(num % 4 == 0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    
}


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

#define mp make_pair
#define pb push_back
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) repm(i, 1, n)
#define mod 1000000000+7

int main(){
    int n,k; cin >> n >> k;
    int ans = 0;

    int t = 1;
    repn(i, n+1){
        if(t*2 < t+k){
            t *= 2;
        }else{
            t += k;
        }
    }
    cout << t << endl;

}


Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_kin=list(set(a))
if len(a_kin)==1 and a_kin[0]==0:
  print("Yes")
elif N%3!=0:
  print("No")
elif len(a_kin)==2 and a_kin[0]==0 and a[int(N/3)-1]==0 and a[int(N/3)]!=0:
  print("Yes")
elif len(a_kin)==3:
  if a_kin[0]^a_kin[1]^a_kin[2]==0:
    if a[0]==a[int(N/3)-1] and a[int(N/3)-1]!=a[int(N/3)] and a[int(N/3)]==a[int(2*N/3)-1] and a[int(2*N/3)-1]!=a[int(2*N/3)]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Measured memory_bytes: 14212
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
typedef long long ll;

ll N;
vector<ll> yakusuu;

int main() {
	cin >> N;
	for (ll i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			yakusuu.push_back(i);
			yakusuu.push_back(N / i);
		}
	}
	//N=am+bとして、条件を満たすのはa=b
	//つまり、N = a(m + 1)となる。  ただし、a < m

	ll ans = 0;
	
	for (int i = 0; i < yakusuu.size(); i += 2) {
		if(yakusuu[i] < yakusuu[i + 1] - 1)
		ans += yakusuu[i + 1] - 1;
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

#include<math.h>

#include<stdio.h>

#include<string.h>

#include<vector>

#include<algorithm>
#include<utility>



typedef long long ll;

#define rep0(i, n) for(int i=0; i < (int)(n); i++)

#define rep1(i, n) for(int i=1; i < (int)(n); i++)

#define all(x) (x).begin(),(x).end()

#define fill(x,y) memset(x,y,sizeof(x))

#define debug1(i) cout << i << '\n'

#define debug2(i,j) cout << i << j << '\n'



using namespace std;



int main() {
	char s[10];
	cin >> s;
	rep0(i, 3)if (s[i] == s[i + 1]) {
		cout << "Bad";
		return 0;
	}

	cout << "Good";


}

Measured memory_bytes: 256
a, b, k = map(int, input().split())

if a >= k:
	print(str(a - k) + ' ' + str(b))
elif a + b >= k > a:
	print(str(0) + ' ' + str((a + b) - k))
elif k > a + b:
	print(str(0) + ' ' + str(0))

Measured memory_bytes: 3060
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        
        if(n==22) System.out.println("Christmas Eve Eve Eve");
        if(n==25) System.out.println("Christmas");
        if(n==24) System.out.println("Christmas Eve");
        if(n==23) System.out.println("Christmas Eve Eve");
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 100005
#define P 998244353
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, m, a[MAXN], c[MAXN], vis[MAXN];
LL k, x[MAXN], y[MAXN], z[MAXN];

vector<int> vec;

int main()
{
    scanf("%d", &n);
    for(rint i=1; i<=n; ++i)
    {
        scanf("%lld", &x[i]);
        y[i]=x[i]-x[i-1];
        c[i]=i;
    }
    scanf("%d%lld", &m, &k);
    for(rint i=1; i<=m; ++i)
    {
        scanf("%d", &a[i]);
        swap(c[a[i]], c[a[i]+1]);
    }
    for(rint i=1; i<=n; ++i)
        if(!vis[i])
        {
            vec.clear();
            vec.push_back(i);
            vis[i]=1;
            for(rint j=c[i]; j!=i; j=c[j])
            {
                vis[j]=1;
                vec.push_back(j);
            }
            for(rint j=0; j<vec.size(); ++j)
                z[vec[j]]=y[vec[(k+j)%vec.size()]];
        }
    for(rint i=1; i<=n; ++i)
    {
        x[i]=x[i-1]+z[i];
        printf("%lld\n", x[i]);
    }
    return 0;
}

Measured memory_bytes: 5240
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    S = input()

    ary = []
    count = 0
    ans = 0

    index = 0
    while index < len(S):
        count = 1
        while index < len(S)-1 and S[index] == S[index+1]:
            count += 1
            index += 1
        ary.append(count)

        index += 1
    # print(ary)

    for i in range(len(ary)):
        if i != len(ary)-1:
            ans += ary[i]-ary[i]//3
            ary[i+1] -= 1 if ary[i] % 3 == 2 else 0
        else:
            ans += ary[i]-ary[i]//3 if ary[i] % 3 != 2 else ary[i]-ary[i]//3-1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 50144
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<MOD>;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M; cin >> N >> M;
    set<int> dic;
    rep(i,M) {
        int a; cin >> a;
        dic.emplace(a);
    }

    vector<mint> dp(N+1);
    dp[0] = 1;
    for (int i = 1; i <= N; ++i) {
        if (dic.count(i)) continue;
        if (i==1) dp[i] = dp[0];
        else {
            dp[i] = dp[i-1] + dp[i-2];
        }
    }

    cout << dp[N].a << ln;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>0){
		cout<<"Positive";
		return 0;
	}
	if(a<=0&&b>=0){
		cout<<"Zero";
		return 0;
	}
	if((min(b,-1)-a)%2==1){
		cout<<"Positive";
		return 0;
	}
	cout<<"Negative";
} 

Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#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 ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 998244353;
const ll maxn = 1000005;
const ll mm = 1e+18;
void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int x=1;
    while(1){
        if(x&1){
            c-=b;
            if(c<=0) break;
        }
        else{
            a-=d;
            if(a<=0) break;
        }
        x++;
    }
    if(x&1) cout<<"Yes";
    else cout<<"No";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
	//freopen("sp.txt","r",stdin);
    //srand(time(0));
    //cin>>t;
    for(int _i=1;_i<=t;_i++){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


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

using namespace std;
using ll = long long;

void solve(){
	int h,n;
	cin >> h >> n;
	for(int i=0,x;i<n;++i){
		cin >> x;
		h-=x;
	}
	cout << (h<=0 ? "Yes" : "No") << '\n';
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--){ 
		solve();
	}
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define F(a,b,c,d) for (register int a=b;a<=c;a+=d)
#define FD(a,b,c,d) for (register int a=b;a>=c;a-=d)
using namespace std;
int main(){
	long long  n,m,c;
	cin>>n>>m;
	long long d=pow(100,n)*m;
	if (m==100) d+=pow(100,n);
	cout<<d<<endl; 
	return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())

mod = 10**9 + 7

if (x + y) % 3 != 0:
    print(0)
    exit()

a = (2*x-y)//3
b = (-x+2*y)//3

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, a+b+10):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod



print(nck(a+b, a))


Measured memory_bytes: 118764
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int main() {
    vector<int> N(4);
    for (int i=0;i<4;i++) cin >> N[i];
    sort(N.begin(),N.end());
    string ans = "NO";
    if (N[0]==1&&N[1]==4&&N[2]==7&&N[3]==9) ans = "YES";
    cout << ans << endl;
}


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

int main(){
    int n;
    cin>>n;
    ll sum=0;
    for(ll i=1;i<=n;++i){
        ll m = n/i;
        sum = sum + i*((m*(m+1))/2);
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(){
    
    vector<int> x(10);
    x[0] = 0;
    x[1] = 1;
    for(int i = 0; i < 9; i++){
        x[i+1] = x[i] * 2 + 1;
    }
    int y = x[9] * 2 + 1;

    while(true){
        int n;
        cin >> n;
        if(n == 0)
            break;
        

        vector<int> r(y, -1);
        vector<int> t(10, 0);
        int ans;
        int anst;
        
        for(int i = 0; i < 10; i++)
            r[ x[i]+x[i] ] = 0;
        
        for(int i = 0; i < n; i++){
            int a, b, c;
            cin >> a >> b >> c;
            r[ x[a]+x[b] ] = c;
        }
        
        for(int i = 0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                if( r[x[i]+x[j]] == -1 )
                    continue;
                for(int k = 0; k < 10; k++){
                    if( r[x[i]+x[k]] == -1 )
                        continue;
                    if( r[x[j]+x[k]] == -1 || r[x[j]+x[k]] > r[x[i]+x[j]] + r[x[i]+x[k]] )
                        r[x[j]+x[k]] = r[x[i]+x[j]] + r[x[i]+x[k]];
                }
            }
        }
        
        for(int i = 0; i < 10; i++){
            
            for(int j = 0; j < 10; j++){
                if( r[x[i]+x[j]] == -1 ){
                    continue;
                }
                else{
                    t[i] += r[x[i]+x[j]];
                }
            }
            
            if( i == 0 ){
                ans = i;
                anst = t[i];
            }
            else if( t[i] < anst && t[i] > 0 ){
                ans = i;
                anst = t[i];
            }
        }
        
        cout << ans << " " << anst <<endl;
        
    }
}

Measured memory_bytes: 2996
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] rate = new int[13];
		int count1 = 0,count2 = 0;
		for( int i=0; i<N; i++ ){
			rate[sc.nextInt()/400]++;
		}
		for( int i=0; i<=7; i++ ){
			if( rate[i]>0 ){
				count1++;
			}
		}
		for( int i=8; i<=12; i++ ){
			count2 += rate[i];          
		}
		if( count1==0 ){
			System.out.println(1+" "+count2);
		}else{
			System.out.println(count1+" "+(count1+count2));
		}
	}
}


Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) int(a.size())

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int a,v,b,w,t;

int main() {
	cin>>a>>v>>b>>w>>t;
	if(v<w) cout<<"NO";
	else if(abs(a-b)<=1ll*t*(v-w)) cout<<"YES";
	else cout<<"NO";
	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int f[21][21];
int main(){
  int n;
  while(cin >> n,n){
    memset(f,0,sizeof(f));

    for(int i=0;i<n;i++){
      int x,y;
      cin >> x >> y;
      f[y][x] = 1;
    }

    int x=10,y=10;
    int cnt = 0;

    int m;
    cin >> m;
    for(int i=0;i<m;i++){
      char dir;
      int step;
      cin >> dir >> step;
      while(step--){
        if(dir=='N'){y++;}
        else if(dir=='S'){y--;}
        else if(dir=='E'){x++;}
        else {x--;}

        if(f[y][x]){
          f[y][x] = 0;
          cnt++;
        }
      }
    }
    if(cnt==n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }






  }
}



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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T & ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T & ref, const T value) {
    if (ref < value) ref = value;
}

const ll mod = 1000000007;


int main() {
	ll h, w, k;
	cin >> h >> w >> k;
	vector<vector<ll>> grid(h, vector<ll>(w, 0));
	rep(i, h) {
		string s;
		cin >> s;
		rep(j, w) {
			grid[i][j] = s[j] - '0';
		}
	}

	ll u = 0;
	rep(i, h) {
		rep(j, w) {			
			vector<vector<ll>> current = grid;
			ll score = 0;
			bool update = true;
			vector<unordered_set<int>> del(w);
			del[j].insert(i);
			ll pow2 = 1;
			while (update) {
				update = false;
				rep(x, w) {
					const auto& s = del[x];
					if (s.size()) {
						int target = h - 1;
						for (int y = h - 1; y >= 0; y--) {
							while(s.count(target)) {
								target--;
							}
							if (target < 0) {
								current[y][x] = -1;
							}
							else {
								current[y][x] = current[target][x];
								target--;
							}
						}
					}
				}
				rep(i, w) del[i].clear();
				rep(y, h) {
					int left = 0;
					int right = 0;
					while (left < w && right < w) {
						if (current[y][left] == -1) {
							left++;
							right = left;
							continue;
						}
						while (right < w && current[y][left] == current[y][right]) {
							right++;
						}
						if (right - left >= k) {
							for (int a = left; a < right; a++) {
								score += pow2 * current[y][a];
								del[a].insert(y);
								update = true;
							}
							left = right;
						}
						else {
							left++;
							right = left;
						}
					}
				}
				pow2 *= 2;
			}
			chmax(u, score);
		}
	}
	cout << u << endl;
	return 0;
}



Measured memory_bytes: 3608
import sys
s = input()
t = input()

if s==t:
    print("Yes")
    sys.exit()

alpha = [chr(i) for i in range(97, 97+26)]
checkalpha = []
checks = [0 for i in range(26)]
checkt = [0 for i in range(26)]
for i,a in enumerate(alpha):
    checks[i] = len([i for i, x in enumerate(s) if x == a])
    checkt[i] = len([i for i, x in enumerate(t) if x == a])
checks.sort()
checkt.sort()
if checks == checkt:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 7588
#include<iostream>
#include<vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

bool myless(pair<pair<string, int>, int> l, pair<pair<string, int>, int> r){
    if(l.first.first != r.first.first){
        return l.first.first < r.first.first;
    }else{
        return l.first.second > r.first.second;
    }
}

int main(){
    int n;
    cin >> n;
    vector<pair<pair<string, int >, int > > v;
    for(int i = 0; i < n; i++){
        string s;
        int point;
        cin >> s >> point;
        v.push_back(make_pair(make_pair(s,point), i));
    }
    sort(v.begin(), v.end(), myless);
    for(int i = 0; i < n; i++){
        cout << v[i].second+1 << endl;
    }
    


}

Measured memory_bytes: 3512
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>

using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1000000000+7)

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int> > E;
    vector<int> inedges(N), outedges(N);
    vector<vector<int> > nextnodes(N);
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        E.push_back(make_pair(x-1, y-1));
        inedges[y-1]++;
        outedges[x-1]++;
        nextnodes[x-1].push_back(y-1);
    }
    
    vector<int> dp(N);
    REP(i, N) {
        if (outedges[i] == 0) dp[i] = 1;
    }
    

    auto rec = [&](auto f, int n) mutable -> int {
        if (dp[n] > 0) return dp[n];
        int m = 0;
        REP(i, nextnodes[n].size()) {
            int nn = nextnodes[n][i];
            m = max(m, f(f, nn)+1);
        }
        dp[n] = m;
        return m;
    };
    
    int cnt = 0;
    REP(i, N) {
        if (inedges[i] == 0) {
            cnt = max(cnt, rec(rec, i));
        }
    }
    

    cout << cnt-1 << endl;
}


Measured memory_bytes: 17012
from collections import defaultdict
import sys
input = sys.stdin.readline
N, mod = 10**5+1, 10**9+7
fac = [1, 1] + [None] * N
inv = [0, 1] + [None] * N
facInv = [1, 1] + [None] * N
for i in range(2, N+1):
    fac[i] = i*fac[i-1]%mod
    inv[i] = mod-(inv[mod%i]*(mod//i))%mod
    facInv[i] = facInv[i-1]*inv[i]%mod
def modCom(n, k):
    return 0 if n < k else fac[n] * facInv[k] * facInv[n-k] % mod
n = int(input())
a = list(map(int, input().split()))
dic = defaultdict(int)
for i, x in enumerate(a):
    if dic[x] > 0:
        fi = dic[x]
        si = i+1
        break
    dic[x] = i+1
print(n)
for k in range(2, n+1):
    print((modCom(n+1, k) - modCom(fi+n-si, k-1)) % mod)
print(1)


Measured memory_bytes: 70328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int K;
    cin >> K;
    ll A[K];
    rep(i, K) cin >> A[i];
    ll L = 0, R = INF;
    while(L < R){
        ll N = (L+R+1)/2, res= N;
        rep(i, K){
            res -= res%A[i];
        }
        if(res <= 2) L = N;
        else R = N-1;
    }
    ll l = 0, r = INF;
    while(l < r){
        ll n = (l+r)/2, res = n;
        rep(i, K){
            res -= res%A[i];
        }
        if(res < 2) l = n+1;
        else r = n;
    }
    ll res = l;
    rep(i, K){
        res -= res%A[i];
    }
    if(res != 2) cout << -1 << endl;
    else cout << l << ' ' << L << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#define N 100000
using namespace std;

int A[N];

int partition(int p, int r){
    int x;
    int i;
    x = A[r];
    i = p-1;
    for(int j=0;j < r;j++){
        if(A[j] <= x){
            i++;
            swap(A[j],A[i]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

int main()
{
    int n;
    cin >> n;
    for(int i=0;i < n;i++){
        cin >> A[i];
    }
    int q;
    q = partition(0,n-1);
    for(int i=0;i < n;i++){
        if(i) cout << " ";
        if(i == q) cout << "[";
        cout << A[i];
        if(i == q) cout << "]";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3496
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

int n, a[4];
double dp[301][301][301];

double f(int a, int b, int c)
{
    if (a < 0 || b < 0 || c < 0) return 0;
    if (a + b + c == 0) return 0;
    if (dp[a][b][c] > -1) return dp[a][b][c];
    double s = a + b + c;
    double e = n - s;
    double pa = a / s, pb = b / s, pc = c / s, pw = e / n;
    double ew = pw / (1. - pw) + 1.;
    ew += pa * f(a - 1, b, c);
    ew += pb * f(a + 1, b - 1, c);
    ew += pc * f(a, b + 1, c - 1);
    return dp[a][b][c] = ew;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        a[x]++;
    }
    for (int i = 0; i <= 300; ++i)
        for (int j = 0; j <= 300; ++j)
            for (int k = 0; k <= 300; ++k)
                dp[i][j][k] = -100;

    cout << setprecision(15) << fixed << f(a[1], a[2], a[3]);
}


Measured memory_bytes: 213376
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

const int MAXN=100000;
int par[MAXN];
int rnk[MAXN];

void init(int n){
	REP(i,n){
		par[i] = i;
		rnk[i] = 0;
	}
}
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x==y) return;
	if(rnk[x] < rnk[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rnk[x]==rnk[y]) rnk[x]++;
	}
}
bool same(int x,int y){
	return find(x)==find(y);
}

int main(){
	int n,m,k;
	cin >> n >> m >> k;
	vector<pair<int, int>> fri(m),blo(k);
	REP(i,m){
		cin >> fri[i].first >> fri[i].second;
		fri[i].first--; fri[i].second--;
	}
	REP(i,k){
		cin >> blo[i].first >> blo[i].second;
		blo[i].first--; blo[i].second--;
	}
	
	init(n);
	vector<int> ans(n,0);
	map<int,int> member;
	REP(i,m){
		int a = fri[i].first;
		int b = fri[i].second;
		ans[a]++; ans[b]++;
		unite(a,b);
	}
	REP(i,n){
		member[find(i)]++;
	}
	REP(i,k){
		int a = blo[i].first;
		int b = blo[i].second;
		if(same(a,b)){
			ans[a]++; ans[b]++;
		}
	}
	
	REP(i,n){
		if(i!=0) cout << " ";
		int a = member[find(i)];
		cout << a - ans[i] -1;
	}
	cout << endl;
	
	
	return 0;
}

Measured memory_bytes: 10636
import java.util.*;

public class Main {    
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);                
        
        String S = sc.nextLine();        
        
        String[] array2 = S.split(" ");               
        
        System.out.println((Integer.parseInt(array2[0] + array2[1] + array2[2])%4 == 0)?"YES":"NO");
        
    }                                      
}
        
        

Measured memory_bytes: 23764
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

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

int main(){
    ll k, a, b;
    cin >> k >> a >> b;
    if ( k < a ) {
        cout << k+1LL << endl;
        return 0;
    }
    if ( a >= b ) {
        cout << k+1LL << endl;
        return 0;
    }
    ll ans = a;
    k -= a-1LL;
    if ( b - a == 1 ) {
        cout << ans + k << endl;
        return 0;
    }
    if ( !(k&1) ) {
        cout << ans + (b-a) * (k/2LL) << endl;
        return 0;
    }
    cout << ans + (b-a) * ((k-1)/2LL) + 1LL << endl; 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 	
 	int a, b; cin >> a >> b;
 	if(a<=9 && b <= 9)
 		cout << a*b << '\n';
 	else
 		cout << "-1\n";
 
	return 0;
}

Measured memory_bytes: 256
from collections import deque
def topological_sort(G, Grev, N):
    Q = deque()
    T = [0]*(N+1)
    L = []
    for i in range(1, N+1):
        if len(Grev[i]) == 0:
            Q.append(i)
        T[i] = len(Grev[i])
    while Q:
        u = Q.pop()
        L.append(u)
        for v in G[u]:
            T[v] -= 1
            if T[v] == 0:
                Q.append(v)
    return L

def longest_path(L, G, Grev, N):
    longest = 0
    dist = [0]*(N+1)
    for u in L:
        for v in Grev[u]:
            dist[u] = max(dist[u], dist[v]+1)
            longest = max(longest, dist[u])
    return longest


N, M = [int(s) for s in input().split(" ")]
G = dict()
Grev = dict()
for i in range(1, N+1):
    G[i] = []
    Grev[i] = []
for _ in range(M):
    u, v = [int(s) for s in input().split(" ")]
    G[u].append(v)
    Grev[v].append(u)
L = topological_sort(G, Grev, N)
result = longest_path(L, G, Grev, N)
print("{}".format(result))


Measured memory_bytes: 52676
#include<stdio.h>
int main(void)
{
	double r,l,s;
	while(scanf("%lf",&r)!=EOF) {
		l=r*2.0*3.141592653589793238462643383279;
		s=r*r*3.141592653589793238462643383279;
		printf("%lf %lf\n",s,l);
	}
	return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdlib.h>
#include <numeric>
#include <cmath>
#include <iomanip>
#define mod 1000000007
typedef unsigned long long int ll;
using namespace std;





int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin>>n>>s;
    if(n<3200)
    cout<<"red\n";
    else
    {
        cout<<s<<"\n";
    }
    

    return 0;
    
}


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

#define rep(i, a, n) for (int i = a; i < n; i++)
#define asc(v) sort(v.begin(), v.end())
#define desc(v) sort(v.begin(), v.end(), greater<int>())

using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << min(C, B / A);
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct Job {
	string name;
	int time;
	Job(){}
	Job(string name,int time):name(name),time(time){}
};
istream &operator >> (istream &is, Job &p) {
	is >> p.name >> p.time;
	return is;
}
ostream &operator<<(ostream &os, Job &p) {
	os << p.name << " " << p.time;
	return os;
}
template<typename T>
struct Queue {
	int l, r, len = 100010;
	T a[100010];
	Queue() :l(0), r(0) {}
	bool empty() {
		return l%len == r%len;
	}
	void push(T in) {
		a[r++%len] = in;
	}
	T pop() {
		return a[l++%len];
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Q; cin >> N >> Q;
	static Queue<Job> q;
	rep(i, 0, N) {
		Job j; cin >> j;
		q.push(j);
	}
	int now(0);
	while (!q.empty()) {
		Job j = q.pop();
		int x = min(Q, j.time);
		now += x;
		j.time -= x;
		if (j.time <= 0) {
			cout << j.name << " " << now << endl;
		}
		else q.push(j);
	}
	return 0;
}

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

#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define maxn 100010

using namespace std;

int n, A[maxn], F[maxn];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
    FOR(i, 1, n) cin >> A[i];
    F[1] = 0;
    FOR(i, 2, n) {
        F[i] = F[i-1] + abs(A[i] - A[i-1]);
        if (i-2 > 0) F[i] = min(F[i], F[i-2] + abs(A[i] - A[i-2]));
    }
    cout << F[n];
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

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

    cout << 48 - M << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

int main() {
    ios::sync_with_stdio(false);
    Int n, m;
    cin >> n >> m;
    vector<pair<Int, Int>> p(n);
    for (Int i = 0; i < n; i++) {
        Int a, b;
        cin >> a >> b;
        p[i].first = a;
        p[i].second = b;
    }
    sort(p.begin(), p.end());
    Int res = 0;
    Int cnt = 0;
    for (Int i = 0; i < n; i++) {
        if (cnt + p[i].second < m) {
            res += p[i].first * p[i].second;
            cnt += p[i].second;
        }
        else {
            res += p[i].first * (m - cnt);
            break;
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n,m;cin>>n>>m;
  int l=1,r=n;
  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;
    l=max(l,a);
    r=min(r,b);
  }
  int ans=(l>r)?0:r-l+1;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
R, G, B, N = map(int, input().split())

A = [R,G,B]

count=0
for i in range(N+1):
  for j in range(N+1):
    if N-i*A[0]-j*A[1]<0:
      break
    elif (N-i*A[0]-j*A[1])%A[2]==0:
      count+=1

print(count)

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

using namespace std;
typedef long long ll;

int H,W;
int g[2005][2005];
int h[2005][2005];
int L[2005][2005],R[2005][2005];
char S[2005][2005];

int main() {

cin>>H>>W;

for(int i=0; i<H; i++){
  cin>>S[i];
}

for(int i=0; i<H-1; i++){
  for(int j=0; j<W-1; j++){
    int cnt=0;
    if(S[i][j]=='#') cnt++;
    if(S[i][j+1]=='#') cnt++;
    if(S[i+1][j]=='#') cnt++;
    if(S[i+1][j+1]=='#') cnt++;
    if(cnt%2) g[i][j]=0;
    else g[i][j]=1;
  }
}

for(int i=0; i<H-1; i++){
  for(int j=0; j<W-1; j++){
    if(g[i][j]==0) h[i][j]=0;
    else{
      if(i>0) h[i][j]=h[i-1][j]+g[i][j];
      if(i==0) h[i][j]=g[i][j];
    }
  }
}

int ans=0;

for(int i=0; i<H-1; i++){
  stack<int> l;
  stack<int> r;

for(int j=0; j<W-1; j++){
  while(1){
    if(!l.size()){
      L[i][j]=0;
      break;
    }
    int k=l.top();
    if(h[i][k]<h[i][j]){
      L[i][j]=k+1;
      break;
    }
    else l.pop();
  }
  l.push(j);
}
for(int j=W-1-1; j>=0; j--){
  while(1){
    if(!r.size()){
      R[i][j]=W-1;
      break;
    }
    int k=r.top();
    if(h[i][k]<h[i][j]){
      R[i][j]=k;
      break;
    }
    else r.pop();
  }
  r.push(j);
}

}

for(int i=0; i<H-1; i++){
  for(int j=0; j<W-1; j++){
    int x=(h[i][j]+1)*(R[i][j]-L[i][j]+1);
    ans=max(ans,x);
  }
}

ans=max(ans,H); ans=max(ans,W);

cout<<ans<<endl;

}


Measured memory_bytes: 66944
//Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>	
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>
using namespace std;
#define FOR(index, start, end) for(int index = start; index < end; ++index)
#define RFOR(index, start, end) for(int index = start; index > end; --index)
#define FOREACH(itr, b) for(auto itr = b.begin(); itr != b.end(); ++itr)
#define RFOREACH(itr, b) for(auto itr = b.rbegin(); itr != b.rend(); ++itr)
#define INF 1000000000
#define M 1000000007
typedef long long ll;
typedef pair<int, int> pii;
pii a[100005];
int main(void)
{
	ll n, k;
	cin >> n;
	cin >> k;
	FOR(i, 0, n) {
		scanf("%d%d", &a[i].first, &a[i].second);
	}
	sort(a, a + n);
	FOR(i, 0, n) {
		if ((ll)a[i].second >= k) {
			cout << a[i].first << endl;
			return 0;
		}
		k -= (ll)a[i].second;
	}
}

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

using namespace std;

#define INF 51

void solve (string S, string T){
    for(int i = S.length() - T.length(); i >= 0; i--){
        if(S[i] == '?' || S[i] == T[0]){
            for(int j = 0; j < T.length(); j++){
                if(S[i + j] != T[j] && S[i + j] != '?'){
                    break;
                }
                else if(j == T.length() - 1 && (S[i + j] == T[j] || S[i + j] == '?')){
                    S.replace(i, T.length(), T);
                    for(int k = 0; k < S.length(); k++){
                        if(S[k] == '?')
                            S[k] = 'a';
                    }
                    cout << S << endl;
                    return;
                } 
            }
        }
    }
    cout << "UNRESTORABLE\n";
    return;
}

int main (){
    string S, T;
    cin >> S >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
int main(){
    int n; cin >> n;
    vector<int> ar(1000001,0);
    for (int i = 0; i < n; i++){
        int a; cin >> a;
        ar[a]++;
        ar[a+2]++;
        ar[a+1]++;
    }
    int ma = 0;
    int ans = -1;
    rep (i,1000001){
        if (ar[i] > ma){
            ma = ar[i];
            ans = i-1;
        }
    }
    cout << ma << endl;
}

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



int main() {
  int N;
  cin >> N;
  bool flag = false;
  for(int i=0;i<N;i++){
    char a;
    cin >> a;
    if(a=='Y'){ 
      flag=true;
      break;
    }
  }
  if(flag){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256