akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//monoid,結合律が成り立ち,単位元が存在するものに対しての演算をクエリに対してO(logn)で
//1-indexed  n(親)->2n,2n+1(子)  k(子)->k/2(親)
template<typename Monoid>
struct SegmentTree{
    using F = function< Monoid(Monoid, Monoid) >;
    //sz:size->完全二分木なのでszはnよりも大きい最小の2のべき乗数
    int sz;
    vector<Monoid> seg;
 
    const F f;
    const Monoid M1;
    SegmentTree(int n,const F f,const Monoid &M1) : f(f), M1(M1) {

    sz=1;
    while(sz<n) sz<<=1;
    seg.assign(2*sz, M1);
    }
 
    void set(int k, const Monoid &x){
        seg[k+sz] = x;
    }
 
    void build(){
        for(int k=sz-1;k>0;k--){
        seg[k]=f(seg[2*k+0], seg[2*k+1]);
        }
    }
 
    void update(int k,const Monoid &x){
        k+=sz;
        seg[k]=x;
        
    while(k>>=1){
        seg[k]=f(seg[2*k+0],seg[2*k+1]);
        }
    }
    //query聞くときは区間は[a,b)で(a<=x<b)
    Monoid query(int a, int b) {
        Monoid L=M1,R=M1;
        for(a+=sz,b+=sz;a<b;a>>=1,b>>=1){
            if(a&1) L=f(L, seg[a++]);
            if(b&1) R=f(seg[--b], R);
        }
        return f(L,R);
    }   
    Monoid operator[](const int &k) const{
        return seg[k+sz];
    }
};
ll f(ll a,ll b){if(a>b) return a;else return b;}


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

    int n;cin>>n;
    ll h[n],a[n];
    rep(i,n) cin>>h[i];
    rep(i,n) cin>>a[i];

    SegmentTree<ll> seg(n+1,f,0);
    seg.build();
    rep(i,n){
        ll mx=seg.query(0,h[i]);
        seg.update(h[i],mx+a[i]);
    }
    ll ans=0;
    rep(i,n+1) chmax(ans,seg[i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 7552
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)]
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    for(int t = 1; t <= T; t++){
        int d,t1,s;
        cin >> d >> t1 >> s;
        cout << (d <= (t1 * s) ? "Yes\n" : "No\n");
    }
}


Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
      
      
namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            List<int> b = new List<int>();
            List<int> c = new List<int>();
            List<int> d = new List<int>();
            for(int i=0;i<100;i++)b.Add(0);
            while((line=Console.ReadLine())!=null)
            {
                int a = int.Parse(line);
                b[a-1]++;
            }
                for(int e=0;e<b.Count;e++)
                    c.Add(b[e]);
                b.Sort();
                b.Reverse();
                for(int f=0;f<b.Count;f++)
                {
                    if(c[f]==b[0])
                    d.Add(f+1);
                 }
                 for(int r=0;r<d.Count;r++)Console.WriteLine(d[r]);
    
    }
  }
}

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

#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    vector<int> cnt(n);
    for (int x : a) cnt[x]++;
    
    long s = 0;
    for (int i = 0; i < n; i++) {
        s += (long)cnt[i] * (cnt[i] - 1) / 2;
    }
    
    for (int i = 0; i < n; i++) {
        cout << s - (cnt[a[i]] - 1) << "\n";
    }
    

    return 0;
}

Measured memory_bytes: 4224
//
//  main.swift
//  AtCoderSwift
//
//  Created by burita083 on 2020/08/25.
//  Copyright © 2020 burita083. All rights reserved.
//

import Foundation
func readInt() -> Int {
    return Int(readLine()!)!
}
 
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
 
func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func abc080_b() {
    let N = readLine()!
    let sum = N.map { Int(String($0))! }.reduce(0, +)
    print(Int(N)! % sum == 0 ? "Yes" : "No")
}

//abc080_b()

func abc078_b() {
    let input = readInts()
    var X = input[0]
    let Y = input[1]
    let Z = input[2]
    var ans = 0
    X -= Y+Z*2
    ans += 1
    ans += X/(Y+Z)
    
    print(ans)
}

func abc085_b() {
    let N = readInt()
    var l: [Int] = []
    for _ in 0..<N {
        let d = readInt()
        l.append(d)
    }
    print(l.reduce([], { $0.contains($1) ? $0 : $0 + [$1] }).count)
}

func isSquare(n: Double) -> Bool {
    let sqrt = floor(n.squareRoot())
    return sqrt * sqrt == n
}

func abc077_b() {
    let N = readInt()
    for n in (1...N).reversed() {
        if isSquare(n: Double(n)) {
            print(n)
            return
        }
    }
}

abc077_b()



Measured memory_bytes: 13096
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 

const long long INF=1LL<<60;

