akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

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

  while (n >= 500) {
    n -= 500;
  }
  if (a >= n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

public class Main {


    private  static void solver(InputReader sc, PrintWriter out) throws Exception {
            int n = sc.nextInt();
            int m = sc.nextInt();
            Set<Integer> hs = new HashSet<>();
            for(int i=0 ;i<m; i++){
                hs.add(sc.nextInt());
            }
            long dp[] = new long[n+1];
            long mod = 1000000007;
           if(hs.contains(0))
               dp[0] = 0;
           else
               dp[0] = 1;
           if(hs.contains(1))
               dp[1] = 0;
           else
               dp[1] = 1;
            for(int i=2;i<=n;i++){
                if(hs.contains(i)){
                    dp[i] = 0;
                }
                else{
                    dp[i] = (dp[i-1]+dp[i-2])%mod;
                }
            }
           /* for(int x : dp)
                out.print(x+"->");*/
            out.println(dp[n]%mod);
    }
    private  static long gcd(long a, long b){
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    public static void main(String[] args) throws Exception{
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }

        public long[] readLongArr(int n){
            long arr[] = new long[n];
            for(int i=0; i<n; i++){
                arr[i] = nextLong();
            }
            return arr;
        }
        public int[] readIntArr(int n){
            int arr[] = new int[n];
            for(int i=0; i<n; i++){
                arr[i] = nextInt();
            }
            return arr;
        }
    }
}
class Pair implements Comparable<Pair>{
    int x;
    String s;
    Pair(int x, String s){
        this.x = x;
        this.s = s;
    }
    public int compareTo(Pair p){
        return this.x-p.x;
    }
}

Measured memory_bytes: 45056
#include<stdio.h>

int main(){
  long long a, b, x;
  scanf("%lld %lld %lld", &a, &b, &x);

  long long qa, qb;
  qb = b/x;
  qa = (a-1ll)/x;

  if(b == 0ll){
    printf("%d\n", 1);
  }else if(a==0ll && x!=1ll){
    printf("%lld\n", qb-qa+1);
  }else{
    printf("%lld\n", qb-qa);
  }

  return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  string ans;
  cin >> N;
  vector<char> v(N, '*');

  {
    cout << 0 << endl; cout << flush;
    cin >> ans;
    if(ans == "Vacant") return 0;
    if(ans == "Male") v[0] = 'M';
    if(ans == "Female") v[0] = 'F';
  }
  {
    cout << N-1 << endl; cout << flush;
    cin >> ans;
    if(ans == "Vacant") return 0;
    if(ans == "Male") v[N-1] = 'M';
    if(ans == "Female") v[N-1] = 'F';
  }

  int lb = 0;
  int ub = N-1;
  while(true){
    int m = (ub+lb)/2;
    cout << m << endl; cout << flush;
    cin >> ans;
    if(ans == "Vacant") return 0;
    if(ans == "Male") v[m] = 'M';
    if(ans == "Female") v[m] = 'F';

    if((m-lb)%2==1 && v[lb] == v[m]){
      ub = m;
    }
    else if((m-lb)%2==0 && v[lb] != v[m]){
      ub = m;
    }
    else if((ub-m)%2==1 && v[m] == v[ub]){
      lb = m;
    }
    else if((ub-m)%2==0 && v[m] != v[ub]){
      lb = m;
    }
    else break;
  }
  
  return 0;
}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

struct abc
{
    llint a, b, c;
    abc() {}
    abc(llint a, llint b, llint c) : a(a), b(b), c(c) {}

    bool operator < (const abc &tmp) const {
	return c > tmp.c;
    }
};

int n;
abc c[100001];
    
int main()
{
    ci >> n;
    llint a, b;
    rep(i, n) {
	ci >> a >> b;
	c[i] = abc(a, b, a + b);
    }

    sort(c, c + n);

    llint taka = 0, aoki = 0;
    rep(i, n) {
	if(i % 2 == 0) taka += c[i].a;
	else aoki += c[i].b;
    }
    
    co << taka - aoki << en;
  
    return 0;
}




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

int main(){
  	char b;
  	cin >> b;
  	if(b=='A') b='T';
  	else if(b=='T') b='A';
  	else if(b=='C') b='G';
  	else if(b=='G') b='C';
	cout << b << endl;
  	return 0;
}

Measured memory_bytes: 256
S = list(str(input()))


N = len(S)
X = 0

for i in range(N):
    if i % 2 == 0 and S[i] == "R" or S[i] == "U" or S[i] == "D":
        X += 1
    elif i % 2 == 1 and S[i] ==  "L" or S[i] == "U" or S[i] == "D":
        X += 1

if X == N:
    print("Yes")
else:
    print("No")


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

ll GCD(ll a, ll b) {
  if ( a%b==0 ) return b;
  return GCD(b, a%b);
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  REP(i,N) cin >> A[i];
  REP(i,N-1) {
    A[i+1] = GCD(A[i], A[i+1]);
  }
  cout << A[N-1] << endl;
}


Measured memory_bytes: 1024
//LthKthNumber
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

static const int MAX = 200000;

int A[MAX];
ll N, K, L;

bool check(ll num) {
    ll cnt  = 0, kcnt = 0;
    ll r = 0;
    for(int l = 0; l < N; l++) {
        while(kcnt < K && r < N) {
            if(A[r++] <= num) kcnt++;
        }
        if(kcnt == K) cnt += min(N - r + 1, N - (l + K) + 1);
        if(A[l] <= num) kcnt--;
    }
    return cnt >= L;
}

int main() {
    cin >> N >> K >> L;
    for(int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    ll left = 1, right = N, mid;

    while(left < right) {
        mid = (left + right) / 2;
        if(check(mid)) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }

    cout << left << endl;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
void init_fact(){
	kaijo[0]=1;
	for(int i=1;i<=2000000;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(!kaijo[0])init_fact();
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
	x=modpow(x,MOD-2);
	return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
	return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,a[300010],cnt[61],ans;
signed main(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		ans+=a[i];
		ans%=MOD;
	}
	ans*=n-1;
	ans%=MOD;
	rep(i,n){
		rep(j,60){
			if((a[i]>>j)&1)cnt[j]++;
		}
	}
	rep(j,60){
		int c=1;
		c*=((int)1<<j);
		c%=MOD;
		c*=(cnt[j]*(cnt[j]-1))%MOD;
		c%=MOD;
		ans=ans+MOD-c;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    Int(n);
    vi data(n);
    rep(i, n) cin >> data[i];

    int ans = 0;

    rep(i, n) {
        int pt = i;
        for (int j = i; j < n; j++) {
            if (data[pt] > data[j]) pt = j;
        }
        if (i != pt) ans++;
        swap(data[pt], data[i]);
    }
    rep(i, n-1) cout << data[i] << " ";
    cout << data[n-1] << endl;
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		b=max(b,-b),c=max(c,-c);
		if((b+c)%2!=a%2)
		{
			cout<<"No\n";
			return 0;
		}
		if(b+c>a)
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = str(input())

dp = [[0]*(n+1) for _ in range(3)]
wn = [[0]*(n+1) for _ in range(3)]

for i, t in enumerate(T):
  dp[0][i+1] = dp[1][i+1] = dp[2][i+1] = max(dp[0][i], dp[1][i], dp[2][i])

  if i <= k-1:
    if t == 'r':
      dp[2][i+1] += p
      wn[2][i+1] = True
    elif t == 's':
      dp[0][i+1] += r
      wn[0][i+1] = True
    elif t == 'p':
      dp[1][i+1] += s
      wn[1][i+1] = True

  else:
    if t == 'r' and (not wn[2][i+1-k]):
      dp[2][i+1] += p
      wn[2][i+1] = True
    elif t == 's' and (not wn[0][i+1-k]):
      dp[0][i+1] += r
      wn[0][i+1] = True
    elif t == 'p' and (not wn[1][i+1-k]):
      dp[1][i+1] += s
      wn[1][i+1] = True

ans = max(dp[0][n], dp[1][n], dp[2][n])
print(ans)

Measured memory_bytes: 11204
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;


const int SZ = 100333;
int N, Q;
int A[SZ];
ll psum[SZ];
ll jsum[SZ];


ll solve(int X) {
	if (A[N-2] <= X) return jsum[N-1];

	int lo = 0; // disjoint
	int hi = N + 1;
	while (lo + 2 <= hi) {
		int mi = (lo+hi)/2;
		
		int a = N - mi;
		int b = N - (mi+1)/2;
		if (abs(X-A[a]) <= abs(X-A[b]))
			lo = mi;
		else
			hi = mi;
	}

	int a = N - lo;
	int b = N - (lo+1)/2;
	ll ans = psum[N-1] - psum[b-1];

	int t = a - 1;
	if (lo&1) t--;
	ans += t>=0 ? jsum[t] : 0;

	return ans;
}


int main() {
	scanf("%d%d", &N, &Q);
	for (int i=0; i<N; i++) scanf("%d", &A[i]);
	for (int i=0; i<N; i++) {
		psum[i] = i==0 ? A[i] : psum[i-1] + A[i];
		jsum[i] = i<=1 ? A[i] : jsum[i-2] + A[i];
	}


	for (int z=0; z<Q; z++) {
		int X; scanf("%d", &X);
		ll ans = solve(X);
		//printf("--------");
		printf("%lld\n", ans);
	}
	

	return 0;
}

Measured memory_bytes: 3712
S, T = map(str,input().split()) # 複数の数字を変数に格納
A, B = map(int,input().split()) # 複数の数字を変数に格納
U = input() # 数字を変数に格納

a = A
b = B

if U == S:
    a = a - 1
elif U == T:
    b = b - 1
    
print(a,b)

Measured memory_bytes: 3060
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class BIT:
    def __init__(self, N):
        self.N = N
        self.T = [0] * (N + 1)
 
    def add(self, i, x):
        i += 1
        while i <= self.N:
            self.T[i] += x
            self.T[i] %= mod
            i += i & -i
 
    def _sum(self, i):
        s = 0
        i += 1
        while i > 0:
            s += self.T[i]
            s %= mod
            i -= i & -i
        return s % mod
 
    def sum(self, i, j):
        si = self._sum(i - 1)
        sj = self._sum(j)
        return (sj - si) % mod


def main():
    N, K = read_values()
    F = read_lists(K)

    bit = BIT(N)
    bit.add(0, 1)
    for i in range(1, N):
        s = 0
        for l, r in F:
            if i - l < 0:
                continue
            c = bit.sum(max(0, i - r), i - l)
            # print(i, i - r, i - l, c)
            s += c
        # print(s)
        bit.add(i, s)
        # print([bit.sum(i, i) for i in range(N)]) 
    print(bit.sum(N - 1, N - 1) % mod)


if __name__ == "__main__":
    main()

Measured memory_bytes: 72488
n = int(input())
cnt = [0, 0, 0, 0]
for i in range(n):
  s = input()
  if s == "AC":
    cnt[0] += 1
  elif s == "WA":
    cnt[1] += 1
  elif s == "TLE":
    cnt[2] += 1
  elif s == "RE":
    cnt[3] += 1

print("AC x {}".format(cnt[0]))
print("WA x {}".format(cnt[1]))
print("TLE x {}".format(cnt[2]))
print("RE x {}".format(cnt[3]))


Measured memory_bytes: 69952
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long[] t = new long[N];
    long[] a = new long[N];
    for(int i = 0; i < N; i++) {
      t[i] = sc.nextLong();
      a[i] = sc.nextLong(); 
    }
    // i回目の投票時が(t[i]k,a[i]k)としたときのkの最小値
    long[] dp = new long[N];
    dp[0] = 1;
    for(int i = 1; i < N; i++) {
      long k1 = t[i - 1] * dp[i - 1] / t[i];
      long k2 = a[i - 1] * dp[i - 1] / a[i];
      if(((t[i - 1] * dp[i - 1]) % t[i]) != 0) k1++;
      if(((a[i - 1] * dp[i - 1]) % a[i]) != 0) k2++;
      dp[i] = Math.max(k1, k2);
    }
    System.out.println(dp[N - 1] * (t[N - 1] + a[N - 1]));
  }
}

Measured memory_bytes: 27884
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
    ll N, K;
    cin >> N >> K;
    priority_queue<ll> que;
    for(int i = 0; i < N; i++){
        ll h;
        cin >> h;
        que.push(h);
    }

    ll ans = 0;
    for(int i = 0; i < K; i++){
        if(que.empty()) break;

        que.pop();
    }

    while(!que.empty()){
        ans += que.top();
        que.pop();
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2420
/// 1行の文字を空白で分割してVec<T>にする。
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

/// 1つの要素を入力で受け取る
fn read_one<T : std::str::FromStr>() -> T {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().parse().ok().unwrap()
}

fn main() {
    let input : usize = read_one();
    let v : Vec<i32> = read_split();
    let c : Vec<i32> = read_split();
    let mut price = 0;
    for i in 0..input {
        if v[i] < c[i] { continue; }
        price += v[i] - c[i];
    }
    println!("{}", price);
}

Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int extgcd(int a,int b,int& x,int& y){

    if(b == 0){
        x = 1;
        y = 0;
        return a;
    }else{
        int d = extgcd(b,a % b,y,x);
        y -= (a / b) * x;
        return d;
    }
}


int main(){

    int a,b,x,y;
    cin >> a >> b;
    extgcd(a,b,x,y);
    cout << x << " " << y << endl;


}


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

int a[12][12];
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int>c(n);
  for(int i=0;i<n;i++){
    cin>>c[i];
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  long long kotae=INT_MAX;
  for(int s=0;s<1<<n;s++){
    long long sum=0;
    vector<int>d(m,0);
    for(int i=0;i<n;i++){
      if(s>>i&1){
        sum+=c[i];
        for(int j=0;j<m;j++){
          d[j]+=a[i][j];
        }
      }
    }
    bool hantei=true;
    for(int j=0;j<m;j++){
      if(d[j]<x){
        hantei=false;
        break;
      }
    }
    if(hantei)kotae=min(kotae,sum);
  }
  if(kotae==INT_MAX)cout<<-1;
  else cout<<kotae<<endl;
  return 0;
}


Measured memory_bytes: 3544
n = int(input())
h = [int(i) for i in input().split()]

m = 0
streak = 0
for i in range(n-1):
    l, r = h[i], h[i+1]
    if r <= l:
        streak += 1
        m = max(m, streak)
    else:
        streak = 0
print(m)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
int main(){
    ll n,A[200001],ans=0;
    cin>>n;
    rep(i,n) cin>>A[i];
    rep(i,n) ans+=A[i]-i-1;
    cout<<ans<<"\n";
}


Measured memory_bytes: 3868
package main

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

const MOD = 1e9 + 7

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var N, M int
	fmt.Sscanf(scanner.Text(), "%d %d", &N, &M)

	facts := make(map[int]int)
	factoring(M, facts)

	ans := 1
	for _, p := range facts {
		ans = ans * comb(p+N-1, p) % MOD
	}
	fmt.Println(ans)
}

func comb(a, b int) int {
	if a < b {
		return comb(b, a)
	}
	prod := 1
	for i := 0; i < b; i++ {
		prod = prod * (a - i) % MOD
	}
	f := factorial(b)
	return prod * inverse(f) % MOD
}

func inverse(n int) int {
	return power(n, MOD-2)
}

func power(a, pow int) int {
	if pow == 1 {
		return a
	} else if pow%2 == 0 {
		rt := power(a, pow/2)
		return rt * rt % MOD
	} else {
		return a * power(a, pow-1) % MOD
	}
}

func factorial(n int) int {
	ret := 1
	for n >= 1 {
		ret = ret * n % MOD
		n--
	}
	return ret
}

func factoring(n int, facts map[int]int) {
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			facts[i]++
			n = n / i
		}
	}
	if n != 1 {
		facts[n]++
	}
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>

using namespace std;

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

  string ret = "";
  for (int i=0; i<n; i++)
    ret += "ACL";
  cout<<ret<<endl;

  return 0;
}


Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define mod 998244353
#define maxn 210
using namespace std;
struct point{
	int x,y;
	point(){}
	point(int x,int y):x(x),y(y){}
	point operator-(const point& p)const{return point(x-p.x,y-p.y);}
}p[maxn];
int n,vis[maxn];
int qpow(int a,int b){
	int ans=1,tmp=a;
	for(;b;b>>=1,tmp=1ll*tmp*tmp%mod)
		if(b&1)ans=1ll*ans*tmp%mod;
	return ans;
}
int cross(point A,point B){
	return A.x*B.y-A.y*B.x;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d%d",&p[i].x,&p[i].y);
	int ans=qpow(2,n);
	for(int i=1;i<=n;++i){
		for(int i=1;i<=n;++i)vis[i]=false;
		for(int j=i+1;j<=n;++j)if(!vis[j]){
			int sum=1;
			for(int k=1;k<i;++k)if(cross(p[k]-p[i],p[j]-p[i])==0)goto nxt;
			for(int k=1;k<=n;++k)if(k!=i&&cross(p[k]-p[i],p[j]-p[i])==0)vis[k]=true,sum++;
			ans=(ans-qpow(2,sum)+sum+1+mod)%mod;
//			printf("[(%d,%d)%d]\n",i,j,sum);
			nxt:;
		}
	}
	ans-=n+1;
	printf("%d",(ans%mod+mod)%mod);
}

Measured memory_bytes: 256
# include<iostream>
# include<cstring>
# include<cmath>
using namespace std;
int main ()
{
	
     int A,B,C,D;
     cin>>A>>B>>C>>D;
     
     int time = ceil(C*1.0/B)-1;
	 if(A-D*time<=0)
	 {
	 	 cout<<"No"<<endl;
	  } 
	  else
	  {
	  	  cout<<"Yes"<<endl;
	  }
	  
     
	
 } 

Measured memory_bytes: 3632
using System;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {

            int[] at = new int[4];
            int n = int.Parse(System.Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string a = System.Console.ReadLine();
                switch (a)
                {
                    case "AC":
                        at[0] += 1;
                        break;
                    case "TLE":
                        at[1] += 1;
                        break;
                    case "WA":
                        at[2] += 1;
                        break;
                    case "RE":
                        at[3] += 1;
                        break;
                }
              


            }
            string p = "AC x " + at[0];
            System.Console.WriteLine(p);
            p = "WA x " + at[2];
            System.Console.WriteLine(p);
            p = "TLE x " + at[1];
            System.Console.WriteLine(p);
            p = "RE x " + at[3];
            System.Console.WriteLine(p);
        }
    }
}

