akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vi a(n, 0);
    rep(i, 0, n) { cin >> a[i]; }

    vi dp(n, INT_MAX);
    int length = 1;
    dp[0] = a[0];

    rep(i, 1, n) {
        if (dp[length - 1] < a[i]) {
            dp[length++] = a[i];
        } else {
            *lower_bound(dp.begin(), dp.begin() + length, a[i]) = a[i];
        }
    }

    cout << length << endl;
    return 0;
}


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

int main() {
    int count=0;
    int N,H,W;
    cin>>N>>H>>W;
    for(int i=0;i<N;i++){
        int A,B;
        cin >>A>>B;
        if(H<=A && W<=B){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#define inf 10e8
using namespace std;



int main(){
    string s;
    cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    else if (s=="Rainy") cout << "Sunny" << endl;
    else cout << "Rainy" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        if (a < b) {
            for (int i = 0; i < b; i++) {
                System.out.print(a);
            }
        } else {
            for (int i = 0; i < a; i++) {
                System.out.print(b);
            }
        }
    }
}


Measured memory_bytes: 21716
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <chrono>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 998244353
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

int dp[100000];
int arr[100000];
int n;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", arr + i);
	for (int i = 1; i < n; i++) {
		dp[i] = dp[i - 1] + abs(arr[i] - arr[i - 1]);
		if (i > 1)
			dp[i] = min(dp[i], dp[i - 2] + abs(arr[i] - arr[i - 2]));
	}	
	printf("%d\n", dp[n - 1]);
	return 0;
}

Measured memory_bytes: 1024
<?php
$N = trim(fgets(STDIN));
$S = trim(fgets(STDIN));
//list($d,$c) =  explode(" ",trim(fgets(STDIN)));

$aa = range('A','Z');
$al = array_flip($aa);
for($i=0;$i<strlen($S);$i++) {
  $idx=$al[$S[$i]];
  $idx+=$N;
  if ($idx >= 26) $idx -= 26;
  $S[$i]=$aa[$idx];
}
printf("%s\n",$S);


Measured memory_bytes: 4856
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long 
    #define ld long double
    #define MOD 998244353
    #define mod9 1000000009
    #define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #define mp make_pair
    #define pb push_back
    #define ct ll t;cin>>t;while(t--)
    #define bi begin()
    #define ei end()
    #define fi first 
    #define se second  
    #define foe(i,a,b) for(ll i=a;i<b;i++)
    #define rfoe(i,a,b) for(ll i=a;i>=0;i--)
    #define sz(s) s.size() 
    #define mem(a,s) memset(a,s,sizeof(a)) 
    #define all(v) v.bi,v.ei
    #define MAX             8000000000000000064LL
    #define MIN            -8000000000000000064LL   

    typedef pair<ll,ll> pii;
    
    ll add(ll a, ll b){return (a%MOD + b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll sub(ll a, ll b){return (a%MOD - b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll mul(ll a, ll b){return ((a%MOD)*(b%MOD) + ((MAX)/MOD)*MOD)%MOD;}
    ll lcm(ll a,ll b){return(a*b)/__gcd(a,b);}
    ll fact[1000007]={0};
    ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
    y=y>>1;x=(1ll*x*x)%MOD;} return res;}
    void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
    ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
    ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
    int const N=2e5+9;
    ll const INF = 2e18+5;
    ll dx[8]={0,0,1,-1,1,1,-1,-1};
    ll dy[8]={1,-1,0,0,-1,1,-1,1};
    
    void solve()
    {  
       ll x;
       cin>>x;
       if(x==1)
       {
           cout<<0<<"\n";
       }
       else
       {
           cout<<1<<"\n";
       }
       
    }
    int main()
    {
        // fast
        // facto();
        // Sieve();
    //    ct    
        { 
            solve();
        }
    }


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = int64_t;

int main() {
  ll n;
  cin >> n;
  vector<ll> X;
  vector<ll> Y;
  for(ll i=0; i<n; i++) {
    ll x,y;
    cin >> x >> y;
    // distance between two points is max(X[i]-X[j], Y[i]-Y[j])
    X.push_back(x+y);
    Y.push_back(x-y);
  }
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  ll ans = max(X[X.size()-1]-X[0], Y[Y.size()-1]-Y[0]);
  cout << ans << endl;
}


Measured memory_bytes: 6316
l=gets.to_i
n=l.bit_length
a=[]
b=1
(n-1).times{|i|
    a<<[n-i-1,n-i,1<<i]<<[n-i-1,n-i,0]
    if b&l>0
       l^=b
a<<[1,n-i,l]
end
    b*=2
}
a.unshift [n,a.size]
a.map{|e|puts e*' '}

Measured memory_bytes: 1788
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long t1,t2,a1,a2,b1,b2;
    scanf("%ld %ld", &t1, &t2);
    scanf("%ld %ld", &a1, &a2);
    scanf("%ld %ld", &b1, &b2);
    if(t1 * (a1 - b1) + t2 * (a2 - b2) == 0){
        printf("infinity");
        return 0;
    }
    if(t1 * (a1 - b1) + t2 * (a2 - b2) < 0){
        swap(a1, b1);
        swap(a2, b2);
    }
    
    if(a1 - b1 > 0){
        printf("0");
    }
    else {
        long iDist1 = t1 * (b1 - a1);
        long iDist2 = t1 * (a1 - b1) + t2 * (a2 - b2);
        if(iDist1 % iDist2 == 0){
            printf("%ld", 2*(iDist1 / iDist2));
        }
        else{
            printf("%ld", 2*(iDist1 / iDist2) + 1);
        }
    }
    return 0;
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

const ll Mod = 1e9 + 7;
const int N = 1e6 + 8;
bool prime[N];
ll gcd(ll a , ll b){
	if(a == 0)
		return b;
	else
		return gcd(b%a , a);
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll a , b; cin >> a >> b;
	ll c = gcd(a , b);
	ll cnt = 1;
	for(ll i = 2 ;i*i <= c; i++){
		if(c%i == 0){
			cnt++;
			while(c%i == 0)
			c /= i;
		}
		
	}
	if(c > 2)
		cnt++;
	cout << cnt << endl;
	return 0;
}






Measured memory_bytes: 256
package main
import "fmt"
func main() {
  var n int
  var f,f0,f1,f2 int64
  var s string
  fmt.Scan(&n,&f0)
  f1,f2 = -(1<<60),-(1<<60)
  for i:=1;i<n;i++ {
    fmt.Scan(&s,&f)
    if s == "-" {
      f2 = f1+f
      f1 = max(f0-f,f2)
      f0 = f1
    } else {
      f2 += f
      f1 = max(f1-f,f2)
      f0 += f
    }
  }
  fmt.Println(f0)
}
func max(x,y int64) int64 {
  if x > y { return x }
  return y
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#include <variant>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

constexpr ll MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin>>n;
  ll sum = 0;
  ll sqsum = 0;
  REP(i,n) {
    ll a;
    cin>>a;
    sum += a;
    sum %= MOD;
    sqsum += a*a % MOD;
    sqsum %= MOD;
  }
  ll ans = sum * sum % MOD;
  ans += MOD - sqsum;
  ans %= MOD;
  ans *= (MOD + 1) / 2;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s[200010];
int n;
long long dp[2][3000];
long long ans;
int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
//	for (int i = 1; i <= n; i++) {
//		int tmp = 0;
//		for (int j = i; j <= n; j++) {
//			tmp = (tmp * 10 + s[j] - '0') % 2019;
//			if (tmp == 0) {
////				cout << i << " " << j << endl;
//				ans++;
//			}
//		}
//	}
//	cout << ans << endl;
//	ans = 0;
	for (int i = 1; i <= n; i++) {
		dp[1][s[i] - '0'] = 1;
		for (int j = 2018; j >= 0; j--) {
			if (i == 98) {
//				if ((j * 10 + s[i] - '0') % 2019 == 0) {
//					cout << j << endl;
//					cout << dp[0][j] << endl;
//				}
			}
			dp[1][(j * 10 + s[i] - '0') % 2019] += dp[0][j];
		}
//		cout << dp[1][0] << endl;
		ans += dp[1][0];
		for (int j = 2018; j >= 0; j--) {
			dp[0][j] = dp[1][j];
			dp[1][j] = 0;
		}
	}
	cout << ans;
	return 0;
}
/*
8245471362161564948281354574935532438933744544784176776683379677944272137216211649567179573757687757
*/

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

int main() {
 
 int n;
 cin >> n;
 int taro = 0;
 int hanako = 0;
 
 for (int i=0; i<n; i++) {
     string s1, s2;
     cin >> s1 >> s2;
     if (s1 > s2) {
         taro += 3;
     } else if (s1 < s2) {
         hanako += 3;
     } else {
         taro++;
         hanako++;
     }
 }
 
 cout << taro << ' ' << hanako << endl;
 
return 0;
}




Measured memory_bytes: 3152
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<ctime>
using namespace std;
typedef long long lt;
typedef double dd;
#define eps 1e-6
#define sqr(x) ((x)*(x))

int read()
{
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const int maxn=1000010;
int n;
struct point{dd x,y;}p[maxn],O;
dd R;

dd getd(point a,point b){ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
point getO(point p1,point p2,point p3)
{
    point res;
    dd a=p2.x-p1.x,b=p2.y-p1.y,c=p3.x-p2.x,d=p3.y-p2.y;
    dd e=sqr(p2.x)+sqr(p2.y)-sqr(p1.x)-sqr(p1.y);
    dd f=sqr(p3.x)+sqr(p3.y)-sqr(p2.x)-sqr(p2.y);
    res.x=(f*b-e*d)/(c*b-a*d)/2.0; 
    res.y=(a*f-e*c)/(a*d-b*c)/2.0;
    return res;
}

void mincir()
{
    O=p[1]; R=0;
    for(int i=1;i<=n;++i)
    if(getd(p[i],O)-R>eps)
    {
        O=p[i]; R=0;
        for(int j=1;j<i;j++)
        if(getd(p[j],O)-R>eps)
        {
            O=(point){(p[i].x+p[j].x)/2.0,(p[i].y+p[j].y)/2.0};
            R=getd(p[i],p[j])/2.0;
    
            for(int k=1;k<j;++k)
            if(getd(p[k],O)-R>eps)
            {
                O=getO(p[i],p[j],p[k]);
                R=getd(p[i],O);
            }
        }
    }
} 

int main()
{
    n=read();
    for(int i=1;i<=n;++i)
    scanf("%lf%lf",&p[i].x,&p[i].y);
    
    random_shuffle(p+1,p+1+n);
    
    mincir();
    printf("%.10lf",R);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] values = new int[w];
            for(int i = 0;i < values.length;i++){
                values[i] = i + 1;
            }
            for(int i = 0;i < n;i++){
                String str = sc.next();
                String[] ab = str.split(",");
                int a = Integer.parseInt(ab[0]) - 1;
                int b = Integer.parseInt(ab[1]) - 1;

                int tmp = values[a];
                values[a] = values[b];
                values[b] = tmp;
            }
            for(int i = 0;i < n;i++){
                System.out.println(values[i]);
            }
        }
    }
}


Measured memory_bytes: 26212
<?php
fscanf(STDIN, "%d %d", $N, $M);
$A = array_map('intval', explode(" ", trim(fgets(STDIN))));

$heap = new SplMaxHeap();

foreach ($A as $v) {
    $heap->insert($v);
}

for ($i = 0; $i < $M; $i++) {
    $p = $heap->extract();
    $heap->insert($p / 2);
}

$ans = 0;
while ($heap->valid()) {
  $ans += intval($heap->current());
  $heap->next();
}
echo $ans;

Measured memory_bytes: 16884
import itertools
s = input()
ans=0
for i in list(itertools.product([0,1], repeat=len(s)-1)):
  b = 0
  a = s[0]
  for j in range(len(s)-1):
    if i[j] == 0:
      a+=s[j+1]
    else:
      b+=int(a)
      a=s[j+1]
  b+=int(a)
  ans+=b
print(ans)

Measured memory_bytes: 9132
N, X = gets.split.map(&:to_i)
numbers = gets.split.map(&:to_i)

result = [0]
numbers.each_with_index do |number, i|
  number = number + result[i]
  result << number
end

ans = 0
result.each do |r|
  ans += 1 if r <= X
end
p ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N; cin >> N;
    string S; cin >> S;
    vector<int> C(N+1);
    for (int i = 0; i < N; i++) {
        C[i+1] = C[i] + (S[i] == '#');
    }
    int ans = 1e9;
    for (int i = 0; i <= N; i++) {
        // [0..i) -> white, [i..N) -> black
        ans = min(ans, C[i] + ((N - i) - (C[N] - C[i])));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    int l[100];
    for(int i=0; i<n; i++){
        cin >> l[i];
    }
    sort(l, l+n, greater<>());
    int ans = 0;
    for(int i=0; i<k; i++){
        ans += l[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    string S; cin >> S;
    const auto goal = string("CODEFESTIVAL2016");

    auto changes = 0;
    for (auto i = 0; i < 16; i++)
        changes += S[i] != goal[i];

    cout << changes << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FastRead                      \
                                    ios_base::sync_with_stdio(false); \
                                    cin.tie(0);
#define ll long long
#define endl "\n"
#define f for
using namespace std;
int main()

{
    FastRead
    ll int a,b,i;
    cin>>a>>b;
    f(i=0;i<max(a,b);i++)
    {
        cout<<min(a,b);
    }
    return 0;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int H,W;
	cin>>H>>W;
	vector<string> mass(H);
	FDS(i,H){
		cin>>mass[i];
	}
	vector<int> yoko(W);
	vector<int> tate(H);
	FDS(i,H){
		FDS(j,W){
			if(mass[i].at(j)=='#'){
				yoko[j]++;
				tate[i]++;
			}
		}
	}
	FDS(i,H){
	    int sum=0;
		FDS(j,W){
			if(yoko[j]&&tate[i]){
				cout<<mass[i].at(j);
			}
			if(mass[i].at(j)=='.'){
				sum++;
			}
		}
		if(sum!=W){
			cout<<endl;
		}
	}
}

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

/*何故かelse if文が使えなかったのでif文のみで記述*/

int N, X, Y;
int dp[2010][2010];
int cn[1000010] = { 0 };

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

  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++) dp[i][j] = abs(i-j);
  }

  dp[X][Y] = 1; dp[Y][X] = 1;
  for(int i = X; i <= Y; i++){
    for(int j = X; j <= Y; j++){
      if(i < j) dp[i][j] = min(dp[i][j], dp[i][X]+dp[X][Y]+dp[Y][j]);
      else if(i >= j) dp[i][j] = min(dp[i][j], dp[i][Y]+dp[Y][X]+dp[X][j]);
    }
  }

  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      if(i <= X){
        if(j <= X) ;
        if(X < j <= Y) dp[i][j] = min(dp[i][j], dp[i][X] + dp[X][j]);
        if(j > Y) dp[i][j] = min(dp[i][j], dp[i][X] + dp[X][Y] + dp[Y][j]);
      }else if(X < i <= Y){
        if(j <= X) dp[i][j] = min(dp[i][j], dp[i][X] + dp[X][j]);
        if(X < j <= Y) ;
        if(Y < j) dp[i][j] = min(dp[i][j], dp[i][Y] + dp[Y][j]);
      }
      if(Y < i){
        if(j <= X) dp[i][j] = min(dp[i][j], dp[i][Y] + dp[Y][X] + dp[X][j]);
        if(X < j <= Y) dp[i][j] = min(dp[i][j], dp[i][Y] + dp[Y][j]);
        if(Y < j);
      }
    }
  }

  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++) cn[dp[i][j]] += 1;
  }
  
  /*for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      cout << "(" << i << "," << j << ") " << dp[i][j] << endl;
    }
  }*/

  for(int i = 1; i < N; i++) cout << cn[i] / 2 << endl;


  return 0;
}
    

