akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
using namespace std;
// using namespace atcoder;

ll f(ll b, ll n) {
    if (n < b) return n;
    return f(b, n / b) + (n % b);
}

void Main()
{
    ll n, s;
    cin >> n >> s;

    if (n == s) {
        put(n + 1) 
        return;
    }

    for (ll b = 2; b * b <= n; b++) {
        if (f(b, n) == s) {
            put(b);
            return;
        }
    }

    ll minB = 1e18;
    for (ll p = 1; p * p <= n; p++) {
        ll b = (n - s) / p + 1;
        if (b >= 2 && f(b, n) == s) {
            minB = min(minB, b);
//            put(b);
  //          return;
        }
    }

    if (minB != 1e18) {
        put(minB);
        return;
    }

    put(-1);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3612
use std::io::prelude::*;
use std::str::FromStr;
pub struct Scanner<R: Read>(R);
impl<R: Read> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self(reader)
    }
    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| (b as char).is_whitespace())
            .take_while(|&b| !(b as char).is_whitespace())
            .collect::<Vec<u8>>();
        unsafe { std::str::from_utf8_unchecked(token.as_slice()) }
            .parse()
            .ok()
            .expect("Can't parse it.")
    }
    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
fn main() {
    let (stdin, stdout) = (std::io::stdin(), std::io::stdout());
    let mut sc = Scanner::new(stdin.lock());
    let mut out = std::io::BufWriter::new(stdout.lock());
    solve(&mut sc, &mut out);
    out.flush().ok().unwrap();
}
fn solve(sc: &mut Scanner<std::io::StdinLock>, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let N: usize = sc.read();
    let mut A: Vec<i32> = sc.vec(N);
    A.sort();

    let mut ans: i32 = 0;
    for (i, a) in A.iter().rev().enumerate() {
        ans += a * if i & 1 == 0 { 1 } else { -1 };
    }
    println!("{}", ans);
}


Measured memory_bytes: 2096
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
s1 = input()
s2 = input()

r = 0
ans = 1

pre_is_x = True
while r < N:
    if r == 0:
        if s1[r] == s2[r]:
            # x
            ans *= 3
            r += 1
            pre_is_x = True
        else:
            # y
            ans *= 6
            r += 2
            pre_is_x = False
    # if pre_is_x == True:

    elif s1[r] == s2[r]:
        # x
        if pre_is_x == True:
            # from x
            ans *= 2
        else:
            # from y
            ans *= 1
        r += 1
        pre_is_x = True
    else:
        # y
        if pre_is_x == True:
            # from x
            ans *= 2
        else:
            # from y
            ans *= 3
        r += 2
        pre_is_x = False

print(ans % mod)



    # ここからが左以外


# exit()
# while r > N:
#     if s1[r] == s2[r]:
#         # ans *= 1
#         if r == 0:
#             ans *= 1
#         # r-1
#         # r += 1
#         if s1[r-1] == s2[r-1]:
#             ans *= 2
#         if s1[r-1] == s2[r-1]:
#             ans *= 1
#         r += 1

#     else:
#         s1[r] != s2[r]:
#         ans *= 2
#         r += 2
        

Measured memory_bytes: 5696
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream> 
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define eps 1e-18
#define maxn 200010
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll ans=1; for(;b;b>>=1){if(b&1)ans=ans*a%mod; a=a*a%mod;} return ans;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void swap(int &a,int &b){int tmp=a; a=b; b=tmp;}
using namespace std;
char s[maxn],t[maxn];
int x[30],y[30];
int n,m;
int main()
{
	scanf("%s",s); n=strlen(s);
	scanf("%s",t); m=strlen(t);
	if(n!=m){
		printf("No\n"); return 0;
	}
	for(int i=0;i<n;i++){
		 if(!x[s[i]-'a'])x[s[i]-'a']=t[i]-'a';
		 else if(x[s[i]-'a']!=t[i]-'a'){
		 	printf("No\n"); return 0;
		 }
		 if(!y[t[i]-'a'])y[t[i]-'a']=s[i]-'a';
		 else if(y[t[i]-'a']!=s[i]-'a'){
		 	printf("No\n"); return 0;
		 }
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val A = LongArray(N)
        val m = 10000
        for (x in 1..m) for (y in 1..m) {
            val n = x * x + y * y + x * y
            var z = 0
            do {
                z++
                val nn = n + z * z + y * z + z * x
                if (nn in 1..N) {
                    A[nn - 1]++
                }
            } while (nn < N)
        }
        for (i in 0 until N) {
            pw.println(A[i])
        }
    }
}


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