Measured memory_bytes: 30716
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n;
bool f[110][10][5];
int p[110][15];
bool s[10][5];

int solve(){
    cin >> n;
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= 5; ++j){
            for(int k = 1; k <= 2; ++k){
                cin >> f[i][j][k];
            }
        }
    }
    for(int i = 1; i <= n; ++i){
        for(int j = 0; j <= 10; ++j){
            cin >> p[i][j];
        }
    }
    int profit = -inf;
    for(int op = 1; op < (1 << 10); ++op){
        memset(s, 0, sizeof(s));
        for(int pow = 0; pow < 10; ++pow){
            // 0 - 1, 1
            // 1 - 1, 2
            // 2 - 2, 1
            // 3 - 2, 2
            // 4 - 3, 1
            // 5 - 3, 2
            s[pow / 2 + 1][pow % 2 + 1] = (op >> pow) & 1;
        }
        int cur = 0;
        for(int i = 1; i <= n; ++i){
            int sum = 0;
            for(int j = 1; j <= 5; ++j){
                for(int k = 1; k <= 2; ++k){
                    sum += (f[i][j][k] && s[j][k]);
                }
            }
            cur += p[i][sum];
        }
        profit = max(profit, cur);
    }
    return profit;
}

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

    cout << solve() << "\n";   
    
    return 0;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

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

    rep(i,1,n+1){
        int cnt=0;
        for(int a=1;a*a<=i;a++){
            for(int b=1;b*b<=i;b++){
                for(int c=1;c*c<=i;c++){
                    if(a*a+b*b+c*c+a*b+b*c+c*a>i)break;
                    if(a*a+b*b+c*c+a*b+b*c+c*a==i)cnt++;
                }
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 3460
S = list(map(int, input().split("/")))
if S[0] < 2019:
    print("Heisei")
elif S[0] > 2019:
    print("TBD")
else:
    if S[1] > 4:
        print("TBD")
    elif S[1] < 4:
        print("Heisei")
    else:
        print("Heisei")

Measured memory_bytes: 3060
n = list(input())

if len(n) % 2 == 0:
	for i in range(len(n)//2):
		if n[i] =="b":
			if n[-(i+1)] != "d":
				print("No")
				exit()
		elif n[i] == "p":
			if n[-(i+1)] != "q":
				print("No")
				exit()
		elif n[i] == "d":
			if n[-(i+1)] != "b":
				print("No")
				exit()
		elif n[i] == "q":
			if n[-(i+1)] != "p":
				print("No")
				exit()
	print("Yes")
else:
	print("No")

Measured memory_bytes: 4084
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
typedef vector<int> VI;
typedef vector<pr> VP;
typedef vector<string> VS;
typedef vector<vector<int>> VV;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
const int INF = 1e9;
int fast_pow(int x, int y, int p);


int n;
long double a[3000],dp[3001];

void solve() {
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];      

	for(int i=0;i<n;i++){
		if(i==0){
			dp[0]=1-a[i];
			dp[1]=a[i];
			continue;
		}
		long double b[3001]={0};
		for(int j=0;j<3000;j++){
			b[j]+=((1-a[i])*dp[j]);
			b[j+1]+=(a[i]*dp[j]);
		}
		for(int j=0;j<3000;j++){
			dp[j]=b[j];
		}
	}
	double ans = 0;
	for(int i = n/2+1;i<=n;i++){
		ans+=dp[i];
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
	
}

int32_t main() {

	IOS;
	int test = 1;
	// cin>>test;
	for (int i = 1; i <= test; i++) {
//        cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}
int fast_pow(int x, 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;
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int n;
    cin >> n;
    int s = 0;
    REP(i,n) {
        int l, r;
        cin >> l >> r;
        s += r - l + 1;
    }

    cout << s << endl;
}


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

#define MAX_D 60

using namespace std;

int main(void) {
	long long n;
	cin >> n;
	int digit[MAX_D];
	for(int i = 0;i < MAX_D;i++)digit[i] = 0;
	long long rg[MAX_D][2];
	rg[0][0] = 0;
	rg[0][1] = 1;
	for(int i = 1; i < MAX_D;i++) {
		rg[i][0] = min(rg[i-1][0],rg[i-1][0]+(long long)pow(-2,i));
		rg[i][1] = max(rg[i-1][1],rg[i-1][1]+(long long)pow(-2,i));
	}
	for(int i = MAX_D-1;i > 0;i--) {
		if(n > rg[i-1][1] || n < rg[i-1][0]) {
			digit[i] = 1;
			n = n - pow(-2,i);
		}
	}
	if(n == 1) digit[0] = 1;
	bool fzero = false;
	for(int i = MAX_D-1;i >= 0;i--) {
		if(digit[i] == 1) fzero = true;
		if(fzero) cout << digit[i];
	}
	if(!fzero) cout << 0;
	cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define int long long
using namespace std;
const int mod=1e9+7,__=2e5+10,_=2005;
int n,A[__],B[__],f[(_<<1)+5][(_<<1)+5];
int jc[__],inv[__];
inline int ksm(int x,int y){
    int res=1;
    while(y){
        if(y&1)res=res*x%mod;
        x=x*x%mod; y>>=1;
    }
    return res;
}
const int N=2e5;
inline void pre(){
    jc[0]=1; for(int i=1;i<=N;i++)jc[i]=jc[i-1]*i%mod;
    inv[N]=ksm(jc[N],mod-2);
    for(int i=N-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
inline int C(int x,int y){
    if(y>x)return 0;
    return jc[x]*inv[x-y]%mod*inv[y]%mod;
}
signed main(){
    cin>>n; pre();
    for(int i=1;i<=n;i++){
        scanf("%d%d",&A[i],&B[i]);
        f[_-A[i]][_-B[i]]++;
    }
    for(int i=1;i<=(_<<1);i++)
    for(int j=1;j<=(_<<1);j++){
        f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%mod;
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=(ans+f[_+A[i]][_+B[i]])%mod;
        ans=(ans-C(2*A[i]+2*B[i],2*A[i])+mod)%mod;
    }
    ans=(ans+mod)%mod;
    ans=ans*ksm(2,mod-2)%mod;
    cout<<ans<<endl;
}

Measured memory_bytes: 132480
#include <stdio.h>

int main(){

  int x,y;

  while(1){
    scanf("%d%d",&x,&y);
    if(x+y==0) break;

    if(x<y){
      printf("%d %d\n",x,y);
    }else printf("%d %d\n",y,x);
  }

  return 0;
}



Measured memory_bytes: 2668
#include <stdio.h>

int main (void)
{
    /* variables for main process */
    char A, B, C;

    /* support variables for main process */
    int retval_scanf;

    // STEP.01
    // read out the given integers
    retval_scanf = scanf("%d %d %d", &A, &B, &C);

    // STEP.02
    // determine if there exists an equilateral triangle whose sides have lengths A, B and C.
    if (A == B && B == C) { printf("%s\n", "Yes"); }
    else                  { printf("%s\n", "No" ); }
    
    // STEP.TRUE_END
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const long long inf2=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int dp[100001][101][3];
//dp[i][j]:number with j digits mod D=i;
int d;
string s;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>s>>d;
	//0:<s 1:==s 2:>s
	s=" "+s;
	dp[0][0][1]=1;
	for(int i=1;i<s.size();i++){
		for(int j=0;j<d;j++){
			for(int k=0;k<10;k++){
				dp[i][(j+k)%d][0]+=dp[i-1][j][0];
				dp[i][(j+k)%d][0]%=mod;
				if(k<s[i]-'0')dp[i][(j+k)%d][0]+=dp[i-1][j][1],dp[i][(j+k)%d][0]%=mod;
				else if(k==s[i]-'0')dp[i][(j+k)%d][1]+=dp[i-1][j][1],dp[i][(j+k)%d][1]%=mod;
				else dp[i][(j+k)%d][2]+=dp[i-1][j][1],dp[i-1][j][1]%=mod;
				dp[i][(j+k)%d][2]+=dp[i-1][j][2];
				dp[i][(j+k)%d][2]%=mod;
			}
		}
	}
	ll ans=0;
	ans+=dp[s.size()-1][0][0];ans+=dp[s.size()-1][0][1];ans%=mod;
	cout<<(ans+mod-1)%mod<<endl;
	return 0;
}

Measured memory_bytes: 12544
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n,l,r;
    cin >> n;
    int answer = 0;
    REP(i,n){
        cin >> l >> r;
        answer += r-l+1;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char f[11],g[21];
int n,a,i;
int main(void){
	for(
	scanf("%s",f),
	scanf("%d",&n);i<n;i++)
		scanf("%s",g),strncpy(g+10,g,10),a+=strstr(g,f)?1:0;
	printf("%d\n",a);
	return 0;
}

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

using namespace std;
using ll = long long;

vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i = 1LL; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            ll j = n / i;
            if(i != j)res.push_back(j);
        }
    }
    sort(res.begin(),res.end());
    reverse(res.begin(), res.end());
    res.pop_back();
    return res;
}

/***********debug tools***********/
template<class T> ostream& operator<<(ostream& os, const pair<T,T>& p){os << "{" << p.first << "," << p.second << "}";return os; }
template<class T> inline void print(pair<T,T> p){cerr << p << endl;}
template<class T> inline void print(vector<T> arr) {cerr << "["; for(int i = 0; i < (int)arr.size(); i++)cerr << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");cerr << endl;}
template<class T> inline void print(vector<vector<T>> arr) {cerr << "[-------------------" << endl; for(int i = 0; i < (int)arr.size(); i++) { print(arr[i]);} cerr << "-------------------]" << endl;}
/*********************************/

template<class T>
map<T,T> fact(T n){
    map<T,T> Map;
    for(T i = 2; i * i <= n; i++){
        while(n % i == 0){
            Map[i]++;
            n /= i;
        }
    }
    if(n == 1)return Map;
    Map[n]++;
    return Map;
}


int main()
{
    ll n; cin >> n;
    map<ll,ll> div = fact(n);

    ll cnt = 0;
    for(auto i : div) {
        int cur = 0;
        int ind = 1;
        while(i.second - ind >= 0) {
            i.second -= ind++;
            cur++;
        }
        cnt += cur;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n;
    while (cin >> n) {
        bool ok = false;
        fore(i,0,26) fore(j,0,15) {
            if (4*i + 7*j == n) {
                ok = true;
                break;
            }
        }
        if (ok) cout << "Yes\n";
        else cout << "No\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=200000+100;

ll n,m,q,t[maxn<<2],x,y,z;

ll low(ll x){
	return x&(-x);
}
ll query(ll x){
	ll res=0;
	for(;x>0;x-=low(x))res+=t[x];
	return res;
}
void updata(ll x,ll k){
	for(;x<=n;x+=low(x))t[x]+=k;
}

int main(){
	scanf("%lld%lld%lld",&n,&m,&q);
	memset(t,0,sizeof(t));
	for(int i=0;i<q;i++){
		scanf("%lld",&x);
		updata(x,1);
	}
	for(int i=1;i<=n;i++){
		int t=query(i)-query(i-1)+m-q;
		if(t<=0)printf("No\n");
		else printf("Yes\n");
	}
}

Measured memory_bytes: 6912
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

typedef pair<int, int> pii;

int main() {
    int n, m;
    cin >> n >> m;
    pii ba[m];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        ba[i] = pii(b, a);
    }
    sort(ba, ba+m);

    int lb = 0;
    int ans = 0;
    for (pii p : ba) {
        if (p.second > lb) {
            ans++;
            lb = p.first - 1;
        }
    }

    cout << ans << endl;

    return 0;
}

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

constexpr int N = 8;

int grid[8][8];
int row[N], col[N];
int dpos[2 * N - 1], dneg[2 * N - 1];

void Print(){
  for( int i = 0; i < N; i++ ){
    for( int j = 0; j < N; j++ ){
      if( grid[i][j] && row[i] != j ) return;
    }
  }

  for( int i = 0; i < N; i++ ){
    for( int j = 0; j < N; j++ ){
      if( row[i] == j ) cout << "Q";
      else cout << ".";
    }
    cout << endl;
  }  
}

void dfs( int i ){
  if( i == N ){
    return Print();
  }

  for( int j = 0; j < N; j++ ){
    // 0:OK, 1:NG
    if( col[j] || dpos[i + j] || dneg[i - j + ( N - 1 )] ){
      continue;
    }

    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + ( N - 1 )] = 1;
    dfs( i + 1 );
    col[j] = dpos[i + j] = dneg[i - j + ( N - 1 )] = 0;
  }
}

int main(){  
  int k; cin >> k;
  for( int i = 0; i < k; i++ ){
    int r, c; cin >> r >> c;
    grid[r][c] = 1;
  }

  dfs( 0 );
}



Measured memory_bytes: 3112
#include <bits/stdc++.h> 
using namespace std;
int main () {
  int n;
  cin >> n;
  int mas[n+1];
  int d = 0;
  for (int i = 1; i <= n ; i++ ) {
   
    cin >> mas[i]; } 
  for (int i =1; i <= n; i++) {
    if (mas[i] != i) {
    d++; } }
  if ( d > 2 ) {
    cout << "NO" ; }
  else {
    cout << "YES"; } }
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
ll beki(int n){
    ll x=1;
    rep(i,n)x=x*2%1000000007;
    return x;
}
int main(void){
    int n;cin>>n;vector<int>v(n);rep(i,n)cin>>v.at(i);sort(v.begin(),v.end());bool ans=true;
    if(n%2==0){
        rep(i,n/2){
            if(v.at(2*i)!=2*i+1||v.at(i*2+1)!=2*i+1)ans=false;
        }
        if(ans==false)cout<<0;
        else cout<<beki(n/2);
    }
    if(n%2==1){
        if(v.at(0)!=0)ans=false;
        rep(i,n/2){
            if(v.at(i*2+1)!=(i+1)*2||v.at(i*2+2)!=(i+1)*2)ans=false;
        }
        if(ans==false)cout<<0;
        else cout<<beki(n/2);
    }
}

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

int main(){
    int m1, m2, d1, d2;

    cin >> m1 >> d1 >> m2 >> d2;

    if(d1 == 28 &&  m1 == 2) cout << 1 << endl;
    else if(d1 == 30 && (m1 == 9 || m1 == 4 || m1 == 6 || m1 == 11)) cout << 1 << endl;
    else if(d1 == 31 && m1 != 2 && m1 != 9 && m1 != 4 && m1 != 6 && m1 != 11) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
ll MAX_V = 2e5 + 5;
vector<ll>dep(MAX_V,-1);
void dfs(ll k,ll d,vector<vector<ll>>&g){
  dep[k]=d;
  for(ll i=0;i<g[k].size();i++){
    if(dep[g[k][i]]==-1){
      dfs(g[k][i],d+1,g); 
    }
  }
}

vector<ll>dep2(MAX_V,-1);
void dfs2(ll k,ll d,vector<vector<ll>>&g){
  if(d>dep[k])return;
  dep2[k]=d;
  if(dep2[k]==dep[k])return;
  for(ll i=0;i<g[k].size();i++){
    if(dep2[g[k][i]]==-1){
      dfs2(g[k][i],d+1,g); 
    }
  }
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<vector<ll>>g(n);
  ll u,v;cin>>u>>v;u--;v--;
  rep(i,0,n-1){
    ll a,b;cin>>a>>b;a--;b--;
    g[a].PB(b);
    g[b].PB(a);
  }
  dfs(v,0,g);
  dfs2(u,0,g);
  //debug(dep,n);
  //debug(dep2,n);
  rep(i,0,n){
    if(dep2[i]!=-1)chmax(res,dep[i]-1);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int count = 1;
    rep1(i, n-1) {
        if(s[i] != s[i-1]) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  int b, f, r, v;
  
  vector<vector<int> > b1(3, vector<int>(10));
  vector<vector<int> > b2(3, vector<int>(10));
  vector<vector<int> > b3(3, vector<int>(10));
  vector<vector<int> > b4(3, vector<int>(10));
  
  for(int i = 0; i < N; i++){
    cin >> b >> f >> r >> v;
    if( b == 1 ) b1.at(f-1).at(r-1) += v;
    if( b == 2 ) b2.at(f-1).at(r-1) += v;
    if( b == 3 ) b3.at(f-1).at(r-1) += v;
    if( b == 4 ) b4.at(f-1).at(r-1) += v;
  }
  
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 10; j++){
      cout << " " << b1.at(i).at(j);
    }
    cout << endl;
  }
  cout << "####################" << endl;
  
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 10; j++){
      cout << " " << b2.at(i).at(j);
    }
    cout << endl;
  }
  cout << "####################" << endl;
 
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 10; j++){
      cout << " " << b3.at(i).at(j);
    }
    cout << endl;
  }
  cout << "####################" << endl;
  
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 10; j++){
      cout << " " << b4.at(i).at(j);
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3160
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;



int main(){
	string S;
	cin >> S;
	int cnt = 0;
	if (S.at(1) == 'S') {
		if (S.at(0) == 'R' || S.at(2) == 'R') cnt = 1;
	}
	else if (S.at(1) == 'R') {
		if (S.at(0) == 'R' && S.at(2) == 'R') cnt = 3;
		else if (S.at(0) == 'R' || S.at(2) == 'R') cnt = 2;
		else cnt = 1;
	}
	cout << cnt << endl;

}

Measured memory_bytes: 3620
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")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, usize, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};

fn main() {
    input!{
        n: usize,
        ss: [i32; n],
    }
    match ss.iter().filter(|&&s| s % 10 != 0).min() {
        Some(m) => {
            let s: i32 = ss.iter().sum();
            if s % 10 == 0 { println!("{}", s - m) }
            else { println!("{}", s) }
        },
        None => println!("0"),
    }
}


Measured memory_bytes: 4352
import collections

n=int(input())
s=[]
ans=[[0 for _ in range(26)]for _ in range(n)]
#print(ans)
z=0
s=[input() for _ in range(n)]
for i in range(n):
    z=0
    for j in range(97,123):
        ans[i][z]=s[i].count(chr(j))
        z+=1
    #print(ans[i])
    
count=[]
count2=51
ans2=[0]*26
for i in range(26):
    count2=51
    for j in range(n):
        count2=min(count2,ans[j][i])
    ans2[i]=count2

for i in range(26):
    for j in range(ans2[i]):
        print(chr(i+97),end="")


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

int main(){
  int h, n, tmp, total=0;
  cin >> h >> n;
  for(int i=0;i<n;i++){
    cin >> tmp;
    total += tmp;
  }
  if(h<=total){
    cout << "Yes" << endl;
  } else {
   cout << "No" << endl; 
  }
}

Measured memory_bytes: 3604