akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p){int res = 1; x = x % p;while (y > 0){    if (y & 1)        res = (res * x) % p;y = y >> 1;    x = (x * x) % p; } return res % p;}
int lcm(int a, int b) { return a / __gcd(a, b) * b; }
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        int n;
        cin >> n;

        int r = 0;
        int ans = 100;
        while(ans<n){
            ans += ans / 100;
            r++;
        }
        cout << r << endl;
    }

    return 0;
}

Measured memory_bytes: 3652
#coding:utf-8
from collections import defaultdict
S = input()
dd = defaultdict(int)
for s in S:
    dd[s]+=1
if ((dd['S']>0)^(dd['N']>0)):
    print ("No")
elif((dd['E']>0)^(dd['W']>0)):
    print ("No")
else:
    print ("Yes")


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int a,b,ans;
  cin>>a>>b;
  ans=0;
  string x,y;
  for(int i=a;i<=b;i++){
    x=to_string(i);
    y=to_string(i);
    reverse(y.begin(),y.end());
    if(x==y){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
//ABC136C
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int n;
	scanf("%d",&n);
	int i, j;
	int h[n];
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	for(j=n-1;j>0;j--){
		if(h[j-1] <= h[j]){
			h[j-1] = h[j-1];
		}else{
			if(h[j-1] == h[j] + 1){
				h[j-1] = h[j-1] - 1;
			}else{
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount _builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
//
#define forn(i, n)for(ll i=0;i<n;i++)
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(ll j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
string s;
int main(){FAST;
cin>>s;
string l,r;
for(ll i=0;i<s.length();i++){
	if(i%2){
		l.pb('1');
	}	
	else l.pb('0');
}
for(ll i=0;i<s.length();i++){
	if(i%2){
		r.pb('0');
	}	
	else r.pb('1');
}
ll _l=0,_r=0;
for(ll i=0;i<s.length();i++){
	if(s[i]!=l[i])_l++;
	if(s[i]!=r[i])_r++;
}
cout<<min(_l,_r);
return 0;
}




Measured memory_bytes: 720
N, A, B = map(int,input().split())
if N % (A+B) == 0:
	print((N//(A+B))*A)
elif N % (A+B) <= A:
	print((N // (A+B))*A + N % (A+B))
else:
	print( (N // (A+B))*A + A)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,n,a,count;
  cin>>h>>n;
  a=0,count=0;
  for(int i=0;i<n;i++){
    cin >> a;
    count+=a;
  }
  if(count<h) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <string>

int main()
{
  long n;
  std::cin >> n;

  std::unordered_map<long,long> map;

  std::vector<long> v;
  for (long i = 0; i < n; i++) {
    long val;
    std::cin >> val;
    v.push_back(val);
    auto search = map.find(val);
    if (search != map.end()) search->second += 1;
    else map[val] = 1;
  }

  std::unordered_map<long,long> answers;

  long total = 0;
  for (auto it : map) {
    total += (it.second-1) * it.second / 2;
  }

  for (auto it : map) {
    long v = it.first;
    answers[v] = total - (it.second - 1);
  }

  for (long i = 0; i < n; i++) {
    printf("%ld\n", answers[v[i]]);
  }

  return 0;
}


Measured memory_bytes: 16060
import java.util.Scanner; 

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int[] A = new int[N];
 
      for (int i = 0; i < A.length; ++i) {
        A[i] = in.nextInt();
      }

      int[] gcdBefore = new int[N];
      gcdBefore[0] = 0;
//      gcdBefore[1] = A[0];
      for (int i = 1; i < gcdBefore.length; ++i) {
        gcdBefore[i] = gcd(gcdBefore[i - 1], A[i - 1]);
      }

      int[] gcdAfter = new int[N];
      gcdAfter[gcdAfter.length - 1] = 0;
 //     gcdAfter[gcdAfter.length - 2] = A[A.length - 1];
      for (int i = gcdAfter.length - 2; i >= 0; --i) {
        gcdAfter[i] = gcd(gcdAfter[i + 1], A[i + 1]);
      }

      int ans = -1;
      for (int i = 0; i < A.length; ++i) {
        ans = Math.max(ans, gcd(gcdBefore[i], gcdAfter[i]));
      }

      System.out.println(ans);
    }
  }

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

Measured memory_bytes: 49620
require"matrix";n,m=gets.split.map &:to_i;s=n.times.map{Vector[*gets.split.map(&:to_i)]};p 8.times.map{|b|v=Vector[(b&4)/2-1,(b&2)-1,(b&1)*2-1];s.map{|w|w.dot v}.sort.reverse.take(m).inject :+}.max||0

Measured memory_bytes: 2808
#include <bits/stdc++.h>
#define ENDL '\n'
#define io ios_base::sync_with_stdio(false);cin.tie(0);
#define sayy cout<<"Yes"<<ENDL;
#define sayn cout<<"No"<<ENDL;
#define sayY cout<<"YES"<<ENDL;
#define sayN cout<<"NO"<<ENDL;

typedef long long ll;
using namespace std;

int main(){
    io

    ll n; cin >> n;
    vector<ll> v(n+1), dp(n+1);

    for(int i(1); i<=n; i++) cin >> v[i];

    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(v[2] - v[1]);

    for(int i(3); i<=n; i++){
        dp[i] = min(dp[i-1] + abs(v[i] - v[i-1]), dp[i-2] + abs(v[i] - v[i-2]));
    }
    cout << dp[n] << ENDL;

    return 0;
}

Measured memory_bytes: 4736
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1000000007;

// ref: https://github.com/atcoder-live/library/blob/master/mint.cpp
struct mint
{
  ll x;
  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;
}

int main()
{
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &a[i]);
  }

  vector<vector<mint>> dp(N + 1, vector<mint>(K + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < N; ++i)
  {
    vector<mint> arr = dp[i];
    for (int j = 1; j <= K; ++j)
    {
      arr[j] += arr[j - 1];
    }
    for (int j = 0; j <= K; ++j)
    {
      dp[i + 1][j] += arr[j];
      if (j > a[i])
        dp[i + 1][j] -= arr[j - a[i] - 1];
    }
  }
  // for (int i = 0; i <= N; ++i)
  // {
  //   for (int j = 0; j <= K; ++j)
  //     cerr << dp[i][j] << ' ';
  //   cerr << endl;
  // }
  cout << dp[N][K] << endl;

  return 0;
}


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

using namespace std;

#define MOD 1000000007
#define N 102
#define M 30
#define ll long long 
#define ld long double
#define pb push_back
#define ff first
#define ss second

ld a[N];
priority_queue <ld> pq;

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int i, n;
	cin>>n;
	for(i=0; i<n; i++){
		cin>>a[i];
		pq.push(-a[i]);
	}
	ld x, y, ans = 0;
	while(pq.size()){
		x = -pq.top();
		if(ans == 0) ans = x;
		else ans = (ans + x)/2.0;
		pq.pop();
	}
	cout<<setprecision(20)<<fixed<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  stack<int>stack;
  for(int i=0;i<n;i++)
  {
    if(stack.empty()){stack.push(s[i]);continue;}
    
    else if(stack.top()!=s[i]){stack.push(s[i]);}
  }
  cout<<stack.size();
  return 0;
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    bool flg = false;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        if(a%2 == 1) flg = true;
    }
    if(flg) puts("first");
    else puts("second");
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[100], b[100] , c;	
	int i=0,tra=0;			

	while (scanf("%d", &c) != EOF){
		if (c >= 1 && c <= 10){
			a[tra] = c;			
			tra++;				
		}
		else if (c == 0){		
			tra--;				
			b[i] = a[tra];		
			i++;
		}
	}
	for (c = 0; c < i; c++){	
		printf("%d\n",b[c]);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const ll LINF = 1e11;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

    int r, d, x;
    cin >> r >> d >> x;

    int nx = x;
    for (int i = 0; i < 10; ++i) {
        nx = r * nx - d;
        cout << nx << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    lint a[7];
    rep(i, 7){
        cin >> a[i];
    }

    lint ans1 = a[1];
    ans1 += a[0] >> 1 << 1;
    ans1 += a[3] >> 1 << 1;
    ans1 += a[4] >> 1 << 1;
    ans1 += (a[0] & a[3] & a[4] & 1LL) * 3LL;

    lint ans2 = a[1];
    if(a[0] && a[3] && a[4]){
        --a[0];
        --a[3];
        --a[4];
        ans2 += 3LL;
    }
    ans2 += a[0] >> 1 << 1;
    ans2 += a[3] >> 1 << 1;
    ans2 += a[4] >> 1 << 1;

    cout << max(ans1, ans2) << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
main = do
    _ <- getLine
    as <- (fmap read . words) <$> getLine
    putStrLn $ show $ sum $ map (countM2 0) as

countM2 ac n
    | n `mod` 2 == 0 = countM2 (ac+1) (n `div` 2) 
    | otherwise      = ac

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

string S;

void Input(){
	cin>>S;
}

void Solve(){
	int maxim=0,total=0;
	for(int i=0; i<S.length(); i++){
		if(S[i]=='R')total++;
		if(S[i]=='S'){
			maxim=max(maxim,total); total=0;
		}
	}
	maxim=max(maxim,total);
	cout<<maxim<<'\n';
}

int main(){
	Input();
	Solve();
}

Measured memory_bytes: 3588
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    _ = sc.intarr()[0]
    S = sc.strarr()[0]

    count = 0

    for i in range(1000):
        # print("--------")
        lucky = format_str(i)
        first = S.find(lucky[0])
        third = S.rfind(lucky[2])

        if first == -1 or third == -1:
            continue
        elif first < third:
            if lucky[1] in S[first + 1:third]:
                count += 1
    print(count)


def format_str(num):
    if num < 10:
        return "00" + str(num)
    elif num < 100:
        return "0" + str(num)
    else:
        return str(num)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()


// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double A_angle, B_angle;
    B_angle = 2 * M_PI * M / 60.0;
    A_angle = 2 * M_PI * H / 12.0 + B_angle / 12.0;
    double theta = abs(A_angle - B_angle);
    if(theta > M_PI) theta = 2 * M_PI - theta;
    double ans2 = A * A + B * B - 2 * A * B * cos(theta);
    cout << fixed << setprecision(10);
    cout << sqrt(ans2) << endl; 
}

Measured memory_bytes: 4252
import copy
N, M = map(int, input().split())
H = list(map(int, input().split()))

H2 = copy.copy(H)
for i in range(M):
    A, B = map(int, input().split())
    if H[A - 1] > H[B - 1]:
        H2[B - 1] = False
    elif H[A - 1] < H[B - 1]:
        H2[A-1] = False
    else:
        H2[A - 1] = False
        H2[B - 1] = False

H3 = H2.count(False)

print(len(H) - H3)

Measured memory_bytes: 21000
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 55
using namespace std;

typedef long long ll;
ll n, m, i,a[N], s[N][N][2505];
ll f(ll p, ll q,ll w) {
	if (p == n) return (q >0 && q * m == w ? 1 : 0);
	if (s[p][q][w] != -1) return s[p][q][w];
	return s[p][q][w] = f(p + 1, q, w) + f(p + 1, q + 1, w + a[p]);
}
int main()
{
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		scanf ("%lld", &a[i]);
	}
	memset(s, -1, sizeof(s));
	cout << f(0, 0, 0);
    return 0;
}

Measured memory_bytes: 59392
#include <bits/stdc++.h>
#define int long long
#define N 100011

using namespace std;

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

int n, m;
int p[N], dp[N];

/* ----- DP ----- */

int f(int idx) {
	if(idx > n or p[idx]) return 0;
	if(idx == n) return 1;
	if(dp[idx] != -1) return dp[idx];
	return dp[idx] = (f(idx+1) + f(idx+2)) % MOD;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	memset(dp, -1, sizeof dp);
	cin >> n >> m;
	while(m--) {
		int x;
		cin >> x;
		p[x] = true;
	}
	cout << f(0) << endl;
	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main() {
  int X, Y;
  cin >> X >> Y;
  for( int i = 0; i <= X; i++ ){
    if( i*2 + (X-i)*4 == Y ){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

}


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

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

  int ans = 0;
  int tmp = 0;
  for( int b = 1; b <= X; b++ ) {
    for( int p = 2; p <= X * 2; p++ ) {
      tmp = pow( b, p );
      if( tmp > ans and tmp <= X ) {
        // cout << b << ":" << p << "->" << tmp << endl;
        ans = tmp;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int d,g; cin >> d >> g;
    int p[d],c[d];
    for(int i = 0; i < d; i++){
        cin >> p[i] >> c[i];
    }
    int mi = INT_MAX;
    for(int i = 0; i < pow(2,d); i++){
        int score = 0, num = 0, last = 0;
        for(int j = 0; j < d; j++){
            if(i&(1<<j)){
                score += (j+1)*100*p[j] + c[j];
                num += p[j];
            }else{
                last = j;
            }
        }
        for(int j = 0; j < p[last]-1; j++){
            if(score >= g) break;
            score += (last+1)*100;
            num++;
        }
        if(score >= g){
            mi = min(mi, num);
        }
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,a,b;
  cin>>n>>a>>b;
  vector<Int> p(n);
  for(Int i=0;i<n;i++) cin>>p[i];
  Int x=0,y=0,z=0;
  for(Int i=0;i<n;i++){
    if(p[i]<=a) x++;
    else if(p[i]<=b) y++;
    else z++;
  }
  cout<<min({x,y,z})<<endl;
  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 x=sc.nextInt();
    
    if(x<1200){
      System.out.println("ABC");
    }else{
      System.out.println("ARC");
    }
  }
}

Measured memory_bytes: 20820
var
  x1,x2,x3:char;
  i,j,k,n,s:longint;
begin
  readln(n);
  for i:=0 to 1 do
    for j:=0 to 1 do
      for k:=0 to 1 do
        begin
          s:=n div 1000;
          if i=0 then begin s:=s+n div 100 mod 10;x1:='+';end
            else begin s:=s-n div 100 mod 10;x1:='-';end;
          if j=0 then begin s:=s+n div 10 mod 10;x2:='+';end
            else begin s:=s-n div 10 mod 10;x2:='-';end;
          if k=0 then begin s:=s+n mod 10;x3:='+';end
            else begin s:=s-n mod 10;x3:='-';end;
          if s=7 then begin writeln(n div 1000,x1,n div 100 mod 10,x2,n div 10 mod 10,x3,n mod 10,'=7');exit;end;
        end;
end.

Measured memory_bytes: 128
import scala.collection.mutable.Queue

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, m = sc.nextInt()
  val lrd = List.fill(m)((sc.nextInt()-1, sc.nextInt()-1, sc.nextInt()))
  val adj = Array.fill(n)(List[(Int, Int)]())

  val uf = new UnionFind(n)
  for ((l, r, d) <- lrd) {
    adj(l) ::= (r, d)
    adj(r) ::= (l, -d)
    uf.unite(l, r)
  }

  val cs = lrd.groupBy(x => uf.root(x._1))
  val visited = Array.fill(n)(false)
  val x = Array.fill(n)(-1L)

  println(if (cs.values.forall(isOk)) "Yes" else "No")

  def isOk(edges: Seq[(Int, Int, Int)]): Boolean = {
    val s = edges.head._1
    val queue = Queue(s)
    visited(s) = true
    x(s) = 0
    while (queue.nonEmpty) {
      val u = queue.dequeue()
      for ((v, d) <- adj(u) if !visited(v)) {
        x(v) = x(u) + d
        queue.enqueue(v)
        visited(v) = true
      }
    }

    edges.forall{case (l, r, d) => x(r) - x(l) == d}
  }
}

class UnionFind(n: Int) {
  private val par = Array.tabulate(n)(identity)
  private val rank = Array.fill(n)(1)

  def root(x: Int): Int = {
    var res = x
    var children = List[Int]()
    while (par(res) != res) {
      children ::= res
      res = par(res)
    }

    for (y <- children) {
      par(y) = res
    }
    res
  }

  def unite(x: Int, y: Int): Unit = {
    val xr = root(x)
    val yr = root(y)
    if (xr != yr) {
      if (rank(xr) < rank(yr)) {
        par(xr) = yr
      } else {
        par(yr) = xr
        if (rank(xr) == rank(yr)) {
          rank(xr) += 1
        }
      }
    }
  }
}


Measured memory_bytes: 126520
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,n;
    cin>>k>>n;
    set<int> s;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        s.insert(a[i]);
    }
    int ans=1;
    int i=k;
    int j=k;
    while(1)
    {
        if(s.find(i)==s.end())
        {
            ans=i;
            break;
        }
        if(s.find(j)==s.end())
        {
            ans=j;
            break;
        }
        i--;
        j++;
    }
    cout<<ans;
}

Measured memory_bytes: 3588
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
  long long d,t,s;
  //string s;
  cin>>d>>t>>s;
  if(d<=t*s)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3632
using System;
using System.Linq;

namespace AGC041
{
    class A
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = input[0];
            long A = input[1];
            long B = input[2];

            if ((B - A) % 2 == 0) { Console.WriteLine((B - A) / 2); return; }

            long l = B - 1;
            long r = N - A;

            long res = 0;
            if (l < r)
            {
                res = A + (B - A) / 2;
            }
            else if (r < l)
            {
                res = (N - B + 1) + (N - (A + (N - B + 1))) / 2;
            }
            else
            {
                res = A + (B - A) / 2;
            }

            Console.WriteLine(res);

        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

public 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();
		boolean hantei = false;
		for (int i = a; i <= b; i++) {
			if (i % k == 0) {
				hantei = true;
			}
		}
		if (hantei) {
			System.out.println("OK");
		} else {
			System.out.println("NG");
		}
		sc.close();
	}
}


Measured memory_bytes: 35656
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
 
N, K = map(int, readline().split())
A = list(map(int, readline().split()))
 
ans = pow(10, 11)
 
for bit in range(1 << (N)):
    if bin(bit).count('1') < K:
        continue
    acc = 0
    pre = 0
    for i in range(N):
        if bit & (1 << i):
            acc += max(0, pre + 1 - A[i])
            pre += 1
        pre = max(pre, A[i])
    ans = min(ans, acc)
print(int(ans))

Measured memory_bytes: 12496
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int d;
  cin>>d;

  vector<ll> p(26);
  vector<pair<int,int>> hai(26);
  vector<int> zero;
  rep(i,26) {
    cin>>p[i];
    if(p[i]<=3) zero.pb(i);
    hai[i]={p[i],i};
  }

  int ze=zero.size();

  sort(all(hai));
  int t1,t2,t3;
  t1=hai[d-1].se;
  t2=hai[d-2].se;
  t3=hai[d-3].se;

  vector<vector<ll>> q(d,vector<ll>(26));
  rep(i,d) {
    rep(j,26) {
      cin>>q[i][j];
    }
  }

  ll pre=0;
  vector<int> r(26,0);
  rep(i,d-5){
    ll ans=-INF;
    ll memo;
    rep(j,26){
      rep(k,ze){
        if(j==zero[k]) continue;
      }
      ll sum=pre;
      auto last=r;
      sum+=q[i][j];
      last[j]=i+1;
      rep(k,26){
        sum-=p[k]*(i+1-last[k]);
      }
      if(sum>ans) {
        memo=j;
        chmax(ans,sum);
      }
    }
    cout << memo+1 << endl;
    pre=ans;
    r[memo]=i+1;
  }

  ll answer=-INF;
  ll A,B,C,D,E;
  vector<int> zen(5);
  rep(i,26){
    rep(j,26){
      rep(k,26){
        rep(l,26){
          rep(m,26){
            zen[0]=i;
            zen[1]=j;
            zen[2]=k;
            zen[3]=l;
            zen[4]=m;

            ll sum=0;
            auto last=r;
            rep(n,5){
              sum+=q[d-5+n][zen[n]];
              last[zen[n]]=d-5+n+1;
              rep(o,26){
                sum-=p[o]*(d-5+n+1-last[o]);
              }
            }

            if(sum>answer) {
              A=zen[0];
              B=zen[1];
              C=zen[2];
              D=zen[3];
              E=zen[4];
            }
            chmax(answer,sum);

          }
        }
      }
    }
  }

  cout << A+1 << endl;
  cout << B+1 << endl;
  cout << C+1 << endl;
  cout << D+1 << endl;
  cout << E+1 << endl;
  
}

Measured memory_bytes: 3764
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int n;
using Panel = array<int, 4>;

Panel rotate(Panel a) {
  tie(a[0], a[1], a[2], a[3]) = make_tuple(a[1], a[2], a[3], a[0]);
  return a;
}

Panel normalize(Panel a) {
  Panel p[4];
  for(int i = 0; i < 4; i++) {
    p[i] = a;
    a = rotate(a);
  }
  return *min_element(p, p + 4);
}

const int N = 400;

int rotcount(Panel a) {
  auto b = a;
  int res = 0;
  for(int i = 0; i < 4; i++) {
    b = rotate(b);
    if(a == b) res++;
  }
  return res;
}

ll fact[10];
ll comb[N + 1][10];

Panel a[N];

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

  map<Panel, int> cnt;
  for(int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    a[i] = normalize(a[i]);
    cnt[a[i]]++;
  }

  comb[0][0] = 1;

  for(int i = 1; i <= n; i++) for(int j = 0; j <= 9; j++) {
    // Pascal's identity
    if(j == 0) {
      comb[i][j] = 1;
      continue;
    }
    comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
  }

  fact[0] = 1;
  for(int i = 1; i <= 9; i++) fact[i] = fact[i-1] * i;

  ll ans = 0;
  for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) {
    auto it = a[i];
    for(int rot = 0; rot < 4; rot++) {
      it = rotate(it);
      map<Panel, int> target;
      for(int k = 0; k < 4; k++) {
        Panel f{it[(k + 1) % 4], it[k + 0], a[j][(4 - k) % 4], a[j][3 - k]};
        f = normalize(f);
        target[f]++;
      }

      int ng = 0;
      ll res = 1;
      for(auto &p : target) {
        Panel pan;
        int tar;
        tie(pan, tar) = p;
        int c = cnt[pan] - (pan == a[i]) - (pan == a[j]);
        if(c < tar) {ng = 1; break;}
        res *= comb[c][tar] * pow((ll) rotcount(pan), (ll) tar) * fact[tar];
      }
      if(ng) continue;
      ans += res;
    }
  }
  assert(ans % 3 == 0);
  cout << ans/3 << endl;
  return 0;
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
#define maxn 500009
using namespace std;
int n;
int a[maxn];
int ans[maxn];
int cnt[maxn];
bool mark[maxn];
deque<int>Q;
bool solve(){
	for(int i=1;i<=n*n;i++){
		if(ans[i]){
			for(int j = 0;j<n-ans[i];j++)
				Q.push_back(ans[i]);
			continue;
		}
		else{
			if(Q.empty())
				return 0;
			int u = Q.front();
			Q.pop_front();
			ans[i]=u;
		}
	}
	for(int i=1;i<=n*n;i++){
		cnt[ans[i]]++;
		if(mark[i] && cnt[ans[i]] != ans[i])
			return 0;
	}
	return 1;
}
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		ans[a[i]]=i;
		mark[a[i]]=1;
	}
	
	for(int i = 1;i <= n*n;i++){
		if(ans[i] == 0)
			continue;
		for(int j = 0; j< ans[i]-1;j++)
			Q.push_back(ans[i]);
	}

	if(!solve())
		puts("No");
	else{
		puts("Yes");
		for(int i=1;i<=n*n;i++)
			printf("%d ",ans[i]);
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 3072
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        hh: u32,
        ww: u32,
        h: u32,
        w: u32,
    }
    println!("{}", (hh-h) * (ww-w));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  bool w=false,e=false,n=false,s=false;
  string a;
  cin>>a;
  rep(i,a.size()){
    if(a[i]=='W'){
      w=true;
    }
    if(a[i]=='E'){
      e=true;
    }
    if(a[i]=='N'){
      n=true;
    }
    if(a[i]=='S'){
      s=true;
    }
  }
  if(!(w^e) && !(n^s)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef pair<char,int> P;
const int maxn = 100005;
int tree[maxn];
int ar[maxn];
P query[maxn];
int get(int i)
{
	if(ar[i])return i;
	return tree[i] = get(tree[i]);
}
int main()
{
	int n,q;
	while(scanf("%d%d",&n,&q)&&(q+n)!=0){
		memset(ar,0,sizeof(ar));
		ar[1] = true;
		for(int i = 2;i<=n;i++)
			scanf("%d",&tree[i]);
		for(int i = 0;i<q;i++)
			scanf(" %c%d",&query[i].first,&query[i].second);
		long long sum = 0;
		for(int i = 0;i<q;i++)
			if(query[i].first=='M')
				ar[query[i].second] += 1;
		for(int i = q-1;i>=0;i--)
			if(query[i].first=='M')ar[query[i].second] -= 1;
			else sum += get(query[i].second);
		printf("%lld\n",sum);	
	}
	return 0;
}

Measured memory_bytes: 2908
#include<iostream>

using namespace std;

typedef long long ll; 
ll N; int cnt = 0;

void dfs(bool flag3,bool flag5, bool flag7, ll X){
  if( X > N){return;}
  else if(flag3 && flag5 && flag7){cnt++;}
  
  dfs(true,flag5,flag7, 10*X + 3);
  dfs(flag3,true,flag7, 10*X + 5);
  dfs(flag3,flag5,true, 10*X + 7);}
  
int main()
{ cin >> N;
 dfs(0,0,0,0);
 cout << cnt << endl; return 0;}

Measured memory_bytes: 256
L,R=map(int,input().split())

if R-L>=2018:
  print(0)
else:
  M=[]
  for i in range(L,R+1):
    M.append(i%2019)
  #print(M)
  A=[]
  for i in M:
    for j in M:
      if i!=j:
        A.append(i*j%2019)
  #print(A)
  print(min(A))
  

Measured memory_bytes: 147760
from collections import defaultdict
from bisect import bisect_right

dic_PY = defaultdict(list)
N, M = map(int, input().split())
PY = [list(map(int, input().split())) for _ in range(M)]
for p, y in sorted(PY):
  dic_PY[p] += [y]
  
for p, y in PY:
  z = bisect_right(dic_PY[p], y)
  print("%06d%06d"%(p,z))

Measured memory_bytes: 43328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    //reverse(s.begin(), s.end());
    vvec<int> dp(n, vec<int>(n, 0));
    int ans = 0;
    rep(i, n) rep(j, n) {
        if (i==0 && j==0) continue;
        if (s[i]==s[j]) {
            if (i==0 || j==0) dp[i][j] = 1;
            else dp[i][j] = min(dp[i-1][j-1] + 1, abs(i - j));
        }
        ans = max(dp[i][j], ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 98176
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	alphabet := "abcdefghijklmnopqrstuvwxyz"

	alphabetsMap := map[string]int{"a": 0, "b": 0, "c": 0, "d": 0, "e": 0, "f": 0, "g": 0, "h": 0, "i": 0, "j": 0,
								"k": 0, "l": 0, "m": 0, "n": 0, "o": 0, "p": 0, "q": 0, "r": 0, "s": 0, "t": 0,
								"u": 0, "v": 0, "w": 0, "x": 0, "y": 0, "z": 0}
	scanner := bufio.NewScanner(os.Stdin)
	for {
		scanner.Scan()
		st := scanner.Text()
		if st == "" {
			break
		}
		sr := ""
		for _, v := range st {
			x := string(v)
			l := strings.ToLower(x)
			if l != x {
				sr += l
			} else {
				sr += x
			}
		}
		// fmt.Println(sr)
		for _, v := range sr {
			alphabetsMap[string(v)]++
		}
		// fmt.Println(alphabetsMap)
	}
	for i := 0; i < len(alphabet); i++ {
		fmt.Printf("%s : %d\n", alphabet[i:i+1], alphabetsMap[alphabet[i:i+1]])
	}
}



Measured memory_bytes: 1512
#include<stdio.h>
long long x,y;
int main()
{
scanf("%lld %lld",&x,&y);
if(x==1||y==1)
{
	if(x*y==1) puts("1");
	else printf("%lld\n",x+y-3);
}
else printf("%lld",(x-2)*(y-2));
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <tuple>
using namespace std;
    #define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
    #define ll long long
    #define int long long 
    #define ull unsigned long long 
    #define ld long double
    #define sb __builtin_popcount
    #define vi vector<int>
    #define vc vector<char>
    #define ii pair<int, int>
    #define pq priority_queue<ii, vector<ii>, greater<ii>>
    #define vii vector<ii>
    #define sz(a) int((a).size())
    #define f(a, b) for (int i = a; i < b; i++)
    #define fr(a, b) for (int i = a - 1; i >= b; i--)
    #define tr(x, m) for (auto x : m)
    #define in(a, b) (b.find(a) != string::npos)
    #define minin(a) *min_element(all(a))
    #define maxin(a) *max_element(all(a))
    #define X first
    #define Y second
    #define fill(a, x) memset(a, x, sizeof(a))
    #define pb push_back
    #define pf push_front
    #define mp make_pair
    #define all(v) v.begin(), v.end()
    #define rall(v) reverse(v.begin(), v.end())
    #define unq(v) v.erase(unique(all(v)), v.end())
    #define el "\n"
    #define mx3(a, b, c) max(max(a, b), c)
    #define mn3(a, b, c) min(min(a, b), c)
    #define S(v) accumulate(all(v), (ll)0)
    #define SP(n) cout.precision(n)
    const ld PI = atan(1.0) * 4.0;
    const ll MOD = 1e9 + 7;
    const ll INF = 1e18;
    const ld EPS = 0.0000001;
    const ll MD = 998244353;
    
    int32_t main() {
        fio;
        int n,k;
        cin>>n>>k;
        int a[k+1][n+1];
        fill(a,0);
        int x,xx;
        for(int i=1;i<=k;i++){
            cin>>x;
            for(int j=0;j<x;j++){
                cin>>xx;
                a[i][xx]++;
            }
        }
       /* for(int i=1;i<=k;i++){
            for(int j=1;j<=n;j++){
                cout<<a[i][j]<<" ";
            }
            cout<<el;
        }*/
        int ans=0;
        for(int i=1;i<=n;i++){
            int cnt=0;
            for(int j=1;j<=k;j++){
                if(a[j][i]==0)cnt++;
            }
            if(cnt==k)ans++;
        }
        cout<<ans<<el;
        return 0;
    }


Measured memory_bytes: 3668
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

int main(int argc, char* args[]) 
{
	int n,i;
	int cnt = 0, hen[2] = {0};
	int seg[100000];
	long long int s;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &seg[i]);
	}

	qsort(seg, n, sizeof(int), compare);

	for (i = 0; i < n - 1; i++) {
		if (seg[i] == seg[i + 1]) {
			hen[cnt++] = seg[i++];
		}
		if (cnt == 2)
			break;
	}

	s = (long long int)hen[0] * (long long int)hen[1];
	printf("%lld\n", s);
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e8;

signed
main(){
	int n;
	vector<int> odd, four;
	for(int i=1;i*(i+1)*(i+2)<=6*1e6;i++)
	{
			int tmp = i*(i+1)*(i+2)/ 6;
			if(tmp %2 == 1) odd.push_back(tmp);
			four.push_back(tmp);
	}

	//初期化
	vector<int> dp(1e6+5, MAX), dp_odd(1e6+5, MAX);
	dp[0] = 0;

	for(int i=1;i<=1e6;i++)
	{
			for(int j=0;j<four.size() and four[j]<=i;j++)
			{
					dp[i] = min(dp[i], dp[i-four[j]]+1);
			}
	}

	dp_odd[0] = 0;

	for(int i=1;i<=1e6;i++)
	{
			for(int j=0;j<odd.size() and odd[j]<=i;j++)
			{
					dp_odd[i] = min(dp_odd[i], dp_odd[i-odd[j]]+1);
			}
	}

	while(cin >> n && n!=0)
	{
			cout << dp[n] << " " << dp_odd[n] << endl;
	}
}


Measured memory_bytes: 10548
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
a = [0, 0, 0]
b = [0, 0, 0]
ans = False
for i in range(101):
    flag = False
    a[0] = i
    for j in range(3):
        b[j] = c[0][j] - a[0]
    for j in range(3):
        a[j] = c[j][0] - b[0] 
    
    for j in range(3):
        for k in range(3):
            if a[j] + b[k] != c[j][k]:
                flag = True
                break
        
    if flag:
        break
    else:
        ans = True
        break

print('Yes') if ans else print('No')

Measured memory_bytes: 38384
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def f(a):
    """
    xor [0,a]
    """
    l = []
    d = 2
    while (a+1)//d > 0:
        t = (a+1)//d*(d//2)+max((a+1) % d-d//2, 0)
        l.append(t % 2)
        d *= 2
    l.append(((a+1)-d) % 2)
    return l


def solve2(a, b):
    rb = f(b)
    ra = f(a-1)
    for i in range(len(ra)):
        rb[i] ^= ra[i]
    ans = "".join(map(str, reversed(rb)))
    print(int(ans, 2))


A, B = map(int, input().split())
if A == 0 and B == 0:
    print(0)
else:
    solve2(A, B)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	int all=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		all+=a[i];
	}
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	if(a[m-1]*4*m<all)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	




}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var a = new int[5];
		for (var i = 0; i < 5; i++) a[i] = F;
		DFS(a.ToList(), 0);
		WriteLine(min);
	}
	int min = int.MaxValue;
	void DFS(List<int> left, int time)
	{
		if (left.Count == 0) min = Min(min, time);
		else
		{
			time = (time + 9) / 10 * 10;
			foreach (var x in left.ToList())
			{
				left.Remove(x);
				DFS(left, time + x);
				left.Add(x);
			}
		}
	}
}


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

int n, m, l[200007], r[200007], d[200007];

ll pa[200007], dist[200007];

pair<ll, ll> parent(int child){
  ll now = child, distance = 0;
  while(now != pa[now]){
    distance += dist[now];
    now = pa[now];
  }
  return make_pair(now, distance);
}

int main(void){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> l[i] >> r[i] >> d[i];
    l[i]--; r[i]--;
  }
  for(int i=0;i<n;i++) pa[i] = i;
  
  bool flg = true;
  for(int i=0;i<m;i++){
  	pair<ll, ll> p1 = parent(l[i]); 
    int pa1 = p1.first; int dist1 = p1.second;
    pa[l[i]] = pa1; dist[l[i]] = dist1;
    pair<ll, ll> p2 = parent(r[i]);
    int pa2 = p2.first; int dist2 = p2.second;
    pa[r[i]] = pa2; dist[r[i]] = dist2;
	cerr << pa1 << "," << dist1 << "  " << pa2 << "," << dist2 << endl;
    if (pa1 != pa2){
      if (rand()%2){
	      pa[pa1] = pa2; dist[pa1] = dist2 - dist1 + d[i];
      }else{
          pa[pa2] = pa1; dist[pa2] = dist1 - dist2 - d[i];
      }
    }else{ //矛盾判定
      if (dist1 - dist2 != d[i]) {flg = false; break;}
    }
  }
  cout << (flg ? "Yes" : "No" ) << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}
int main(){
  int a,b,t;
  cin >> a >> b >>t;
  int ans =0;
  ans =(t/a)*b;
  cout << ans <<endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
x=int(input())
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
while True:
    if is_prime(x)==True:
        print(x)
        break
    else:
        x+=1

Measured memory_bytes: 38408
(setq a (read) b (read) c (read))
(setq cnt5 0)
(setq cnt7 0)

(if (= a 5) (setq cnt5(+ cnt5 1)) (if (= a 7) (setq cnt7 (+ cnt7 1)) ()))
(if (= b 5) (setq cnt5(+ cnt5 1)) (if (= b 7) (setq cnt7 (+ cnt7 1)) ()))
(if (= c 5) (setq cnt5(+ cnt5 1)) (if (= c 7) (setq cnt7 (+ cnt7 1)) ()))

(princ (if (and (= cnt5 2) (= cnt7 1)) "YES" "NO"))

Measured memory_bytes: 24380
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<chrono>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(lli i=a;i<b;i++)
#define bfr(i,a,b) for(lli i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007LL
#define mod2 998244353LL
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 


lli power(lli x,lli y,lli m)
{
    lli res=1;
    while(y>0)
    {
        if(y&1)res=((res%m)*(x%m))%m;
        y>>=2;
        x= ((x%m)*(x%m))%m;
    }
    return res%m;
}

int main()
{
    
                        
     fio

     
     string s,t;
     cin>>s>>t;
     lli cnt=0;
     fr(i,0,s.length())if(s[i]!=t[i])cnt++;
     cout<<cnt;




      
     

     
              


return 0;}    


Measured memory_bytes: 3812
#include<stdio.h>
int main(){
	int i,j,n=1<<18;
	char p[1<<18];
	for(i=0;i<n;i++)
		p[i]=(i<2)?0:1;
	for(i=2;i*i<n;i++)
		for(j=i*2;j<n;j+=i)
			p[i]?p[j]=0:0;

	for( ; j=0,scanf("%d",&n),n ; printf("%d\n",j) )
		for(i=n+1;i<=2*n;i++)
        	p[i]?j++:0;
}

Measured memory_bytes: 0