Measured memory_bytes: 17792
#include<iostream>
#include<algorithm>
#include<map>

using namespace std;
long comb(int n){
	return (long)n*(long)(n-1)/2.0;
}

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

	string key;
	map<string,int> mp;
	for(int i=0;i<n;i++){
		cin>>key;
		sort(key.begin(), key.end());
		if(mp.find(key) == mp.end()) {
			mp[key] = 1;
		}else {
			mp[key] += 1;
		}
	}
	long count = 0;
	for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
		int n=itr->second;
		count += n>1?comb(n):0;
	}
	cout<<count<<endl;
}


Measured memory_bytes: 11136
import java.util.Scanner;
import java.util.Arrays;

public class Main {

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        S = S.replaceAll("eraser", "");
        S = S.replaceAll("erase", "");
        S = S.replaceAll("dreamer", "");
        S = S.replaceAll("dream", "");
        boolean ans = S.isEmpty();
        if (ans) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

}

Measured memory_bytes: 30288
import fractions
import numpy as np

N = int(input())
A = np.array(sorted([int(i) for i in input().split()]))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

divisors=make_divisors(A[0])
divisors_1=make_divisors(A[1]) 
divisors.extend(divisors_1)

def gcd(l):
    ans = l[0]
    for j in range(1, N-1):
        ans = fractions.gcd(ans, l[j])
    return ans