int combination(int n) {
    if ((n==1)||(n==0)) {
        return 0;
    }
    else {
        return combination(n-1) + n-1;
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << combination(n) + combination(m) << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    long long N, K;
    cin >> N >> K;

    vector<long long> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    vector<long long> b;
    for (int i = 0; i < N; i++) {
        long long sum = 0;
        for (int j = i; j < N; j++) {
            sum += a[j];
            b.push_back(sum);
        }
    }

    vector<long long> c = b;
    for (long long i = 50LL; i >= 0; i--) {
        int count = 0;
        for (long long j = 0; j < c.size(); j++) if (c[j] & (1LL << i))count++;
        if (count >= K) {
            vector<long long> d;
            for (long long j = 0; j < c.size(); j++) if (c[j] & (1LL << i)) d.push_back(c[j]);
            c = d;
        }
    }

    long long ans = 0;
    if (c.size() >= K) {
        ans = c[0];
        for (int i = 0; i < K; i++) ans &= c[i];
    }

    cout << ans << endl;

    return 0;
}











































































Measured memory_bytes: 10096
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >>a>>b>>c;
  b=abs(a-b),c=abs(a-c);
  if(b<c) cout <<"A\n";
  else cout <<"B\n";
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int N, M; cin >> N >> M;
  vector<int> X(M);
  rep(i, M) cin >> X[i];
  sort(X.begin(), X.end());
  vector<int> gap;
  rep(i, M-1) {
    gap.push_back(X[i+1]-X[i]);
  }
  sort(gap.begin(), gap.end());
  int ans = 0;
  for(int i=0; gap.size()>=N && i<=gap.size()-N; ++i) {
    ans += gap[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string weather;
    cin >> weather;
    if (weather=="Sunny")
    {
        cout << "Cloudy";
    }
    else if (weather=="Cloudy")
    {
        cout << "Rainy";
    }
    else
    {
        cout << "Sunny";
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
tate, yoko = 0, 0
i = 0
while i < n:
    if i < n - 3 and a[i] == a[i + 1] == a[i + 2] == a[i + 3]:
        tate = max(tate, a[i])
        yoko = max(yoko, a[i])
        i += 3
    elif i < n - 2 and a[i] == a[i + 1] == a[i + 2]:
        if tate > yoko:
            yoko = max(yoko, a[i])
        else:
            tate = max(tate, a[i])
        i += 2
    elif i < n - 1 and a[i] == a[i + 1]:
        if tate > yoko:
            yoko = max(yoko, a[i])
        else:
            tate = max(tate, a[i])
        i += 1
    i += 1
print(tate * yoko)

Measured memory_bytes: 14480
#include <iostream>
#include <bitset>
#include <string>

int main(void) {
    u_int n;
    std::string event;

    std::cin >> n;
    for (u_int i = 0; i < n; ++i) {
        std::bitset<4> runner;
        u_int out = 0, score = 0;

        do {
            std::cin >> event;
            if ("HIT" == event) {
                runner <<= 1;
                runner.set(0);
                if (runner[3] == 1) {
                    ++score;
                }
            } else if ("HOMERUN" == event) {
                score += runner.count() - runner[3] + 1;
                runner.reset();
            } else if ("OUT" == event) {
                ++out;
            }
        } while(out != 3);

        std::cout << score << std::endl;
    }

    return 0;
}

Measured memory_bytes: 1208
def Euclidean(a,b):
    if a>=b:
        x=a
        y=b
    else:
        x=b
        y=a
    n=0
    while y!=0:
        x=x%y
        x,y=y,x
        n+=1
    print(x,n)

while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    Euclidean(a,b)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b) cout<<c;
    else if(a==c) cout<<b;
    else cout<<a;
    cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s=="SUN"){
        cout<<7;
    }
    else if(s=="MON"){
        cout<<6;
    }
    else if(s=="TUE"){
        cout<<5;
    }
    else if(s=="WED"){
        cout<<4;
    }
    else if(s=="THU"){
        cout<<3;
    }
    else if(s=="FRI"){
        cout<<2;
    }
    else if(s=="SAT"){
        cout<<1;
    }
}

Measured memory_bytes: 384
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
dp=[0 for i in range(k+1)]

for i in range(k+1):
    if dp[i]==0:
        for j in a:
            if i+j<=k:
                dp[i+j]=1
if dp[k]==1:
    print("First")
else:
    print("Second")

Measured memory_bytes: 3864
require 'prime'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times {|i|yield(i)}                    end
def repl(st,en,n=1);       n*= -1 if st>en;st.step(en,n){|i|yield(i)} end

str = gc
ans = 0
rep str.size-1 do |i|
	ans += 1 if str[i+1] != str[i]
end

puts ans

Measured memory_bytes: 7420
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
using namespace std;

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int n,cnt = 1;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s,s+n);
  for (int i = 1; i < n; i++){
    if (s[i] != s[i-1]){
      cnt += 1;
    }
  }
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 9888
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

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

    char c;
    cin >> c;
    if (c >= 'A' && c <= 'Z') {
        cout << 'A';
    } else {
        cout << 'a';
    }

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
namespace {
  template <typename T> inline void read(T &x) {
    x = 0; T f = 1;char s = getchar();
    for(; !isdigit(s); s = getchar()) if(s == '-') f = -1;
    for(;  isdigit(s); s = getchar()) x = (x << 3) + (x << 1) + (s ^ 48);
    x *= f;
  }
}
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define _for(n,m,i) for (register int i = (n); i < (m); ++i)
#define _rep(n,m,i) for (register int i = (n); i <= (m); ++i)
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define lowbit(x) x & (-x)
#define pii pair<int,int>
#define fi first
#define se second
const int N = 2005;
int a[N];
int main() {
  int n; read(n);
  for(int i = 0; i < n; ++i) {
    read(a[i]);
  }
  sort(a, a+n);
  int res1, res2;
  LL ans = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      res1 = upper_bound(a, a+n, a[j]-a[i]) - a;
      res2 = lower_bound(a, a+n, a[j]+a[i]) - a;
      ans += res2 - res1;
      if(i >= res1 && i <= res2) ans--;
      if(j >= res1 && j <= res2) ans--;
    }
  }
  cout << max(ans/3, 0ll) << endl;
	return 0;
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::io::stdin;