int main(){

	int n,m;
	cin>>n>>m;

	vector<int> a(m),b(m);
	vector<long long> c(m);
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--,b[i]--;
	}

	vector<long long> d(n,-INF);
	d[0]=0;

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			d[b[j]]=max(d[b[j]],d[a[j]]+c[j]);
		}
	}

	long long dd=d[n-1];
	for(int j=0;j<m;j++){
		d[b[j]]=max(d[b[j]],d[a[j]]+c[j]);
	}	

	if(dd!=d[n-1]) cout<<"inf"<<endl;
	else cout<<dd<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1LL << 50;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
 
struct edge{
    int from, to; ll cost;
};

int main(){
    string s;
    cin >> s;
    cout << "2018";
    FOR(i, 4, 10){
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int binarySearch(int);

int n,*S;

int main()
{
  int q,i,x,c = 0;
  int *T;

  scanf("%d",&n);
  S = (int *)malloc(sizeof(int) * n);
  if(S == NULL) exit(1);
  for(i = 0;i < n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  T = (int *)malloc(sizeof(int) * q);
  if(T == NULL) exit(1);
  for(i = 0;i < q;i++){
    scanf("%d",&T[i]);
    }

   for(i = 0;i < q;i++){
    x = binarySearch(T[i]);
    if(x != -1) c ++;
   }
   printf("%d\n",c);
   return 0;
}

int binarySearch(int key)
{
  int left = 0;
  int right = n;
  int mid;

  while(left < right){
    mid = (left + right)/2;

    if(S[mid] == key) return mid;
    else if(key < S[mid]) right = mid;
    else left = mid + 1;
  }
  return -1;
}

Measured memory_bytes: 1188
/*
    ABC-160
    Quarantine_Day : 6
*/
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int       lint;
typedef vector<int>         vi;
typedef vector<lint>        vl;
typedef pair<int, int>      pii;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<lint>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define M               10000000
#define MOD             10000007
#define INF             1e9+7
#define REP(i,a,b)      for(int i = int(a); i <= int(b); i++)
#define REPL(i,a,b)     for(lint i = lint(a); i <= lint(b); i++)
#define fastIO()        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
    string s;
    cin>>s;

    if(s[2] == s[3] && s[4] == s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
using namespace std;
 
int main()
{
  string s;
  getline(cin,s);
  int l = s.length();
  for(int i=0; i<l; i++){
    if(islower(s[i])) cout << (char)toupper(s[i]);
    else if(isupper(s[i])) cout << (char)tolower(s[i]);
    else cout << s[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

vector<complex<double>> fft(vector<complex<double>> a, bool inverse = false) {
    ll n = a.size();
    ll h = 0;
    for (ll i = 0; 1 << i < n; i++) {
        h++;
    }

    Rep (i, n) {
        ll j = 0;
        Rep (k, h) {
            j |= (i >> k & 1) << (h - 1 - k);
        }
        if (i < j) swap(a[i], a[j]);
    }

    for (ll b = 1; b < n; b *= 2) {
        Rep (j, b) {
            complex<double> w = polar(1.0, (2 * M_PI) / (2 * b) * j * (inverse ? 1 : -1));
        
            for (ll k = 0; k < n; k += b * 2) {
                complex<double> s = a[j+k], t = a[j+k+b] * w;
                a[j+k] = s + t;
                a[j+k+b] = s - t;
            }
        }
    }

    if (inverse) Rep (i, n) a[i] /= n;

    return a;
}

vector<complex<double>> fft(vector<double> a, bool inverse = false) {
    vector<complex<double>> a_complex(a.size());
    Rep (i, a.size()) a_complex[i] = complex<double>(a[i], 0);
    return fft(a_complex, inverse);
}

vector<double> convolve(vector<double> a, vector<double> b) {
    ll s = a.size() + b.size() - 1;
    ll t = 1;
    while (t < s) t *= 2;
    a.resize(t); b.resize(t);
    vector<complex<double>> A = fft(a);
    vector<complex<double>> B = fft(b);
    Rep (i, t) {
        A[i] *= B[i];
    }

    A = fft(A, true);
    a.resize(s);
    Rep (i, s) a[i] = A[i].real();
    return a;
}

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

    ll N, M;
    cin >> N >> M;
    vector<double> A(2e5+10, 0);
    Rep (i, N) {
        ll a;
        cin >> a;
        A[a]++;
    }

    A = convolve(A, A);

    ll ans = 0;
    for (ll i = 2e5; i >= 0; i--) {
        ll e = A[i] + 0.5;
        if (e <= M) {
            ans += e * i;
            M -= e;
        } else {
            ans += M * i;
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 38720
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;

int main()
{
    ll q, h, s, d;
    cin >> q >> h >> s >> d;
    ll n;
    cin >> n;

    vector<pii> cost_num;
    cost_num.emplace_back(q*8, 0);
    cost_num.emplace_back(h*4, 1);
    cost_num.emplace_back(s*2, 2);
    cost_num.emplace_back(d, 3);

    sort(cost_num.begin(), cost_num.end());
    
    ll ans;
    if (cost_num[0].second == 3)
    {
        if (n % 2 == 0)
            ans = n / 2 * d;
        else
            ans = n / 2 * d + cost_num[1].first/2;
    }
    else 
        ans = cost_num[0].first / 2 * n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7

counter = Hash.new(0)

A.each do |a|
  counter[a] += 1
end

f = counter.keys.sort.each_cons(2).all? { |a, b| b - a == 2 }

if counter.all? { |k, v| k.odd? && v == 2 } && f
  puts (2 ** counter.keys.size) % MOD
elsif (counter[0] == 1) && counter.all? { |k, v| k.zero? || k.even? && v == 2 } && f
  puts (2 ** (counter.keys.size - 1)) % MOD
else
  puts 0
end


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000001
//A=65,a=97

int main() {
    int k,t;cin >> k >> t;
    vector<int> a(t);for(int i=0;i<t;i++) cin >> a[i];
    sort(a.begin(),a.end());
    if(a[t-1]<=(k+1)/2){
        cout << 0 << endl;
        return 0;
    }

    a[t-1] -= k-a[t-1];
    cout << a[t-1]-1 << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
int main(){
	double n;
	double k;
	scanf("%lf%lf",&n,&k);
	double ans=0;
	double ni[20]={};
	ni[0]=1;
	for(int i=1;i<20;i++){
		ni[i]=ni[i-1]*2;
	}
	
	for(double i=1;i<=n;i+=1){
		if(i>=k)ans++;
		else{
			for(int j=0;j<100;j++){
				if(ni[j]<k/i && k/i<=ni[j+1]){
					ans=ans+(1/ni[j+1]);
					break;
				}
			}
		}
	}
	ans=ans/n;
	printf("%.15lf",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int INF=1<<29;

int main(){
    ios::sync_with_stdio(false);
	string s;
	cin>>s;
	for(int i=0;i<4;i++) cout<<s[i];
	cout<<" ";
	for(int i=4;i<12;i++) cout<<s[i];
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
def score(li):
    li.remove(max(li))
    li.remove(min(li))
    return int(sum(li) / (len(li)))

while 1:
    n = int(input())
    if n == 0: # ???????????¶
        break
    s = [int(input()) for i in range(n)]
    print(score(s))

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

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

	int a[n], b[n], c[n];
	int pd[n][3];

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];		
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			pd[i][j] = 0;
	pd[0][0] = a[0];
	pd[0][1] = b[0];
	pd[0][2] = c[0];

	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			int v;
			if (j == 0)
				v = a[i];
			else if (j == 1)
				v = b[i];
			else
				v = c[i];
			for (int k = 0; k < 3; k++)
				if (j != k)
					pd[i][j] = max(pd[i][j], pd[i - 1][k] + v);
		}
	}

	int r = -1;
	for (int i = 0; i < 3; i++)
		r = max(r, pd[n - 1][i]);
	cout << r << endl;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << P + Q + R - max({P, Q, R}) << '\n';
    return 0;
}

Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
void solve(); int main() { solve(); return 0; }

void solve() {
  ll n, q;
  cin >> n;
  map<ll, ll> M;
  ll total = 0;
  loop(i,0,n) {
    ll a; cin >> a;
    M[a]++;
    total += a;
  }
  cin >> q;
  loop(i,0,q) {
    ll b, c;
    cin >> b >> c;
    if (M.count(b)) {
      ll cnt = M[b];
      M[b] = 0;
      M[c] += cnt;
      
      total -= cnt * b;
      total += cnt * c;
      cout << total << endl;
    }
    else cout << total << endl;
  }
}


Measured memory_bytes: 8668
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;
typedef unsigned long long ull;



int main(){
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll ans=1;
  rep(i,n) (ans*=(i+1))%=MOD;
  ll l=0,r=0;
  rep(i,n*2){
    int k;
    k=i%2;
    if (s[i]=='B'){
      if (k) {
        r++;
        (ans*=l)%=MOD;
        l--;
      }
      else l++;
    }
    else{
      if (k){
        l++;
      }
      else{
        r++;
        (ans*=l)%=MOD;
        l--;
      }
    }
  }
  if (r!=n) ans=0;
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

string S;
const int N_MAX = 100;
set<int> d;
int N;
int tmp;
int main()
{

    cin >> N;
    REP(i, N)
    {
        cin >> tmp;
        d.insert(tmp);
    }

    cout << d.size();
    return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n,w,d;
    cin >> n >> w >> d;
    if(w==0) return 0;
    list<pair<int,int>> cake;
    cake.push_back({w,d});
    pair<int,int> cut;
    int p,s;
    for(int i=0;i<n;i++){
      cin >> p >> s;
      auto itr=next(cake.begin(),p-1);
      cut=(*itr);
      cake.erase(itr);
      s%=(cut.first+cut.second);
      if(s<cut.first){
        cake.push_back({min(s,cut.first-s),cut.second});
        cake.push_back({max(s,cut.first-s),cut.second});
      }else if(s<cut.first+cut.second){
        cake.push_back({cut.first,min(s-cut.first,cut.second-(s-cut.first))});
        cake.push_back({cut.first,max(s-cut.first,cut.second-(s-cut.first))});
      }else if(s<cut.first*2+cut.second){
        cake.push_back({min(s-(cut.first+cut.second),cut.first-(s-(cut.first+cut.second))),cut.second});
        cake.push_back({max(s-(cut.first+cut.second),cut.first-(s-(cut.first+cut.second))),cut.second});
      }else{
        cake.push_back({cut.first,min(s-(cut.first*2+cut.second),cut.second-(s-(cut.first*2+cut.second)))});
        cake.push_back({cut.first,max(s-(cut.first*2+cut.second),cut.second-(s-(cut.first*2+cut.second)))});
      }
    }
    vector<int> ans(n+1);
    auto itr=cake.begin();
    for(int i=0;i<=n;i++){
      ans[i]=itr->first*itr->second;
      itr++;
    }
    sort(ans.begin(),ans.end());
    for(int i=0;i<n;i++){
      cout << ans[i] << " ";
    }
    cout << ans[n] << endl;
  }
  return 0;
}



Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define ll long long
#define fir first
#define sed second
#define i64 int64_t
#define ui64 uint64_t
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define kpair pair<int, pair<int,int>
#define lwb lower_bound
#define upb upper_bound
const int mod = 1e9+7;
const int maxn = 1e5;

using namespace std;
ifstream fi("");
ofstream fo("");
int n;
ll res[3];
ll tmp[3];
ll a,b,c;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>a>>b>>c;
        tmp[0]= a + max(res[1],res[2]);
        tmp[1]= b + max(res[0],res[2]);
        tmp[2]= c + max(res[0],res[1]);
        for(int i=0;i<3;i++) res[i]=tmp[i];
    }
    cout<<max(res[0],max(res[1],res[2]));
}





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

using namespace std;
int n;
int a[200005];
int f[200005];
int Check(int x)
{
	for(int i=1;i<=2*n-1;++i)
	{
		if(a[i]>=x)
		{
			f[i]=1;
		}
		else
		{
			f[i]=0;
		}
	}
	int nst=-1,nds=291433;
	for(int i=2;i<=2*n-1;++i)
	{
		if(f[i]==f[i-1])
		{
			if(min(abs(n-i+1),abs(n-i))<nds)
			{
				nds=min(abs(n-i),abs(n-i+1));
				nst=f[i];
			}
		}
	}
	if(nst==-1)
	{
		return f[1];
	}
	return nst;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;++i)
	{
		scanf("%d",&a[i]);
	}
	int l=1,r=2*n-1;
	while(l+1<r)
	{
		int mid=(l+r)/2;
		if(Check(mid))
		{
			l=mid;
		}	
		else
		{
			r=mid;
		}
	}
	printf("%d",l);
	return 0;
}

Measured memory_bytes: 1792
S=input()

s=0

if S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]:
    s=1
elif S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
    s=1
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
    s=1

if s==1:
    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 rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  string s = "ABC", t = "ARC", u; cin >> u;
  if(u == s) cout << t << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 3632
/*  ex4_2
    Graku   */
#include <stdio.h>
#include<math.h>

int main(void) {
    double len_h, len_m, hour, min;
    scanf("%lf %lf %lf %lf", &len_h, &len_m, &hour, &min);

    double theta_h = 2 * M_PI * (hour + min/60)/12; //angle between 0 and hour hands [rad]
    double theta_m = 2 * M_PI * min/60; //angle between 0 and minute hands [rad]
    double theta = theta_h - theta_m; //angle between hour and minute hands [rad]

    double ans = sqrt(pow(len_h, 2) + pow(len_m, 2) - 2*len_h*len_m * cos(theta)); //cosine theorem

    printf("%.10f\n", ans); //10 decimal places

    return 0;
}

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

int main() {
    string s;
    cin >> s;
    bool diff = true;
    for(int i=0;i<s.size();i++){
        for(int j=i+1;j<s.size();j++){
            if(s[i] == s[j]){
                diff = false;
                break;
            }
        }
    }
    if(!diff){
        cout << "no" << endl;
    }else{
        cout << "yes" << endl;
    }

    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
    } else {
        cout << (a + b) / 2 + 1 << endl;
    }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n,d) = readLine()!!.split(" ").map { it.toInt() }
    val list = mutableListOf<List<Double>>()
    for (i in 0 until n) {
        list.add(readLine()!!.split(" ").map { it.toDouble() })
    }
    var cnt = 0
    for (i in 0 until n) {
        for (j in i+1 until n) {
            var tmp = 0.0
            for (k in 0 until d) {
                tmp += Math.pow(list[j][k] - list[i][k], 2.0)
            }
            if (Math.sqrt(tmp) % 1 == 0.0) cnt++
        }
    }
    println(cnt)
}

Measured memory_bytes: 37988
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;
using pis = std::pair<int, std::string>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n;
	cin >> n;
	ll* a = new ll[n];
	rep(i, n) cin >> a[i];

	ll money = 1000;
	ll stock = 0;
	rep(i, n) {
		if (i != 0 && a[i - 1] < a[i]) {
			money += stock * a[i];
			stock = 0;
		}

		if (i != n - 1 && a[i] < a[i + 1]) {
			stock += money / a[i];
			money -= stock * a[i];
		}
	}

	cout << money << "\n";

	return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int N;
int cnt[100010];
int a;

int main() {
	cin >> N;
	for (int i = 0; i < 100001; i++) cnt[i] = 0; 
	for (int n = 0; n < N; n++ ){
		cin >> a;
		cnt[a] ++;
	}
	int ans = 0;
	for (int i = 0; i < 100001; i++) {
		ans += max(0, cnt[i] - 1);
	}
	ans ++;
	ans /= 2;
	cout << N - ans * 2 << endl;
}

Measured memory_bytes: 640
// Problem Code: abc177_e

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

string coprime(int N, vector<int>& A) {
	int g = A[0], mx = *max_element(A.begin(), A.end());
	vector<bool> fact(mx);
	
	// gcd of all the elements
	for (int& x: A)
		g = gcd(x, g);
	if (g > 1)
		return "not coprime";
	
	// check for setwise coprime
	for (int x: A) {
		bool not_ok = false;
		for (int y = 2; y * y <= x; y++)
			if (x % y == 0) {
				while (x % y == 0)
					x /= y;
				not_ok |= fact[y];
				fact[y] = true;
			}
		if (x > 1) {
			not_ok |= fact[x];
			fact[x] = true;
		}
		if (not_ok)
			return "setwise coprime";
	}
	
	return "pairwise coprime";
}

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	cout << coprime(N, A);
	return 0;
}

Measured memory_bytes: 7328
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        HashSet<Integer> hs = new HashSet<>();
        hs.add(a);
        hs.add(b);
        hs.add(c);
        if (hs.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}


Measured memory_bytes: 35536
# coding: utf-8

import math
import re
import numpy as np

N = int(input())
An = input().split(" ")

over = False

ans = 1

if "0" in An:
    ans = 0

else:
    for i in range(N):
        Ai = int(An[i])
        if (ans != 0 and Ai > 1000000000000000000) or ans > 1000000000000000000:
            over = True
            break

        ans *= Ai

if ans > 1000000000000000000:
    over = True

if not over:
    print(ans)
else:
    print(-1)



Measured memory_bytes: 37972
import sys
sys.setrecursionlimit(10**7)
import itertools


#debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    memo = {}

    def fib(n):
        if n in memo.keys():
            return memo[n]
        else:
            if n >= 4:
                ans = fib(n - 1) + fib(n - 2)
                memo[n] = ans
                return ans
            elif n == 3:
                return 2
            elif n == 2:
                return 1
            elif n == 1:
                return 1
            else:
                return 1

    n, m = map(int, input().split())
    w_list = []
    last = -1
    dead = False
    for i in range(m):
        a = int(input())
        w = a-last-1
        dprint(i, a, w)
        if w == 0:
            dead = True
            break
        w_list.append(w)
        last = a

    w_list.append((n+1)-last-1)

    dprint(w_list)

    mx = 10**9 + 7
    if dead == True:
        ans = 0
    else:
        ans = 1
        for w in w_list:
            fibw = fib(w)
            ans *= fibw
            dprint(w, fibw, ans)
            ans %= mx

    print(ans)

solve()

Measured memory_bytes: 568668
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

signed main() {
  string s;
  cin >> s;
  int a = 0, ret = 0;
  rep(i, s.size()) {
    if (s[i] == 'A')
      a++;
    else if (s.substr(i, 2) == "BC") {
      ret += a;
      i++;
    } else
      a = 0;
  }
  cout << ret << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include<cmath>
using namespace std;

int main()
{
  int n;
  string s;
  cin>>n;
  cin>>s;
  int ans=0;
  for(int i=0;i<n-1;i++){
    if(s[i]=='O' && s[i+1]=='X'){
      ans++;
      i++;
    }else if(s[i]=='X' && s[i+1]=='O'){
      ans++;
      i++;
    }
  }
  cout<<ans<<endl;
  return 0;
}                 



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string S;
  cin>>N>>S;
  if(N%2!=0){
    cout<<"No"<<endl;
  }
  else{
    string T=S.substr(N/2);
    if(S==T+T){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

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

using namespace std;
typedef long long int ll;

int main()
{
    ll A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    ll sum = 0;
    ll x,y;
    for(ll i = 0; i <= max(2*X,2*Y);i++)
    {
        x = X - i / 2;
        y = Y - i / 2;
        if(X - i / 2 <= 0)
        {
            x = 0;
        }
        if(Y - i / 2 <= 0)
        {
            y = 0;
        }
        if(sum == 0)
        {
            sum = x*A + y*B + i*C;
            continue;
        }
        sum = min(sum, x*A + y*B + i*C);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}


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

    bool fl = false;
    while(!fl){
        bool fl2 = false;
        FOR(i,2,n){
            if(n%i == 0) fl2 = true;
            if(fl2) continue;
        }
        if(!fl2) fl = true;
        n++;
    }
    cout << n-1 <<endl;
}





Measured memory_bytes: 3620
l = list(map(int,input().split()))
x = l[0]
y = l[1]
z = l[2]

if x < y:
    if y < z:
        print(str(l[0]) + ' ' + str(l[1]) + ' ' + str(l[2]))
    else:
        if x < z:
            print(str(l[0]) + ' ' + str(l[2]) + ' ' + str(l[1]))
        else:
            print(str(l[2]) + ' ' + str(l[0]) + ' ' + str(l[1]))
else:
    if y > z:
        print(str(l[2]) + ' ' + str(l[1]) + ' ' + str(l[0]))
    else:
        if x < z:
            print(str(l[1]) + ' ' + str(l[0]) + ' ' + str(l[2]))
        else:
            print(str(l[1]) + ' ' + str(l[2]) + ' ' + str(l[0]))



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

int main(){

int W, H, x, y, r ;
cin >> W >> H >> x >> y >> r ;

if( x >= r){
		if( H >= y + r ){
				if(W >= x + r ){
							if( y >= r ){
										cout<< "Yes" << endl;
									}else{
										cout<< "No" << endl;
									}
					}else{
					cout<< "No" << endl;
					}
		}else{
		cout<< "No" << endl;
		}
}else{
cout<< "No" << endl;
}

return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main() {
	deque<ll> dd;
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i % 2 == 1)
		{
			dd.push_front(a[i]);
		}
		else
		{
			dd.push_back(a[i]);
		}
	}
	if (n % 2) {
		reverse(dd.begin(), dd.end());
	}
	cout << dd.front();
	dd.pop_front();
	while (!dd.empty())
	{
		cout << ' ' << dd.front();
		dd.pop_front();
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5376
gets;
S,*f='? '+?0*N=200;
*A=?!;
N.times{|i|S[i+2]=?1;i.times{|j|
S[j+2]=?1;
puts S;
S[j+2]=?0;
f<<->{gets=="1
"&&A<<"(#{i},#{j})"}
};S[i+2]=?0};
$>.flush;f.map &:call;
puts A*?\s


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

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    char s[4];
    cin >> s;
    if(s[0]==s[1]&&s[1]==s[2]){
        cout << "Yes" << endl;
    }
    else if (s[1] == s[2] && s[2] == s[3])
    {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    n %= 10;
    if(n == 3){
        cout << "bon" << "\n";
    }
    else if(n == 0 || n == 1 || n == 6 || n == 8){
        cout << "pon" << "\n";
    }
    else{
        cout << "hon" << "\n";
    }
    return 0;
}

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

int main(int argc, char const *argv[]) {
  int A;
  int B;

  cin >> A;
  cin >> B;
  if (max(A, B) > 9) {
    cout << -1;
  } else {
    cout << A*B;
  }
  return 0;
}

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

typedef long long ll;

int main()
{
    int n;
    int i;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(i = 0;i < n-2;++i){
        if(s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i+2) == 'C'){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,k,cnt;
int a[100005];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int c=1e9;
    for(int i=0;i<n-k+1;i++)
    {      
        cnt=a[i+k-1]-a[i];
        c=min(c,cnt);
    }
    cout<<c<<endl;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
 
 
int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    
    int sw = 0;
    while (a > 0 || c > 0) {
        if (sw == 0) {
            c -= b;
            sw = 1;
        } else {
            a -= d;
            sw = 0;
        }
    }
    
    if (sw == 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

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

int main(){
	int d, n, i;
	cin >> d >> n;
	if(d == 0) i = 1;
	if(d == 1) i = 100;
	if(d == 2) i = 10000;

	if(n == 100) cout << i * 101 << "\n";
	else cout << i * n << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(y%2!=0 || y<2*x || y>4*x )
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
return 0;}}

Measured memory_bytes: 3588
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int a[100010];
int d[32];

void solve(){
	int n; scanf("%d", &n);
	int X = 0;
	for(int i=1;i<=n;i++){
		scanf("%d", a+i);
		int x = (a[i] ^ (a[i]-1));
		for(int j=1;j<=30;j++){
			if((1<<j) - 1 == x)d[j-1]++;
		}
		X ^= a[i];
	}
	int ans = 0;
	for(int i=29;i>=0;i--){
		if((X & 1<<i) && d[i] == 0){
			printf("-1");
			return;
		}
		if((X & 1<<i)){
			X ^= ((1<<(i+1))-1);
			ans++;
		}
	}
	printf("%d", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		int x = scan.nextInt();
		int y = scan.nextInt();

		if((x == 1||x == 3||x == 5||x == 7||x == 8||x == 10||x == 12)&&(y == 1||y == 3||y == 5||y == 7||y == 8||y == 10||y == 12)){
			
		System.out.println("Yes");
		
			} else if((x == 4||x == 6||x == 9||x == 11)&&(y == 4||y == 6||y == 9||y == 11)){
				
				System.out.println("Yes");
				
			} else if((x == 4)&&(y == 2)){
				
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

	}

}


Measured memory_bytes: 21972
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    Q=int(input())
    # n以下の素数のリストprimes
    n = 10**5
    primes = set(range(2, n + 1))

    # 合成数 x は p<=x**0.5を満たす素因子 p をもつという性質を利用
    for i in range(2, int(n ** 0.5 + 1)):
        primes.difference_update(range(i * 2, n + 1, i))
    primes = list(primes)
    A = [0] * (10 ** 5 + 1)

    for j in range(1,10**5+1,2):
        if j in primes and (j+1)//2 in primes:
            A[j]=1
        # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    B = list(accumulate(A))


    for i in range(Q):
        l,r=map(int,input().split())
        print(B[r]-B[l-1])




resolve()

Measured memory_bytes: 63716
#include<stdio.h>
int main(){

  int i,j,n,q,S[10001],T[501];

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

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

  int key,cnt;
  cnt = 0;

  for ( i = 0; i < q; i++ ){
    key = T[i];
    for ( j = 0; j < n; j++ ){
      if ( S[j] == key ){
	cnt += 1;
	break;
      } 
    }
  }

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

  return 0;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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...));
}

int main() {
  ll a, b; cin >> a >> b;

  function<ll(int, ll)> calc = [](int m, ll d){
    if(d < 0) return 0LL;
    ll ret = (d / bit(m + 1)) * bit(m);

    ll md = ((d >> (m+1)) << (m+1)) + (bit(m) - 1);

    if(md > d) return ret;
    else return ret + (d - md);
  };

  ll ans = 0LL;
  REP(i, 40){
    ll ones = calc(i, b) - calc(i, a-1);
    if(ones % 2 == 1) ans += bit(i);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string n;
	cin>>n;
	if(n=="A")
	cout<<"T";
	if(n=="C")
	cout<<"G";
	if(n=="T")
	cout<<"A";
	if(n=="G")
	cout<<"C";
	return 0;
}

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

int N;
int main(){
    cin >> N;
    int value;
    value = N % 10;
    if (
        value == 2 || 
        value == 4 || 
        value == 5 || 
        value == 7 || 
        value == 9
        ){
        cout << "hon" << endl;
    }
    else if (
        value == 3 
    )
    {
        cout << "bon" << endl;
    }else{
        cout << "pon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char *argv[]) {
  int N, a, b;
  std::cin >> N >> a >> b;
  std::cout << std::min(N * a, b) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define len(x) x.size()
#define rep(i,a) for(int i=0;i<a;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

signed main(){
    
	int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<a[k-1];
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

static const int N=100;

int main(){
  int M[N][N], i, j, n, u, k, v;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++) M[i][j]=0;
  }

  for(i=0; i<n; i++){
    scanf("%d%d", &u, &k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d", &v);
      v--;
      M[u][v]=1;
    }
  }

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

  return 0;
}



Measured memory_bytes: 2148
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
const ll INF=1LL<<61;
const ll MOD=1e9+7;
ll mpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1){
			res*=x;
			res%=MOD;
		}
		x=x*x%MOD;
		n>>=1;
	}
	return res;
}
int main(){
	int n;cin>>n;
	ll x,y;cin>>x>>y;
	vector<vector<ll>> v(n+10);
	vector<ll> f(n+10),fi(n+10);
	f[0]=1;
	for(ll i=1;i<=n;i++){
		f[i]=f[i-1]*i%MOD;
	}
	fi[n]=mpow(f[n],MOD-2);
	for(ll i=n-1;i>=0;i--){
		fi[i]=fi[i+1]*(i+1)%MOD;
	}
	for(int i=0;i<n;i++){
		ll c,w;cin>>c>>w;--c;
		v[c].push_back(w);
	}
	ll c1,mi1=INF;	
	for(int i=0;i<n;i++){
		sort(all(v[i]));
		if(v[i].size()){
			if(mi1>v[i][0]){
				mi1=v[i][0];
				c1=i;
			}
		}
	}
	ll mi2=INF;
	vector<ll> id(n+10);
	for(int i=0;i<n;i++){
		if(i==c1)continue;
		if(v[i].size()){
			if(mi2>v[i][0]){
				mi2=v[i][0];
			}
		}
		for(auto e:v[i]){
			if(mi1+e<=y){
				id[i]++;
			}else{
				break;
			}
		}
	}
	for(auto e:v[c1]){
		if(mi2+e<=y){
			id[c1]++;
		}else{
			break;
		}
	}
	ll ans=1,s=0;
	for(int i=0;i<n;i++){
		if(v[i].size()){
			if(id[i]==0)continue;
			while(id[i]<v[i].size()&&v[i][id[i]]+v[i][0]<=x)id[i]++;
			ans*=fi[id[i]];
			s+=id[i];
			ans%=MOD;
		}
	}
	ans*=f[s];
	cout<<ans%MOD<<endl;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
 int euc(int big,int small){
   if(small == 0){
     return big;
   }
   int x,y;
   while(true){
     x = big % small;
     if(x == 0){
       return small;
     }
     big = small;
     small = x;
   }
 }
int main(){
  int n;
  cin >> n;
  vector<int> x(n+1);
  int i;
  for(i = 0;i< n+1; i++){
    cin >> x[i] ;
  }
  sort(x.begin(),x.end());
  for(i = 1;i < n+1;i++){
    x[i] -= x[0];
  }
  int max = x[n];
  for(i = n-1;i > 0;i--){
    if(max > x[i]){
      max = euc(max,x[i]);
    }else{
      max = euc(x[i],max);
    }
  }
  cout << max << endl;
}
    

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define ALL(x) x.begin(),x.end()
#define FOR(b) for(auto&e:b)
#define INSERT(x) inserter(x,x.end())
int main(){
    #ifdef mark
    freopen("in.txt","r",stdin);
    #endif // mark
    int n;
    cin>>n;
    vector<int> v;
    back_insert_iterator<vector<int> > back_it(v);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        back_it=k;
    }
    for(int k=0;k<v.size();k++){
        if(k)cout<<' ';
        cout<<v[k];
    }
    cout<<endl;
    for(int i=1;i<v.size();i++){
        int key=v[i],j=i-1;
        while(j>=0 && v[j]>key){
            v[j+1]=v[j];
            j--;
        }
        v[j+1]=key;
        for(int k=0;k<v.size();k++){
            if(k)cout<<' ';
            cout<<v[k];
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3136
#include<cstdio>
#include<queue>

using namespace std;

#define FOR(i, a, b) for(int i = a; i <= b; i++)

const int MAX = 20;

struct Point
{
	char name[MAX];
	int timeneeded;
};

queue<Point> q;

int main()
{
	int n, per;
	scanf("%d%d", &n, &per);
	{
		FOR(i, 1, n)
		{
			Point tmp;
			scanf("%s%d", tmp.name, &tmp.timeneeded);
			q.push(tmp);
		}

		int sum = 0;
		while(!q.empty())
		{
			Point cur = q.front();
			q.pop();
			if(cur.timeneeded <= per)
			{
				sum += cur.timeneeded;
				printf("%s %d\n", cur.name, sum);
			}
			else
			{
				sum += per;
				cur.timeneeded -= per;
				q.push(cur);
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3624
#include <stdio.h>
#define N 100000
int A[N],total;
int partition(int a,int b){
      int real,i,j,jeep;
      real=A[b];
      i=a-1;
      for(j=a;j<b;j++){
        if(A[j]<=real){
          i++;
          jeep=A[i];
          A[i]=A[j];
          A[j]=jeep;
        }
      }
      jeep=A[i+1];
      A[i+1]=A[b];
      A[b]=jeep;
      return i+1;
    }
    int main(){
    int i,dybala;
  scanf("%d",&total);
  for(i=0;i<total;i++)
    scanf("%d",&A[i]);
  dybala=partition(0,total-1);
     for(i=0;i<total;i++){
      if(i)printf(" ");
      if(i==dybala)printf("[%d]",A[i]);
         else printf("%d",A[i]);
         }
      printf("\n");
      return 0;
    }


Measured memory_bytes: 2128