#res = 1
for i in sorted(list(set(divisors))):
#    print("{} / {}".format(i, A%i))
#    print(np.where(A%i != 0))
#    print((A%i != 0))
    if(np.sum(A%i != 0)<=1):
        #print(i)
        res = i


print(res)




Measured memory_bytes: 24060
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000*1000+20;
int n, t[MAX], lacznie, xd[MAX];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> t[i];
        xd[t[i]]++;
        if(!lacznie)
            lacznie = t[i];
        else
            lacznie = __gcd(lacznie, t[i]);
    }
    if(lacznie != 1)
    {
        cout << "not coprime\n";
        return 0;
    }
    //albo gcd(ai, aj) kazdego i, j == 1, albo nie
    for(int i = 2; i <= MAX - 9; i++)
    {
        int wynik = 0;
        for(int j = i; j <= MAX - 9; j += i)
            wynik += xd[j];
        if(wynik > 1)
        {
            cout << "setwise coprime\n";
            return 0;
        }
    }
    cout << "pairwise coprime\n";
}


Measured memory_bytes: 11340
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
// #include<unordered_map>
#include<set>
// #include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y, idx;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

template<typename T>
T minT(T a, T b) {
	if (a < b) return a;
	else return b;
}

template<typename T>
T maxT(T a, T b) {
	if (a > b) return a;
	else return b;
}