fn main() {
    let (h, _) = {
        let line = read_vec::<i64>();
        (line[0], line[1])
    };
    let sum = read_vec::<i64>().iter().fold(0i64, |acc, x| acc + *x);
    let result = if (h - sum) > 0 { "No" } else { "Yes" };
    println!("{}", result)
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line.trim().split_whitespace().
        map(|x| x.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;

const long mod = 1000000007;
int n;
PP p[200000];
PP rot(PP p) {
  long x = p.first;
  long y = p.second;
  return PP(-y, x);
}

PP normalize(PP p) {
  long x = p.first;
  long y = p.second;
  long g = gcd(x, y);
  return PP(x / g, y / g);
}

PP def(PP p) {
  if (p == PP(0, 0)) return PP(0, 0);
  while (p.first < 0 || p.second <= 0) {
    p = rot(p);
  }
  return p;
}

long pow2(long n) {
  long a = 1;
  for (int i = 0; i < n; ++i) a = a * 2 % mod;
  return a;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> p[i].first >> p[i].second;
  for (int i = 0; i < n; ++i) {
    if (p[i] == PP(0, 0)) continue;
    p[i] = normalize(p[i]);
  }
  
  map<PP, int> mp;
  for (int i = 0; i < n; ++i) {
    ++mp[p[i]];
  }
  
  long ans = 1;
  set<PP> used;
  for (auto [k, cnt] : mp) {
    if (k == PP(0, 0)) continue;
    if (used.count(def(k))) continue;
    used.insert(def(k));
    
    int a = mp[k];
    int b = mp[rot(k)];
    int c = mp[rot(rot(k))];
    int d = mp[rot(rot(rot(k)))];
    
    long mul = (pow2(a + c) + pow2(b + d) + mod - 1) % mod;
    ans = ans * mul % mod;
  }
  
  cout << (ans + mp[PP(0, 0)] + mod - 1) % mod << endl;
}

Measured memory_bytes: 69040
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
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;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
const int INF = 100100100;
int main(){
    int h,n; cin>>h>>n;
    int a[n],b[n];
    rep(i,n) cin >> a[i] >> b[i];
    ll dp[n+1][30020];
    memset(dp,INF,sizeof(dp));
    dp[0][0]=0;
    rep(i,n){
        rep(j,30020){
            if(j-a[i]>=0){
               dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i]);
            }
            else dp[i+1][j]=dp[i][j];
        }
    }
    ll ans=INF;
    rep(j,30020) if(j>=h) ans=min(ans,dp[n][j]);
    rep(i,n+1){
        //rep(j,h+1) cout << dp[i][j] << " ";
        //cout << endl;
    }
    cout  << ans << endl;
}



Measured memory_bytes: 235008
let cnt = ref 0

let merge a l m r =
  let ni = m - l in
  let nj = r - m in
  let init_ary n p =
    Array.init (n + 1) (fun i -> if i = n then max_int else a.(p + i))
  in
  let ai = init_ary ni l in
  let aj = init_ary nj m in
  let rec doit i j k =
    if k < r then begin
      incr cnt;
      if ai.(i) <= aj.(j) then (a.(k) <- ai.(i); doit (i + 1) j (k + 1))
      else (a.(k) <- aj.(j); doit i (j + 1) (k + 1))
    end
  in
  doit 0 0 l

let rec merge_sort a l r =
  if (l + 1) < r then begin
    let m = (l + r) / 2 in
    merge_sort a l m;
    merge_sort a m r;
    merge a l m r
  end

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in 
  merge_sort a 0 n;
  Array.iteri (fun i e -> Printf.printf (if i = 0 then "%d" else " %d") e) a;
  print_newline ();
  Printf.printf "%d\n" !cnt

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
void solution() {
  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= x; i++) {
    if (i * 2 + (x - i) * 4 == y) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--) solution();
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (a); i < ((int)(b)); ++i)
#define rrep(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define sz(c) ((int)c.size())
#define all(c) c.begin(), c.end()

int paties[60];

int calc(int level, int l, int r, int X) {
    int m = (l + r - 1) / 2;
    
    if (level == 0) {
        return l < r;
    }

    if (X == l) {
        return 0;
    } else if (X == m) {
        return paties[level - 1] + 1;
    } else if (X == r - 1) {
        return paties[level - 1] * 2 + 1;
    } else if (m < X) {
        return paties[level - 1] + 1 + calc(level - 1, m + 1, r - 1, X);
    } else {
        assert(1 <= X && X < m);
        return calc(level - 1, l + 1, m, X);
    }
}

signed main() {
    int N, X;
    cin >> N >> X;
    X--;

    {
        int L = 1;
        for (int i = 0; i < 60; ++i) {
            paties[i] = L;
            L *= 2;
            L += 1;
        }
    }

    int L = 1;
    for (int i = 0; i < N; ++i) {
        L *= 2;
        L += 3;
    }
    cout << calc(N, 0, L, X) << endl;
}



Measured memory_bytes: 256
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    n = int(input())
    p_list = li()

    p_sort = sorted(p_list)
    diff = 0
    for p1, p2 in zip(p_list, p_sort):
        if p1 != p2:
            diff = diff + 1
    if diff <= 2:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 38256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>

#define ll long long int

using namespace std;

const int INF = (1<<30) - 1;

const string ascii = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

struct Rect{
    int t, b, l, r;
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int T; cin >> T;
    while(T--){
        int H, W; cin >> H >> W;
        vector<string> field(H);
        for(auto &s: field)
            cin >> s;
        
        vector<Rect> rects(ascii.size());
        for(auto &r: rects){
            r.t = -1; r.r = -1;
            r.b = H; r.l = W;
        }
        
        for(int h=0; h<H; h++){
            for(int w=0; w<W; w++) if(field[h][w] != '.'){
                int i = field[h][w] - 'A';
                Rect &r = rects[i];
                r.t = max(r.t, h);
                r.b = min(r.b, h);
                r.r = max(r.r, w);
                r.l = min(r.l, w);
            }
        }
        
        for(int t=0; t<ascii.size(); t++){
            for(char c: ascii){
                Rect r = rects[c-'A'];
                if(r.t == -1)
                    continue;
                
                bool flag = true;
                for(int h=r.b; h<=r.t; h++){
                    for(int w=r.l; w<=r.r; w++){
                        flag &= field[h][w]==c || field[h][w]=='@';
                    }
                }
                if(flag)
                    for(int h=r.b; h<=r.t; h++)
                        for(int w=r.l; w<=r.r; w++)
                            field[h][w] = '@';
            }
        }
        bool safe = true;
        for(auto r: field)
            for(auto c: r)
                safe &= c=='.' || c=='@';
        
        cout << (safe ? "SAFE" : "SUSPICIOUS") << endl;
    
    }
    return 0;
}