template<typename T>
T absT(T a) {
	if (a < 0) a *= -1;
	return a;
}

template<typename T>
T powT(T a, T x) {
	T res = 1;
	while (x > 0) {
		if (x & 1) res = res * a;
		a = a * a;
		x >>= 1;
	}
	return res;
}

ll StoLL(string str) {
	ll ret = 0, ini = 0;
	if (str[0] == '-') ini = 1;
	repi(i, ini, str.length()) {
		ret *= 10;
		ret += (ll)(str[i] - '0');
	}
	if (ini) ret *= -1;
	return ret;
}

///////////////////////////////////////////////////////////////////////////////////////

ll N, ans;

int main() {
	cin >> N;
	repi(i, 0, N) {
		ll a;
		cin >> a;
		ans += a;
	}
	ans -= N;
	wrln(ans);
	return 0;
}


Measured memory_bytes: 256
e1,e2,e3,e4=map(int,input().split())

if e1==e2 and e3==e4:
    print('yes')
elif e1==e3 and e2==e4:
    print('yes')
elif e1==e4 and e3==e2:
    print('yes')
else:
    print('no')


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= b)cout << a << endl;
	else cout << a - 1 << endl;
}

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

int W,H,x,y,r;

int main() {
  cin >> W >> H >> x >> y >> r;
  if(x < 0 || y < 0 ) {
    cout << "No" << endl;
  }else if (x + r <= W && y + r <= H) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3100
#include<stdio.h>
int linearSearch(int);
int S[10000],n;

int main()
{

  int i=0,q,T[500],j=0,c=0;

  scanf("%d",&n);

  while(i < n){
    scanf("%d",&S[i]);
    i++;
  }
  
  scanf("%d",&q);
  
  while(j < q){
    scanf("%d",&T[j]);
    j++;
  }
  
  for(i = 0;i < q;i++){
  c += linearSearch(T[i]);
  }
  printf("%d",c);
  printf("\n");
  return 0;
}

int linearSearch(int key)
{
  int i=0;
  S[n] = key;
  while(S[i] != key){
    i++;
    if(i == n) return 0;
  }
  return 1;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int win = -1;
        if(a == 1 || b == 1){
            if(a != 1){
                win = 1;
            }else if(a == b){
                win = 0;
            }
        }else if(a < b){
            win = 1;
        }else if(a == b){
            win = 0;
        }
        switch(win){
            case -1:
                System.out.print("Alice");
            break;
            case 0:
                System.out.print("Draw");
            break;
            case 1:
                System.out.print("Bob");
            break;
        }
    }
}

Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;
int main(void){
    string tmp;
    vector<string> str(2,"");

    cin >> str.at(0) >> str.at(1);
    
    sort(str.at(0).begin(),str.at(0).end());
    tmp=str.at(0);
    sort(str.at(1).begin(),str.at(1).end());
    reverse(str.at(1).begin(),str.at(1).end());
    sort(str.begin(),str.end());

    if(tmp==str.at(0)&&tmp!=str.at(1))cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
}


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