Measured memory_bytes: 1224
n=int(input())
b,c=map(int,input().split())
a=[]
ans=0
for i in range(n):
    a.append(int(input()))
for k in range(n):
    for j in range(1000):
        if 1+a[k]*j<=b:
            ans+=1
        else:
            break
print(ans+c)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
const long long mod = 1e9+7;

int main() {
  int n, m; cin >> n >> m;
  vector<int> broken(n+1);
  rep(i, m) {
    int a; cin >> a;
    broken[a] = 1;
  }
  vector<int> dp(n+2);
  dp[n] = 1;
  for (int i = n-1; i >= 0; --i) {
    if (broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % mod;
  }
  
  cout << dp[0] << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>

int N, Ans;

int SG(int a, int k) {
	if (a < k) return 0;
	if (a % k == 0) return a / k;
	int val = a / k + 1;
	return SG(a - (a - a / k * (k - 1)) / val * val, k);
}

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) {
		int a, k;
		scanf("%d%d", &a, &k);
		Ans ^= SG(a, k);
	}
	puts(Ans ? "Takahashi" : "Aoki");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6+7;
const int maxm = 2e6+7;
const ll mod = 1e9+7;
int n,m;
int ar[maxn];
int main()
{ 
    scanf("%d", &n);
    for(int i=0;i<n;i++)scanf("%d", ar+i);
    int ans=0;
    for(int i=1;i<n-1;i++){
        if((ar[i]>ar[i-1] && ar[i]<ar[i+1]) || (ar[i]<ar[i-1] && ar[i]>ar[i+1]))ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
grid = [list(input()) for _ in range(h)]

#四方向の移動用
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


def bfs(sx, sy):
    d = [[-1]*w for i in range(h)]
    que = deque([])
    que.append((sx, sy))
    d[sy][sx] = 0

    while que:
        p = que.popleft()

        for i in range(4):
            nx = p[0]+dx[i]
            ny = p[1]+dy[i]

            if (0 <= nx < w) and (0 <= ny < h) and (grid[ny][nx] != "#") and (d[ny][nx] == -1):
                que.append((nx, ny))
                d[ny][nx] = d[p[1]][p[0]] + 1

    return max(sum(d, []))


ans = 0
for sy in range(h):
    for sx in range(w):
        if grid[sy][sx] != "#":
            temp = bfs(sx, sy)
            if ans < temp:
                ans = temp
print(ans)


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

int main(){
    string s;
    cin >> s;
    if(s.compare("2019/04/30") <= 0){
        cout << "Heisei" << endl;
    }
    else {
        cout << "TBD" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define NMAX 100000
#define INF 1e+6
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
string s;
int main(){
  scan(s);
  int cnt=0;
  int n=s.size();
  rep(i,n){
    if(s[i]=='0'){
      cnt++;
    }
  }
  prin(2*min(cnt,n-cnt));

  

  
  return 0;
}


Measured memory_bytes: 512
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

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

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var a = nexts(n);
  var b = xArray(0,1e6+1);
  var f = 1;
  for(var i = 0; i < n && f; i++){
    var t = a[i];
    for(var j = 2; j*j <= t; j++){
      if(t%j === 0){
        if(b[j]){
          f = 0;
          break;
        }
        b[j] = 1;
        while(t%j === 0)t /= j;
      }
    }
    if(t > 1){
      if(b[t]){
        f = 0;
      }else{
        b[t] = 1;
      }
    }
  }
  if(f)return "pairwise coprime";
  t = a[0];
  for(var i = 1; i < n; i++){
    t = gcd(t,a[i]);
    if(t === 1)return "setwise coprime";
  }
  return "not coprime";
}

Measured memory_bytes: 146092
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef vector<int> ivec;
typedef vector<string> svec;

int a[100010];
int main(){
	int n,m;
	int a[10010];
	cin>>n>>m;	
	int ans=n;
	for(int i=0;i<m;i++)cin>>a[i];
	for(int i=0;i<m;i++)ans-=a[i];
	if(ans>=0)cout<<ans<<endl;
	else cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 3636
def main():
    n = int(input())
    a = [input() for _ in [0]*n]
    b = []
    for i in a:
        j = i.find(".")
        if j == -1:
            b.append(int(i)*10**9)
        else:
            k = 10-len(i)+j
            i = i.replace(".", "")
            b.append(int(i)*10**k)
    d = dict()
    for i in b:
        cnt_a = 0
        while(True):
            if i % 2 != 0:
                break
            cnt_a += 1
            i //= 2
        cnt_b = 0
        while(True):
            if i % 5 != 0:
                break
            cnt_b += 1
            i //= 5
        if (cnt_a, cnt_b) in d:
            d[(cnt_a, cnt_b)] += 1
        else:
            d[(cnt_a, cnt_b)] = 1
    ans = 0
    for i in range(50):
        for j in range(20):
            if (i, j) not in d:
                continue
            temp1 = d[(i, j)]
            for k in range(50):
                for l in range(20):
                    if (k, l) not in d:
                        continue
                    temp2 = d[(k, l)]
                    if i+k >= 18 and j+l >= 18:
                        if i == k and j == l:
                            ans += temp1*(temp2-1)
                        else:
                            ans += temp1*temp2

    print(ans//2)


main()


Measured memory_bytes: 34692
#include<iostream>
using namespace std;
int main()
{
    int A, B, n, ans = 0;
    cin >> A >> B;
    n = 1;
    if(B == 1){
        cout << 0 << endl;
        return 0;
    }
    while(n < B){
        n-=1;
        n += A;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main (){
	int N,T;
	cin >> N >> T;
	int t_over_counter=0;
	int min_c = 1001;
	for(int i=1; i<=N; ++i) {
		int c, t;
		cin >> c >> t;
		if (t <= T) {
			min_c = min(min_c, c);
		} else {
			t_over_counter++;
		}
	}
	if (t_over_counter == N) {
		cout << "TLE" << endl;
	} else {
		cout << min_c << endl;
	}
	return 0;
}



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

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"--------------------------"<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e18;
#define PI 3.14159265
 
const ll N = 100005;

void solve(){
	ll n;
	cin >> n;
	ll a = 0;
	Vpll A, B;
	rep(i,0,n){
		ll k, l, r;
		cin >> k >> l >> r;
		if(l > r){
			a += r;
			A.pb({k, l-r});
		}
		else if(r > l){
			a += l;
			B.pb({n-k, r-l});
		}
		else{
			a += l;
		}
	}	
	sort(allr(A));
	sort(allr(B));
	priority_queue<ll> pq;
	ll cur = 0, pnt = 0;
	repb(i,n,1){
		while(cur < A.size() and A[cur].ft >= i){
			pq.push(A[cur].sd);
			cur++;
		}
		if(pq.empty())	continue;
		a += pq.top();
		pq.pop();
	}
	while(!pq.empty())	pq.pop();
	cur = 0;
	repb(i,n,1){
		while(cur < B.size() and B[cur].ft >= i){
			pq.push(B[cur].sd);
			cur++;
		}
		if(pq.empty())	continue;
		a += pq.top();
		pq.pop();
	}
	cout << a << endl;
	return;
}

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

Measured memory_bytes: 6696
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vb vector<bool>
#define mod 1000000007
#define pii pair<int,int>
const int inf = 0x3f3f3f3f3f3f3f3f;
int32_t main(){
    
    int a , b, m;
    cin >> a >>  b >> m;
    
    int i , ans = inf ,  x , y , c;
    
    vi A(a);
    vi B(b);
    
    for(i=0 ; i <a ; i++)        cin >> A[i];
    
    for(i=0 ; i <b ; i++)        cin >> B[i];
    
    for(i=0 ; i <m ; i++)
    {
        
        cin >> x;
        cin >> y;
        cin >> c;
        
        ans = min(ans , A[x-1] + B[y-1] - c);
        
    }
    
    int f = *min_element(A.begin(), A.end())  +  *min_element(B.begin(), B.end());
    
    ans = min(ans, f);
    
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int N,M;
    cin >> N >> M;
    if(N<=1){
        cout << (M*(M-1))/2 << endl;
    }else if(M<=1){
        cout << (N*(N-1))/2 << endl;
    }else{
        cout <<(N*(N-1))/2+(M*(M-1))/2 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int L,R,d;
int ans=0;
int main(){
    cin>>L>>R>>d;
    for(int i=L;i<=R;++i){
        if(i%d==0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
N, Ma, Mb = gets.split.map(&:to_i)
M, C = [], []
readlines.each{|l| a, b, c = l.split.map(&:to_i); M << a*Mb - b*Ma; C << c}
INF = 1 << 30

def go(h, n)
  return h if n == N
  h1 = h.dup
  h1[M[n]] = [h[M[n]], C[n]].min
  h.each{|k, v| h1[k + M[n]] = [h[k + M[n]], v + C[n]].min unless k == 0}
  go(h1, n + 1)
end

h = go(Hash.new(INF), 0)
puts h[0] == INF ? '-1' : h[0]


Measured memory_bytes: 4476
import sys
input = sys.stdin.readline

mod = 998244353
N = int(input())
X = []
for _ in range(N):
    x, d = map(int, input().split())
    X.append((x, x + d))

X = sorted(X, key = lambda x: x[0])
L = [(0, -(10**9+1), 10**9+1)]
P = [-1] * (N+1)
for i, (x, y) in enumerate(X):
    while L[-1][2] <= y:
        if L[-1][2] > x and P[i+1] < 0:
            P[i+1] = L[-1][0]
        L.pop()
    if P[i+1] < 0:
        P[i+1] = L[-1][0]
    L.append((i+1, x, y))

C = [[] for _ in range(N+1)]
for i, p in enumerate(P):
    if p >= 0:
        C[p].append(i)

Y = [1] * (N+1)
for i in range(N+1)[::-1]:
    s = 1
    for j in C[i]:
        s = s * (Y[j] + 1) % mod
    Y[i] = s

print(Y[0])

Measured memory_bytes: 75764
while True:
    table = input().split()
    
    a = int(table[0])
    op = table[1]
    b = int(table[2])
    
    if op == "?":
        break
    
    if op == "+":
        print("%d"%(a+b))
    elif op == "-":
        print("%d"%(a-b))
    elif op == "*":
        print("%d"%(a*b))
    else:
        print("%d"%(a/b))


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

typedef pair<int,int> pii;
typedef vector<int> vec;
typedef unordered_map<int,int> hash;
#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,v) memset(a,v,sizeof(a))
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast
#define MOD 1000000007


int main()
{
	JJ;
	int n; cin>>n;
	int arr[n+1];
	FOR(i,1,n+1)
	cin>>arr[i];
	int ans=0;
	FOR(i,1,n+1){
		if(i%2==1 && arr[i]%2==1)
			ans++;
	}
	cout<<ans<<endl;
	


	return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

#define MAX 100
#define PMAX 21

int table[PMAX][PMAX];
void initary()
{
	for ( int i = 0 ; i < PMAX ; i++ ) {
		for ( int j = 0 ; j < PMAX ; j++ ) {
			table[i][j] = 0;
		}
		table[i][PMAX-1] = 1;
	}
}

int main()
{
	int m = 0, n = 0, i = 0, j = 0;
	int f = 0, s = 0, sum = 0, checked = 0;
	int ansq[PMAX];

	initary();
	scanf( "%d", &m );
	scanf( "%d", &n );

	for ( i = 0 ; i < n ; i++ ) {
		scanf( "%d %d\n", &f, &s );
		table[s-1][f-1] = 1;
	}

	while ( checked < m ) {
		for ( i = 0 ; i < m ; i++ ) {
			sum = 0;
			if ( table[i][PMAX-1] == 1 ) { 
				for ( j = 0 ; j < m ; j++ ) {
					sum += table[i][j];
				}

				if ( sum == 0 ) {
					table[i][PMAX-1] = 0;
					ansq[checked] = i+1;
					checked++;
				}
			} else if ( table[i][PMAX-1] == 0 ) { 
				continue; 
			}
		}

		for ( i = 0 ; i < m ; i++ ) {
			for ( j = 0 ; j < checked ; j++ ) {
				table[i][ansq[j]-1] = 0;
			}
		}
	}

	for ( i = 0 ; i < m ; i++ ) {
		printf( "%d\n", ansq[i] );
	}

	return 0;
}



Measured memory_bytes: 2108
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    REP(i, n){
        cin >> s[i];
    }
    sort(ALL(s));
    REP(i, n){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

// Verified: AOJ2644 Longest Match
// checked but not verified: sum_query
enum query_type { min_query, max_query, sum_query };

template<class T> struct segtree {
  int N;
  vector<T> dat, sum;
  function<T(T, T)> func;
  T ngvalue;

  void init(int n, function<T(T, T)> const& f, T ng) {
    N = 1;
    while(N < n) N <<= 1;
    dat.assign(2 * N - 1, 0);
    sum.assign(2 * N - 1, 0);
    func = f;
    ngvalue = ng;
  }

  segtree() = default;

  segtree(int n, query_type qtype) {
    if(qtype == min_query) {
      init(n, [](T a, T b){return min(a, b);}, numeric_limits<T>::max());
    }
    else if(qtype == max_query) {
      init(n, [](T a, T b){return max(a, b);}, numeric_limits<T>::min());
    }
    else if(qtype == sum_query) {
      init(n, [](T a, T b){return a + b;}, 0);
    }
    else {
      runtime_error("no matching query type");
    }
  }

  void add(int i, T x) {
    add(i, i + 1, x);
  }

  void add(int a, int b, T x) {
    add(a, b, x, 0, 0, N);
  }

  T add(int a, int b, T x, int k, int l, int r) {
    if(b <= l || r <= a) return dat[k];
    if(a <= l && r <= b) {
      sum[k] += x;
      return dat[k] += x;
    }
    int m = (l + r) / 2;
    return dat[k] = func(add(a, b, x, 2 * k + 1, l, m), add(a, b, x, 2 * k + 2, m, r)) + sum[k];
  }

  T operator()(int a, int b) {
    return query(a, b, 0, 0, N);
  }

  T query(int a, int b, int k, int l, int r) {
    if(b <= l || r <= a) return ngvalue;
    if(a <= l && r <= b) return dat[k];
    int m = (l + r) / 2;
    return func(query(a, b, 2 * k + 1, l, m), query(a, b, 2 * k + 2, m, r)) + sum[k];
  }
};

segtree<int> counts[128];

int main() {
  int N; cin >> N;
  string S; cin >> S;
  REP(c, 'a', 'z' + 1) counts[c] = segtree<int>(N, sum_query);
  rep(i, N) counts[S[i]].add(i, 1);
  int Q; cin >> Q;
  while (Q--) {
    int type; cin >> type;
    if (type == 1) {
      int i; char c; cin >> i >> c;
      i--;
      counts[S[i]].add(i, -1);
      S[i] = c;
      counts[S[i]].add(i, 1);
    }
    else {
      int l, r; cin >> l >> r;
      l--;
      int char_counts = 0;
      REP(c, 'a', 'z' + 1) char_counts += counts[c](l, r) > 0;
      cout << char_counts << "\n";
    }
  }
}


Measured memory_bytes: 214148
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn=1e5+5;
int main()
{
    int n,summ=0;
    cin>>n;
    for(int i=1;i<=n;i+=2)
    {
        int sum=0;
        for(int j=1;j<=i;j++)
            if(i%j==0)
                sum++;
        if(sum==8)
            summ++;
    }
    cout<<summ<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma region Include/Defines
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <queue>
#include <time.h>

using namespace std;
typedef long long lli;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<pii> vpii;
typedef vector <pll> vpll;
typedef long double ld;
#define all(a) std::begin(a), std::end(a)

const int INF = 0x3f3f3f3f;
const lli LINF = 0x3f3f3f3f3f3f3f3f;

template<typename T, typename T2> inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }
template<typename T, typename T2> inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }

#ifdef _DEBUG
#define epr(...) fprintf(stderr,__VA_ARGS__)
#else
#define epr(...) 
#endif
#pragma endregion

const int MAX = 110;
int n, x, a[MAX];

void clear() {
}

void read() {
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(a, a + n);
}

void solve() {
	int res = 0;
	for (int i = 0; i < n; i++) {
		int t = min(x, a[i]);
		res += t == a[i];
		x -= t;
	}
	if (x) res--;
	printf("%d\n", res);
}

int main() {
#ifdef _LOCAL_VAN
	freopen("in.txt", "r", stdin);
#endif
	while (scanf("%d%d", &n, &x) == 2) {
		clear();
		read();
		solve();
#ifndef _LOCAL_VAN
		return 0;
#endif
	}
	return 0;
}

Measured memory_bytes: 256