int main()
{
  int k; cin >> k;
  long long sum = 0;
  for(int i = 1; i < k+1; i++){
    for(int j = 1; j < k+1; j++){
      for(int l = 1; l < k+1; l++){
        sum += gcd(i, gcd(j,l));
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		if(a>81){
          System.out.println("No");
        	return;
        }else{
          for(int i=1;i<10;i++){
            for(int j=1;j<10;j++){
              if(i*j==a){
                System.out.println("Yes");
              	return;
              }
            }
          }
        }
      	 System.out.println("No");
	}
}


Measured memory_bytes: 35716
#pragma warning (disable:4996)
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
ll a[200005];

int main()
{
	ll a, b;
	cin >> a>>b;
	if (a+b==15)
	{
		cout << '+' << endl;
	}
	else if (a*b==15)
	{
		cout << '*' << endl;
	}
	else
	{
		cout << 'x' << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
const int MAX_V = 1000000;//1000000?????§????´???°??¨?????????
int main(){
	int prime [MAX_V];//??¨?????????????????????????????????
	int sum[MAX_V+1];//?´????????????????
	int i, k, n;
	for(i = 2; i < MAX_V; i++){
		prime[i] = 1;
	}
	for(i = 2; i*i < MAX_V; i++){//??¨?????????????????????????????¨????????????
		if(prime[i] == 1){
			for(k = 2*i; k < MAX_V; k += i){
				prime[k] = 0;//?´???°????????°????´???°??§??????
			}
		}
	}
	for(i = 2; i < MAX_V; i++){//?´????????????????
		sum[i + 1] = sum[i] + prime[i];//
	}
	while(scanf("%d", &n) != EOF){
		printf("%d\n", sum[n + 1]);
	}
	return 0;
}

Measured memory_bytes: 8832
# スペース区切りの整数の入力
a, b = map(int, input().split())

# print(a)
# print(b)

ans = "Impossible"
if a % 3 == 0:
	ans = "Possible"

if b % 3 == 0:
	ans = "Possible"

if (a+b) % 3 == 0:
	ans = "Possible"

print(ans)


Measured memory_bytes: 2940
//***********************
    //*** writer : Alan Hu **
    //***********************
    #include<iostream>
    #include<vector>
    #include<string>
    #include<set>
    #include<map>
    #include<algorithm>
    #include<queue>
    #include<list>
    #include<stack>
    #include<cstdio>
    #include<fstream>
    #include<numeric>
    #include<functional>
    #include<utility>
    #include<memory>
    #include<cstring>
    #include<cmath>
    using namespace std;
         
    #define CLEAN(a,b) memset(a,b,sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define sz(a) a.size()
    #define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
         
    typedef long long ll;
    typedef pair<int, int> pii;
     
    int w;
    string s;
     
    int main()
    {
    	cin>>s>>w;
    	for (int i=0;i<s.size();i+=w)
    	{
    		cout<<s[i];
    	}
        return 0;
    }

Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int K, A, B; cin >> K >> A >> B;
    int diff = A - B;

    if(diff > 0) {
        K -= A;
        int div = (K + diff - 1) / diff;
        cout << div * 2 + 1 << endl;
    }
    else {
        if(K <= A) cout << 1 << endl;
        else cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define db double
#define pb push_back
#define wrln cout<<'\n';
#define pii pair<int,int>
using namespace std;
const int H=1e9+9;
const int N=1e5+100;

ll a,b,c,d;

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

    cin>>a>>b>>c>>d;
    cout<<max(max(a*c,a*d),max(b*c,b*d));
}


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

#define ll long long
#define llu unsigned long long
#define PB push_back
#define F first
#define S second
const ll MOD = 1000000007;
const ll INF = 1000000007;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define ck(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define ck(x...)
#endif

string gh = "here";

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
			freopen("C:\\Users\\HP\\Desktop\\input.txt", "r", stdin);
			freopen("C:\\Users\\HP\\Desktop\\output.txt", "w", stdout);
			freopen("C:\\Users\\HP\\Desktop\\err.txt", "w", stderr);
	#endif

	ll a;
	string b;
	cin>>a>>b;
	ll sz = b.size();
	ll dec = 0, qw = 1;
	ck(b);
	for(ll i =sz-1;i>=0;i--){
		if(b[i] == '.'){
			// b.erase(b.back());
			break;
		}
		dec += qw*(b[i] - '0');
		qw *= 10;
		// b.erase(b.back());
	}
	string bb;
	for(auto it : b){
		if(it == '.')
			break;
		bb += it;
	}
	ck(bb);
	sz = bb.size();
	ll aage = 0;
	qw = 1;
	for(ll i =sz-1;i>=0;i--){
		aage += qw*(bb[i] - '0');
		qw *= 10;
	}
	ll ans = a*aage;
	dec = (dec*a)/100;
	ans += dec;
	cout<<ans;
	
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  multiset<int> p;
  for (int i=0; i<N; i++){
    int x;
    cin>>x;
    p.insert(x);
  }
  int ex=*p.rbegin();
  ex/=2;
  p.erase(find(p.begin(),p.end(),*p.rbegin()));
  int other_sum=accumulate(p.begin(),p.end(),0);
  cout<<ex+other_sum<<endl;
  
}
  

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


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

    long long int x, y, ans;
    cin >> x >> y;

    if (x % y == 0) 
        cout << "-1\n";
    else
        cout << x << "\n";
    
    return 0;

}


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

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

using ll = long long;

ll dp[200100];
bool memo[200100];
 ll f(ll i){
   if(memo[i]) return dp[i];
   else {
     memo[i] = true;
   ll x, y;
   ll n = 1LL;
   ll z = i;
   ll cnt = 0LL;
   while(z>=10LL){
     if(n==1LL)y=z%10LL;
     z/=10LL;
     n++;
     if(n>=3LL){
       cnt = cnt*10LL +1LL;
     }
   }
   x=z;
   if(y==0)cnt=0LL;
   else if(y<x){
     cnt = cnt*10LL+1LL;
     cnt*=2LL;
   }
   else if(x==y){
     for(ll i = 0LL; i < n-1;i++){
       x*=10LL;
     }
     ll j=i;
     j-=x;
     j/=10;
     cnt = (cnt + 1LL + j)*2LL+1LL;
   }
   else if(x<y){
     cnt*=2LL;
   }
   dp[i]=f(i-1LL)+cnt;
   return dp[i];
   }
 }

int main() {
  for(int i = 0; i < 10;i++){
    dp[i]=i;
    memo[i] = true;
  }
  ll N;
  cin >> N;
  cout<<f(N)<<endl;
}

Measured memory_bytes: 8192
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n, k;
	ll a, b;
	ll sum = 0;
	vector<pair<ll,ll>> v;

	cin >> n >> k;

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

		v.push_back({ a,b });
	}

	sort(v.begin(), v.end());

	for (int i = 0; i < v.size(); i++) {
		sum += v[i].second;

		if (sum >= k) {
			cout << v[i].first << endl;
			break;
		}
	}
}


Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
int N;
int modulo = 1000000007;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> N;

    vector<ll> a(N);
    ll sum = 0, b = 0;

    rep(i, 0, N) { cin >> a[i]; }
    rep(i, 0, N) {
        b += a[i];
        b %= modulo;
    }
    rep(i, 0, N) {
        b -= a[i];
        if(b < 0) {
            b += modulo;
        }
        sum += a[i] * b;
        sum %= modulo;
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
  
// #define int long long
#define pb push_back
#define print(Target) cout << Target << '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

signed main()
{
  ios::sync_with_stdio(false);
  string n;
  int cnt = 0;
  while (cin >> n){
    string res = n;
    reverse(res.begin(), res.end());
    if (res == n){
      cnt++;
    }
  }
  print(cnt);

  return (0);
}

Measured memory_bytes: 1196
use std::io::{self,Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).expect("i/o error");
    let mut iter = input.split_whitespace();

    macro_rules! RD { () => ( iter.next().unwrap().parse().unwrap() ) }

    let coef  = [8i64, 4, 2, 1];
    let mut v = [0i64; 4];
    for (e, c) in v.iter_mut().zip(coef.iter()) {
        *e  = RD!();
        *e *= *c;
    }
    let n: i64 = RD!();

    let mut ans = 0;
    ans += n/2 * v.iter().min().unwrap();
    ans += n%2 * v[..3].iter().min().unwrap() / 2;

    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		long oddNum = 0;
		while(scan.hasNext()) {
			long num = scan.nextLong();
			if ((num % 2) == 1) {
				oddNum++;
			}
		}
		if (oddNum % 2 == 1) {
			System.out.println("NO");
		}
		else {
			System.out.println("YES");
		}
	}
}


Measured memory_bytes: 58660
#include <bits/stdc++.h>
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
typedef long long ll;
using namespace std;

int main(){
  	int a,b,c,d,cnt = 0;
  	cin >> a >> b >> c >> d;
  
  	cout << max(0,(min(b,d) - max(a,c))) << endl;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  int temp;
  cin>>a>>b>>c;
  int x[5]={a,b,c};
  sort(x,x+3,greater<int>());
  temp=x[0]*10;
  temp+=x[1];
  cout<<temp+x[2]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char remain(char x,char y){
	if(x!='R'&&y!='R') return 'R';
    if(x!='G'&&y!='G') return 'G';
    if(x!='B'&&y!='B') return 'B';
}
int main() {
   int n;
   cin>>n;
   string s;
   cin>>s;
   vector<long long> r(n+1,0),g(n+1,0),b(n+1,0);
   r[0]=0,g[0]=0,b[0]=0;
   for(int i=0;i<n;i++){
   	if(s[i]=='R'){
    	r[i+1]=r[i]+1;
        g[i+1]=g[i];
        b[i+1]=b[i];
    }else if(s[i]=='G'){
    	g[i+1]=g[i]+1;
        r[i+1]=r[i];
        b[i+1]=b[i];
    }else if(s[i]=='B'){
    	b[i+1]=b[i]+1;
        g[i+1]=g[i];
        r[i+1]=r[i];
    }
   }
  long long ans=0;
   for(int i=0;i<n-2;i++){
   	for(int j=i+1;j<n-1;j++){
    	if(s[i]!=s[j]){
        	char x=remain(s[i],s[j]);
            if(x=='R') ans+=r[n]-r[j+1];
            else if(x=='G') ans+=g[n]-g[j+1];
            else if(x=='B') ans+=b[n]-b[j+1];
            if(2*j-i<n&&s[2*j-i]==x) ans--;
        }
    }
   }
   cout<<ans;
}


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

long long n, a, b, t, x[100000];
int main(){
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++) cin >> x[i];
	for(int i = 1; i < n; i++){
		if((x[i]-x[i-1])*a < b) t += (x[i]-x[i-1])*a;
		else t += b;
	}
	cout << t;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int a[1000007];
int b[1000007];
int main(){
  int n;
  cin>>n;
  int m=0;
  for(int i=0;i<n;i++){
      cin>>a[i];
     if(a[i]>m) m=a[i];
  }

  for(int i=0;i<n;i++){
      int j=a[i];
    for(;j<=m;j+=a[i]){
      b[j]++;
    }
  }
  int cnt=0;
  for(int i=0;i<n;i++){
if(b[a[i]]==1) cnt++;
  }
  cout<<cnt;
}


Measured memory_bytes: 8076
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <cmath>

using namespace std;


int find(int num,int count,int index) {
	int value = 0;
	if (index == 0) {
		if (num < 6) {
			count += num;
			return count;
		}

		for (int i = 1; i < 100000; i++) {
			int six = pow(6, i);
			if (six > num)
				break;
			value = six;
		}
	}
	else {
		if (num < 9) {
			count += num;
			return count;
		}

		for (int i = 1; i < 100000; i++) {
			int nine = pow(9, i);
			if (nine > num)
				break;
			value = nine;
		}
	}

	num -= value;
	count++;

	int six = find(num,count,0);
	int nine = find(num, count, 1);

	return min(six, nine);
}

int main(void) {
	int num;
	cin >> num;
	
	int six = find(num, 0, 0);
	int nine = find(num, 0, 1);
	cout << min(six,nine);
}

Measured memory_bytes: 256
n = int(input())

arr = list(map(int, input().split()))


def solve():
  if 1 not in arr:
    print(-1)
    return

  cnt = 1
  for i in range(0, n):
    if arr[i] == cnt:
      cnt += 1
  print(n - (cnt-1))

def main():
  solve()


if __name__ == "__main__":
  main()

Measured memory_bytes: 24744
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  int a = n / 100;
  if (n <= a * 100 + a * 10 + a)
    printf("%d", a * 100 + a * 10 + a);
  else
    printf("%d", (a + 1) * 100 + (a + 1) * 10 + a + 1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=100005;
int n,m;
vector <int> e[N];
set <int> s[N];
int cnt=0;
void dfs(int x,int pre,int s,int t){
	if (x==s&&pre)
		return;
	if (x==t){
		cnt++;
		return;
	}
	for (auto y : e[x])
		if (y!=pre)
			dfs(y,x,s,t);
}
int main(){
	n=read(),m=read();
	For(i,1,m){
		int x=read(),y=read();
		e[x].pb(y),e[y].pb(x);
		s[x].insert(y),s[y].insert(x);
	}
	For(i,1,n){
		if (!s[i].empty()){
			int x=i;
			while (!s[x].empty()){
				int y=*s[x].begin();
				s[x].erase(y);
				s[y].erase(x);
				x=y;
			}
			if (x!=i)
				return puts("No"),0;
		}
	}
	For(i,1,n)
		if (e[i].size()>=6)
			return puts("Yes"),0;
	int c4=0;
	For(i,1,n)
		if (e[i].size()==4)
			if ((++c4)>=3)
				return puts("Yes"),0;
	if (c4==2){
		int x=0,y=0;
		For(i,1,n)
			if (e[i].size()==4){
				if (!x)
					x=i;
				else
					y=i;
			}
		dfs(x,0,x,y);
		if (cnt==2)
			return puts("Yes"),0;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 21376
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
 
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

int A,B,C,D,E,F,G,H,I,J,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,K;
string s,t;

signed main()
{
	IOS();
	cin>>N>>K;
	vector<int>a(N);
	for(int i = 0;i < N;i++){
		cin>>a[i];
	}
	auto dp = make_v<int>(K+100,N+100,N+100);
	fill_v(dp,-INF);
	dp[0][0][0] = 0;
	rep(k,0,K+1){
		rep(i,0,N+1){
			rep(j,0,N+1){
				if(dp[i][j][k] == -1)continue;
				if(i+j>=N)continue;
				if(i<=N-1)chmax(dp[k+1][i+1][j],dp[k][i][j]+a[i]);
				if(N-j-1>=0)chmax(dp[k+1][i][j+1],dp[k][i][j]+a[N-j-1]);
				chmax(dp[k+2][i+1][j],dp[k][i][j]);
				chmax(dp[k+2][i][j+1],dp[k][i][j]);
			}
		}
	}
	int ans = -INF;
	rep(i,0,N+1)rep(j,0,N+1)rep(k,0,K+1)chmax(ans,dp[k][i][j]);
	cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

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

  int a, b, c;
  cin >> a >> b >> c;

  if (c <= b) cout << "delicious" << "\n";
  else if (c <= b + a) cout << "safe "<< "\n";
  else cout << "dangerous" << "\n";
}


Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
 
public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
	          String[] A = line.split("");
	          int[] Arr = new int[A.length];
	          int sum1=0;
	          int sum2=0;
	          for(int i=0;i<Arr.length;i++){
	          	Arr[i]=Integer.parseInt(A[i]);
	          	if(i==0){
	          		sum1+=Arr[0];	
	          	}
	          	else{
	          		sum2+=Arr[i];
	          	}
	          }
	          if(sum1==1 && sum2==0){
	             System.out.println(10);	
	          }
	          else{
	          	System.out.println(sum1+sum2);
	          }
	          
	}

}


Measured memory_bytes: 23252
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
	int x, y;
	int ma, mi;

	cin >> x >> y;
	ma = max(x, y);
	mi = min(x, y);

	while (ma != mi){
		int t = ma % mi;
		ma = max(t, mi);
		mi = min(t, mi);
		if (ma % mi == 0) break;
	}
	cout << mi << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <float.h>
using namespace std;

int a;
int b;

int main()
{
	int ans = 0;
	int up, num;
 
	cin >> a >> b;

	up = a / 100 * 100;
	num = up;
	while( num <= b ) {
		int low = up / 10000 + ( ( up / 1000 ) % 10 ) * 10;
		num = up + low;
		if( a <= num && num <= b ) {
			ans++;
		}
		up += 100;
	}

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


Measured memory_bytes: 256