akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//type
typedef long long ll;
#define pii pair<int, int>
#define vi vector<int>
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
#define ios cin.tie(0); ios::sync_with_stdio(false)
#define FIX(a) cout << fixed << setprecision(a)
//manip
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power(T a, T b) {return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
template<typename T> T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template<typename T> T lcm(T a, T b) {return a / gcd(max(a, b), min(a, b)) * b;} //先に割る!!
#define outa(a, n) rep(i, n) cout << a[i] << " "; cout << endl
#define out(a) cout << a << endl
#define outv(v) rep(i, SZ(v)) cout << v[i] << " "; cout << endl
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0
//minimal required terms
//cast caution
//look constraints always


ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll ret = 1;
    rep(i, k) (ret *= n--) %= mod;
    rep(i, k) (ret *= power((ll)i + 1, mod - 2)) %= mod;
    return ret;
}

int main() {
    

    
    int n, k; cin >> n >> k;
    
    ll ans = 0;
    out(n - k + 1);
    rep3(i, 2, k + 1) {
        //n+1箇所にi+1個の仕切り
        ans = COM(k - 1, i - 1) * (COM(n - k - 1, i) + COM(n - k - 1, i - 2) + 2 * COM(n - k - 1, i - 1));
        ans %= mod;
        out(ans);
        ans = 0;
    }
    
    
}

/*
 連続してるの圧縮して考えよう
 iに関して独立に考えていい
 
 i = 1
 n - k + 1
 
 
 i = 2
 b, r, b, r
 r, b, r, b
 
 i = 3
 b, r, b, r, b
 r, b, r, b, r
 
 
 i = 100
 b, r, b, r, b, r, ...
 
 10^9 + 7超える時点で再帰不能
 
 
 
 
 n個の玉並べる
 仕切りを入れる
 
 i = 1
 仕切り2つ
 
 違うは
 
 
 
 連続青を1まとめとする
 i = 2
 2箇所に分ける
 r, b, r, b, r
 端のr = 0も可
 
 i = 5
 r, b, r, b, r, b, r, b, r, b, r
 間のrは必ず1以上
 
 bに関してはすべて1個以上
 k個の間(k-1)i-1個選ぶ
 
 
 n - k個
 1. 両端ない
 2. 両端ある
 
 2. (n-k)個の間(n-k-1)i個選ぶ
 
 1. n-k個 間i-2箇所
 
 3. 片端
 n-k-1個からi-1個選ぶ
 */



Measured memory_bytes: 256
import java.util.Scanner;

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

		String a_str = scanner.next();
		String b_str = scanner.next();
		String c_str = scanner.next();

		int a = Integer.parseInt(a_str);
		int b = Integer.parseInt(b_str);
		int c = Integer.parseInt(c_str);

		if(b < a) {
			int tmp = b;
			b = a;
			a = tmp;
		}

		if(c < b) {
			int tmp = c;
			c = b;
			b = tmp;

			if(b < a) {
				tmp = b;
				b = a;
				a = tmp;
			}
		}

		System.out.println(a + " " + b + " " + c);

    	scanner.close();
    }
}


Measured memory_bytes: 25952
import fractions
def lcm(a, b):
    return a * b // fractions.gcd (a, b)

mod = 10 ** 9 + 7
n = int(input())
l = [int(i) for i in input().split()]
product  = 1
for i in l:
    product = lcm(product,i)

ans = 0 
for i in l:
    ans += product // i
ans %= mod
    
print(ans)

Measured memory_bytes: 6108
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[N];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){

    int x;
    cin>>x;
    a[x]++;
}
int ma=a[0]+a[1];
for(int i=2;i<N;i++){
    int t=a[i-2]+a[i-1]+a[i];
    if(t>ma)ma=t;
}
cout<<ma<<endl;
return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i=0; i<(n); i++)
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){
    ll N; cin >> N;
    vector <ll> A(N);
    vector <ll> B(N);
    rep(i,N) cin >> A[i] >> B[i];
    
    
    ll cnt=0;
    for (ll i=N-1; i>=0; i--){
        A[i]+=cnt;
        if (A[i]%B[i]==0) continue;
        cnt+=(B[i] - (A[i]%B[i]));
    }
    cout << cnt << endl;
    
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        sc.nextLine();
        int w = sc.nextInt();
        sc.nextLine();
        int[] f = new int[w];
        int[] l = new int[w];
        for(int i = 0;i < w;i++){
            String[] s = sc.nextLine().split(",");
            f[i] = Integer.parseInt(s[0]);
            l[i] = Integer.parseInt(s[1]);
        }
        int[] result = new int[h];
        for(int i = 1;i <= h;i++) result[amida(f,l,i) - 1] = i;
        for(int i = 0,size = result.length;i < size;i++) System.out.println(result[i]);
    }

    static int amida(int[] f,int[] l,int index){
        for(int i = 0,size = f.length;i < size;i++){
            if(f[i] == index) index = l[i];
            else if(l[i] == index) index = f[i];
        }
        return index;
    }

}

Measured memory_bytes: 26008
from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *
from collections import defaultdict
from copy import deepcopy
from math import log

N=int(input())
def nCr(n,r):
    if n<r:
        return 0
    a=factorial(n)
    b=factorial(n-r)
    c=factorial(r)
    return a//(b*c)
f=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
a=0
b=0
c=0
d=0
e=0
for F in f:
    s=sum([(N//(F**i)) for i in range(1,7)])
    if s>=74:
        e+=1
    elif s>=24:
        d+=1
    elif s>=14:
        c+=1
    elif s>=4:
        b+=1
    elif s>=2:
        a+=1

print(nCr(b+c+d+e,2)*a+nCr(b+c+d+e,3)*3+(c+d+e)*(max(b+c+d+e-1,0))+(e+d)*(max(0,a+b+c+d+e-1))+e)


Measured memory_bytes: 38256
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;

#define int long long 
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;



// ユークリッドの互除法を用いて再帰関数を書けばよい。
ll my_gcd(ll & a, ll & b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}


signed main() {
	int A, B;
	cin >> A >> B;

	int res = 0;
	res = A*B/my_gcd(A, B);

	cout << res << endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK: 2000000")
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define double long double
#define x first
#define y second
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
#define PI 3.14159265358979
const ll mod=1000000007;
int n, a[200020], ans;
vector<int> ones;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin>>n;
    for(int i=1; i<=n; i++){
        char c;
        cin>>c;
        if(c=='R') a[i]=1, ones.pb(i);
    }
    reverse(ones.begin(), ones.end());///ids of 1s from left to right
    ones.pb(0);
    int cur=0;
    ///we need the array to look like 11..10..00 at the end
    for(int i=1; i<=n; i++){
        if(a[i]==0){
            if(ones[cur]<i) return cout<<ans, 0;
            ans++;
            if(cur+1<ones.size()) cur++;
        }
    }
    cout<<ans;
}



Measured memory_bytes: 6740
#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 yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n,x;
	ll m[101];
	ll c=0,d=0;

	cin>>n>>x;

	rep(i,n){
		cin>>m[i];
		c+=m[i];
	}
	d=x-c;


	sort(m, m + n);

	if(d>0){
		n=n+d/m[0];
	}

	cout<<n<<endl;

	return 0;
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

int N;
int A[100005];
int S[200010];

// Is it possible to divide into 3 pieces with size of larger than or equal to x?
bool f(int x) {
    for (int start = 0; start < N; start++) {
        int idx = start;
        int lower = S[idx] + x;
        for (int i = 0; i < 3; i++) {
            idx = lower_bound(S, S + 2 * N, lower) - S;
            lower = S[idx] + x;
        }

        if (idx <= start + N) return true;
    }

    return false;
}

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) S[i+1] = S[i] + A[i];
    for (int i = N; i < 2*N; i++) S[i+1] = S[i] + A[i-N];

    int lb = 0;
    int ub = INF;
    while (ub - lb > 1) {
        int mid = (ub + lb) / 2;
        if (f(mid)) {
            lb = mid;
        } else {
            ub = mid;
        }
    }

    cout << lb << endl;
}


Measured memory_bytes: 5452
import java.util.Scanner;
public class Main{
  public static void main(String[] args) {
    int h,w;
    Scanner sc = new Scanner(System.in);  
    while(true){
      h = sc.nextInt();
      w = sc.nextInt();
      int i,j;
      if(h==0&&w==0) break;
      for(i=0;i<h;i++){
        if(i%2==0){
          for(j=0;j<w;j++){
            switch(j%2){
              case 0: System.out.printf("#"); break;
              case 1: System.out.printf("."); break;
            }
          }
        }else{
          for(j=0;j<w;j++){
            switch(j%2){
              case 0: System.out.printf("."); break;
              case 1: System.out.printf("#"); break;
            }
          }
        }
        System.out.println();
      }
      System.out.println();
    }
    sc.close();
  }
}


Measured memory_bytes: 60160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    string s; cin >> s;
    ll k ; cin >> k;
    if (k == 1) {
        cout << s[0] << endl;
        return 0;
    } else {
        bool res = true;
        int m = -1;
        rep(i,min(k,(ll)s.size())) {
            if (s[i] != '1') {
                m = i;
                res = false;
                break;
            }
        }
        if (res) cout << 1 << endl;
        else cout << s[m] << endl;
    }
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

int M[100][100];
int done[100] = { 0 };

int main()
{
	int n;
	int ans = 0;
	int mincost;
	int index = 0;

	cin >> n;
	rep(i, n) {
		rep(j, n) {
			cin >> M[i][j];
		}
	}

	done[0] = 1;

	while (true) {
		mincost = -1;

		rep(i, n) {
			rep(j, n) {
				if ((done[i] == 1 && done[j] == 0)
					&& (M[i][j] != -1)
					&& (mincost == -1 || mincost > M[i][j])) {
					mincost = M[i][j];
					index = j;
				}
			}
		}

		if (mincost == -1) break;
		else {
			done[index] = 1;
			ans += mincost;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
const ll M=2e5+5,LG=64,SM=600+5,inf=1e18+1;
ll mod=1e9+7;
ll n;
ll a[M];
ll dp[M][2];

int main()
{
	ios::sync_with_stdio(0);
    cin >> n;
    dp[0][0]=dp[0][1]=0;
    For(i,0,n)
    {
        cin >> a[i];
        dp[i+1][0]=dp[i+1][1]=
            min(dp[i][0],dp[i][1])+1;
        if (i==0) continue;
        if (a[i]>=a[i-1]) 
            smin(dp[i+1][0],dp[i][0]);
        if (a[i]<=a[i-1]) 
            smin(dp[i+1][1],dp[i][1]);
    }    
    RET(min(dp[n][0],dp[n][1]));
}    

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 100100;
ll st[MN*4];
int n;
void up(int l, int r, ll val) {
	l += 2*n;r += 2*n;
	for(;l<r;l>>=1,r>>=1) {
		if(l&1) {st[l++] += val;}
		if(r&1) {st[--r] += val;}
	}
}
ll qu(int p) {
	ll res = 0;
	for(p+=2*n;p>0;p>>=1) {
		res += st[p];
	}
	return res;
}
int v[MN];
ll rt[2*MN];
int main() {
	int m;
	scanf("%d %d ",&m,&n);
	memset(st,0,sizeof(st));
	memset(rt,0,sizeof(rt));
	for(int i=0;i<m;i++) {
		scanf("%d ",&v[i]);v[i]--;
	}
	ll tot = 0;
	for(int i=0;i<m-1;i++) {
		int a = v[i],b = v[i+1];
		if(a > b) {b += n;}
		if(a < b) {
			up(a+2,b+1,1);
			up(b+1,b+2,-(b-a-1));
		}
		tot += b-a;
	}
	ll rv = 0;
	for(int i=0;i<2*n;i++) {
		rv += qu(i);
		rt[i] = rv;
	}
	ll ma = 0,mi = 0;
	for(int i=0;i<n;i++) {
		ll sv = rt[i] + rt[i+n];
		if(sv > ma) {ma = sv;mi = i;}
	}
	printf("%lld\n",tot-ma);
}


Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#define ll long long
using namespace std;

ll const mod=1e9+7;

bool pd;
ll ans,n,k,a[200007],b[200007],sa[200007],sb[200007];
long double la[200007],lb[200007];

bool cmp(ll x,ll y){
    return x>y;
}

int main() {
    scanf("%lld%lld",&n,&k);
    for (int i=1;i<=n;++i) {
        ll x;scanf("%lld",&x);
        if (x>0) a[++a[0]]=x;
        else if (x<0) b[++b[0]]=-x;
        if (x==0) pd=true;
    }
    sort(b+1,b+b[0]+1,cmp);
    sort(a+1,a+a[0]+1,cmp);

    long double Max=-1e9;
    sa[0]=sb[0]=1;
    for (int i=1;i<=a[0]&&i<=k;++i){
        sa[i]=sa[i-1]*a[i]%mod;
        la[i]=la[i-1]+log(a[i]);
    }
    if (a[0]>=k) pd=true,ans=sa[k],Max=la[k];
    for (int i=1;i<=b[0]&&i<=k;++i){
        sb[i]=sb[i-1]*b[i]%mod;
        lb[i]=lb[i-1]+log(b[i]);
        if ((i%2==0)&&(k-i<=a[0])){
            if (lb[i]+la[k-i]>=Max) Max=lb[i]+la[k-i],ans=sb[i]*sa[k-i]%mod,pd=true;
        }
    }
    if (!pd){
        ans=1;
        for (int i=1;i<=k;++i)
            ans=ans*b[b[0]-i+1]%mod;
        ans=-ans;
    }
    if (n==k) ans=sa[a[0]]*sb[b[0]]%mod*((b[0]&1)?-1:1)%mod;
    if (n==k&&a[0]+b[0]!=n) ans=0;
    printf("%lld\n",(ans+mod)%mod);
    return 0;
}


Measured memory_bytes: 10256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;

const int inf = 1e9 + 7;
#define EPS 1e-9

int main() {
	int n, q;
	string s;
	cin >> n >> q >> s;
	vector<int> l(q), r(q);
	rep(i, q) cin >> l[i] >> r[i];

	vector<int> sum(n + 1, 0);


	for (int i = 1; i < n; ++i) {
		sum[i + 1] = sum[i];
		if (s[i - 1] == 'A' && s[i] == 'C') {
			sum[i + 1]++;
		}

	}
	rep(j, q) {
		int ans = sum[r[j]] - sum[l[j]];
		cout << ans << endl;
	}
	return 0;

}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

const int MAX=1e5+5;
int heights[MAX];
ll dp[MAX];
int n;

int main(){
    cin >> n;
    ll aux1,aux2;
    for(int i=0;i<n;i++){
        cin >> heights[i];
    }
    dp[1]=abs(heights[1]-heights[0]);
    for(int i=2;i<n;i++){
        aux1=dp[i-1]+abs(heights[i]-heights[i-1]);
        aux2=dp[i-2]+abs(heights[i]-heights[i-2]);
        dp[i]=min(aux1,aux2);
    }
    cout << dp[n-1] << endl;
    return 0;
}


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

int main(){
  int N;
  
  cin >> N;
  if (((N %1000 %100) == 0) || ((N /10 %111) == 0)){
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3604
#include<cstdio>
int a[100000+5];
int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
    }
    int ok = 1;
    for(int i = n; i >= 1; i--){
        if(i==n || a[i]<=a[i+1]) continue;
        else{
            if(a[i]==a[i+1]+1) a[i]--;
            else ok = 0;
        }
    }
    if(ok) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  int k, s; cin >> k >> s;
  int c = 0;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      c += ((s-i-j) >= 0 && (s-i-j) <= k);
    }
  }
  cout << c << endl;
}


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

int kansu(int i){
  if(i==25964)
    return 0;
    else return i;
}

typedef struct {
  double x, y;
} Point;

void print(Point p){ printf("%.8f %.8f\n", p.x, p.y); }

void plot(int n, Point p1, Point p2){
  Point s, t, u;
  double th = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  s.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y)/3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y ) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y ) * cos(th) + s.y;
  
  plot(n-1, p1, s);
  print(s);
  plot(n-1, s, u);
  print(u);
  plot(n-1, u, t);
  print(t);
  plot(n-1, t, p2);
}

main(){
  Point p1, p2;
  int n;
  scanf("%d", &n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  plot(n, p1, p2);
  print(p2);

  return 0;
}


Measured memory_bytes: 1984
# a < b
def gcd(a,b):
    if b % a == 0:
        return a
    return gcd(b % a, a)

def lcm(a,b):
    return a*b//gcd(a,b)

N = int(input())
T = [int(input()) for _ in range(N)] 
T = sorted(T)

ret = 1
for t in T:
    ret = lcm(ret, t)
print(ret)

Measured memory_bytes: 3060
A,B = map(int, input().split())

import math

Aset = set([i for i in range(math.ceil(A/0.08), math.floor((A+1)/0.08))])
Bset = set([i for i in range(math.ceil(B/0.10), math.floor((B+1)/0.10))])


ABset = Aset & Bset

if len(ABset) == 0:
    print(-1)
else:
    print(min(ABset))

Measured memory_bytes: 3064
x,y = input().split()
x = int(x)
y = int(y)

sum = 0
if x ==1 and y ==1:
  sum += 400000
 
if x == 1:
  sum += 300000
elif x == 2 :
  sum += 200000
elif x == 3:
  sum += 100000
  
if y == 1:
  sum += 300000
elif y == 2 :
  sum += 200000
elif y == 3:
  sum += 100000
 
print(sum)

Measured memory_bytes: 3064
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *                    # ll = deepcopy(l)
from heapq import *                    # heappush(hp,x)
from string import *                # alpha = ascii_lowercase
from random import *                # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *                # bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin                # bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize                # minn = -maxsize
from operator import *                # d = sorted(d.items(), key=itemgetter(1))
from itertools import *                # pre = [0] + list(accumulate(l))
from decimal import Decimal         # a = Decimal(a)    # use this for math questions
from collections import Counter        # d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l,k):
    n = len(l)
    l.sort()
    return sum(l[:k])
    

N,K = map(int, stdin.readline().rstrip().split())
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l,K)
print(ans)



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

int main(){
    char a;
    cin>>a;
    if(isupper(a)) cout<<'A'<<endl;
    else cout<<'a'<<endl;
}

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

#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif

using ll = long long;
const int N = 1e5 + 5;



int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    ll n, r;
    cin >> n >> r;

    if (n >= 10) {
        cout << r << endl;
    } else {
        cout << r + (100 * (10 - n)) << endl;
    }
    
    return 0;
%>

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


int main()
{
    int i,j;
    char s[51],t[51];

    scanf("%s %s",s,t);

    int lens = strlen(s),lent = strlen(t);

    for (i = lens - lent; i >= 0; i--)
    {
        for (j = lent - 1; j >= 0; j--)
        {
            if(s[i + j] != t[j] && s[i + j] != '?')break;
        }
        if(j == -1)
        {
            for (j = lent - 1; j >= 0; j--)
            {
                s[i + j] = t[j];
            }
            break;
        }
    }
    if(i == -1)
    {
        printf("UNRESTORABLE");
    }
    else
    {
        for (i = 0; i < lens; i++)
        {
            if(s[i] == '?')s[i] = 'a';
        }
        printf("%s",s);
    }
    
}

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

using namespace std;

typedef long long int ll;

int num[6000];
int p[6000];

int main()
{
    ios::sync_with_stdio(false);
    int x,y;;
    cin>>x>>y;
    int c=(4*x-y)/2;
    if(4*x-y>=0&&(4*x-y)%2==0){
        if(y-2*x>=0&&(y-2*x)%2==0){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 3572
package main

import (
	"fmt"
	"os"
	"strconv"
)

var (
	n, k int
	d    []int
)

func main() {
	fmt.Scan(&n, &k)
	d = make([]int, k)
	for i := range d {
		fmt.Scan(&d[i])
	}
	for i := 0; ; i++ {
		dfs("", i)
	}
}

func dfs(s string, m int) {
	if s != "" {
		v, _ := strconv.Atoi(s)
		if v >= n {
			fmt.Println(v)
			os.Exit(0)
		}
	}
	if len(s) == m {
		return
	}
	for i := 0; i <= 9; i++ {
		if !contains(d, i) {
			dfs(strconv.Itoa(i)+s, m)
		}
	}
}

func contains(a []int, x int) bool {
	for i := range a {
		if a[i] == x {
			return true
		}
	}
	return false
}


Measured memory_bytes: 512
#include<stdio.h>
 
int main(){
  int n,i,F[45];
  scanf("%d",&n);
  F[0] = 1;
  F[1] = 1;
  for(i=2;i<=n;i++)F[i] = F[i-1] + F[i-2];
  printf("%d\n",F[n]);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
using namespace std;
typedef long long int ll;
ll mod;
ll dp[2][201][11][(1<<11)];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N,K; cin >> N >> K >> mod;
    dp[0][0][1][1]=1;
    int kk=(1<<(1+K));
    for(int _=0;_<N;_++){
        for(int i=0;i<=2*N;i++){
            for(int j=0;j<=K;j++){
                for(int k=0;k<kk;k++){
                    dp[1][i][j][k]=0;
                }
            }
        }
        for(int i=0;i<2*N;i++){
            for(int j=1;j<=K;j++){
                for(int k=0;k<kk;k++){
                    if(dp[0][i][j][k]==0)continue;
                    int t=0;
                    while((k>>t)&1)t++;
                    if(t>K)continue;
                    int ii=i+t;
                    int kkk=(k>>t)+1;
                    for(int jj=1;jj<=K;jj++){
                        if((kkk>>jj)&1)continue;
                        if(ii+jj-i-j>K)continue;
                        if(i+j<ii+jj&&ii+jj<=2*N)(dp[1][ii][jj][kkk|(1<<jj)]+=dp[0][i][j][k])%=mod;
                    }
                }
            }
        }
        for(int i=0;i<=2*N;i++){
            for(int j=1;j<=K;j++){
                for(int k=0;k<kk;k++){
                    dp[0][i][j][k]=dp[1][i][j][k];
                }
            }
        }
    }
    ll ans=0;
    for(int i=0;i<2*N;i++){
        for(int j=1;j<=K;j++){
            for(int k=0;k<kk;k++){
                (ans+=dp[0][i][j][k])%=mod;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 71472
#include<bits/stdc++.h>
using namespace std;
template<typename tn> void read(tn &a){
    tn x=0,f=1;char c=' ';
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
    a=x*f;
}
#define int long long
const int N=1e7+5;
int n,a,b,ans=1;
bool is_prime[N];
int cnt,prime[N>>2];
int gcd(int x,int y){
	if(x%y==0) return y;
	return gcd(y,x%y);
}
signed main(){
	for(int i=2;i<N;i++){
		if(!is_prime[i]) prime[++cnt]=i;
		for(int j=1;j<=cnt&&prime[j]*i<N;j++){
			is_prime[prime[j]*i]=1;
			if(i%prime[j]==0) break;
		}
	}
	read(a);
	read(b);
	n=gcd(a,b);
	for(int j=1;prime[j]*prime[j]<=n;j++)
	    if(n%prime[j]==0){
	    	ans++;
	    	while(n%prime[j]==0) n/=prime[j];
		} 
	if(n>1) ans++;
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 17280
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;

    if(a>=-1000 && b>=-1000 && a<=1000 && b<=1000)
    {

    if(a>b)
    {
        cout<<"a > b"<<endl;
    }
    else if(a<b)
    {
        cout<<"a < b"<<endl;
    }

    else if(a==b)
    {
        cout<<"a == b"<<endl;
    }
    }

    return 0;
}


Measured memory_bytes: 3060
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 18, maxTS = maxN * 2, mod = 998244353, INF = 2000000001;

pair <int, int> mINF = {-INF, -INF};

struct Tree
{
	int offset, qbegin, qend;
	pair <int, int> T[maxTS], res;
	
	void qpriv(int v, int left, int right)
	{
		if (left >= qend or right <= qbegin)	
			return;
		if (left >= qbegin and right <= qend)
		{
			res = max(res, T[v]);
			return;
		}
		qpriv(v * 2, left, (left + right) / 2);
		qpriv(v*2+1, (left + right) / 2, right);
	}
	
	void init(int n)
	{
		for (offset = 1; offset < n; offset *= 2);
		FOR(i, 1, offset*2)
			T[i] = mINF;			
	}
	
	void updt(int i, pair <int, int> v)
	{
		for (i += offset; i != 0; i /= 2)
			T[i] = max(T[i], v);		
	}
	
	pair <int, int> query(int a, int b)
	{
		qbegin = a + offset;
		qend = b + offset;
		res = mINF;
		qpriv(1, offset, offset * 2);
		return res;
	}
}tree;

pair <int, int> T[maxN];
long long dp[maxN][2];

int End(int i)
{	return T[i].ft + T[i].sd;	}

void solve()
{
	int n;
	scanf ("%d", &n);
	FOR(i, 0, n)
		scanf ("%d%d", &T[i].ft, &T[i].sd);
	sort(T, T+n);
	dp[n-1][0] = dp[n-1][1] = 1ll;
	tree.init(n);
	tree.updt(n-1, {End(n-1), n-1});
	FORD(i, n-2, -1)
	{
		dp[i][1] = (dp[i+1][0] + dp[i+1][1]) % mod;
		int j = lower_bound(T, T+n, make_pair(End(i), -INF)) - T;
		if (j == i+1)
			dp[i][0] = dp[i][1];
		else
		{
			j = tree.query(i, j).sd;
			dp[i][0] = dp[j][0];
		}
		tree.updt(i, {End(i), i});
	}
	
	printf("%lld\n", (dp[0][0] + dp[0][1]) % mod);
} 

 
int main()
{
	//ios_base::sync_with_stdio(false);
    int t;
    t=1;//scanf ("%d", &t);
    while (t--)
    	solve();
    return 0;    
}


Measured memory_bytes: 10496
n = list(map(int,input()))

if len(n) == 1:
    print(n[0])
    exit()

if n[1:].count(9) == len(n) -1:
    print(n[0] + (len(n)-1)*9)
else:
    print(n[0]-1 + (len(n)-1)*9)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){
    string s; cin >> s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3;
    else if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S') cout << 0;
    else if((s[0] == 'R' && s[1] == 'R') || (s[2] == 'R' && s[1] == 'R') || (s[3] == 'R' && s[1] == 'R')) cout << 2;
    else cout << 1;


}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

M, D = map(int, input().split())

ans = 0
if D >= 22:
    for day in range(22, D+1):
        d1 = day % 10
        d10 = day // 10
        m = d1 * d10
        if d1 >= 2 and d10 >= 2:
            if 1 <= m and m <= M:
                ans += 1

print(ans)

Measured memory_bytes: 38256
import java.util.Scanner;
public class Main{
	int x;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		x = sc.nextInt();
		System.out.println(x*x*x);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17172
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (A, B, C) = Slice3<long>();
            if (C <= A + B)
                WriteLine("Yes");
            else
                WriteLine("No");
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27220
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
string s;
cin >> s;

ll white = 0,red = 0;
ll sign = 0;
rep(i,n){
    if(s[i] == 'R')
        red++;
}
rep(i,red){
    if(s[i] == 'W')
        sign++;
}
cout << sign << endl;
}

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

const ll INF=1001001001;

int main(){
    ll n,m,x;
    cin >> n >> m >> x;
    vector<ll> price(n);
    vector<vector<ll>> a(n,vector<ll>(m));
    vector<ll> pr(m,0);
    rep(i,n){
        cin >> price[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    ll ans = INF;
    for(ll tmp=1;tmp<(1<<12);tmp++){
        bitset<12> s(tmp);
        bool flag=true;
        ll sum=0;
        rep(i,n){
            if(s.test(i)){
                sum += price[i];
                rep(j,m){
                    pr[j] += a[i][j];
                }
            }
        }
        rep(i,m){
            if(pr[i]<x){
                flag=false;
                break;
            }
        }
        rep(i,m){
            pr[i]=0;
        }
        if(flag){
            ans = min(sum,ans);
        }
    }
    if(ans==INF) cout<< -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=300005,M=1000005;
const ll inf=0x3f3f3f3f3f3f3f3fll;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int gcd(int x,int y){
	if (!y) return x;
	int r=x%y;
	while (r){x=y;y=r;r=x%y;}
	return y;
}
int n,m,Q,p,g,z,cnt,a[50005][2][3],fa[N],h[M][2];
struct node{int u,v,w;}e[N];
bool cmp(node x,node y){return x.w<y.w;}
int find(int x){return (x==fa[x]) ? x : fa[x]=find(fa[x]);}
void merge(int x,int y){x=find(x),y=find(y);fa[x]=y;}
int main(){
	n=read();m=read();Q=read();p=read();g=0;
	for (int i=1;i<=m;i++) e[i].u=read(),e[i].v=read(),e[i].w=read();
	sort(e+1,e+m+1,cmp);
	for (int i=2;i<=m;i++) g=gcd(g,e[i].w-e[i-1].w);
	if (!g) g=p;p=gcd(p,g*3);z=e[1].w%g%p;
	for (int i=1;i<=m;i++) e[i].w=e[i].w%p-z;
	for (int i=z,j=0;!h[i][j];i=(i*2)%p,j^=1) h[i][j]=1;
	
	for (int i=1;i<=n;i++)
	for (int j=0;j<2;j++)
	for (int k=0;k<3;k++) a[i][j][k]=++cnt;
	for (int i=1;i<=cnt;i++) fa[i]=i;
	for (int i=1;i<=m;i++)
	for (int j=0;j<2;j++)
	for (int k=0;k<3;k++){
		int u=e[i].u,v=e[i].v,w=e[i].w;
		merge(a[u][j][k],a[v][j^1][(k*2+w/g)%3]);
		merge(a[v][j][k],a[u][j^1][(k*2+w/g)%3]);
	}
	
	while (Q--){
		int u=read(),v=read(),r=read(),fl=0;
		for (int i=0;i<2;i++)
		for (int j=0;j<3;j++)
		if (find(a[v][0][0])==find(a[u][i][j])) fl|=h[(r+z-j*g%p+p)%p][i];
		puts(fl ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 12672
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main() {
	int N,K;
	cin>>N>>K;
	int A[SIZE]={};
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		A[a]++;
	}
	vector<pint> so;
	for(int i=0;i<=200001;i++){
		if(A[i]){
			so.pb(mp(A[i],i));
		}
	}
	sort(so.begin(),so.end());
	int sum=0;
	if(so.size()<=K){
		cout<<0<<endl;
		return 0;
	}
	for(int i=0;i<so.size()-K;i++){
		sum+=so[i].first;
	}
	cout<<sum<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD=1e9+7;

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


  ll n,m;cin>>n>>m;
  std::vector<ll> v(n,0);
  for(int i=0;i<m;i++){
      ll a,b;cin>>a>>b;
      a--;b--;
      v[a]++;v[b]++;
  }
  bool flag=true;
  for(int i=0;i<n;i++)if(v[i]%2) flag=false;
  if(flag) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 1024
n = gets.chomp.to_i
b = gets.chomp.split(' ').map{|i| i.to_i }

sum = b[0] + b.last
(n - 2).times{|i|
  bmin = b[i] < b[i + 1] ? b[i] : b[i + 1]
  sum += bmin
}

puts sum


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

int main()
{
    int k,a,b;
    int i,sum;
    scanf("%d",&k);
    scanf("%d %d",&a,&b);
    for(i=1;i<=1000;i++){
        sum=i*k;
        if(sum>=a && sum<=b){
            printf("OK");
            break;
        }
        else if(sum>b){
            printf("NG");
            break;
        }
    }
    return 0;
}


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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int N = 1e5 + 7;
int a[N];
long long s[N];
int n;
long long m;

long long cate(int value) {
    int j(n);
    long long ans(0);
    for (int i = 1; i <= n; ++i) {
        while (j > 1 && a[j - 1] + a[i] >= value)
            --j;
        if (a[j] + a[i] >= value)
            ans += n - j + 1;
    }
    return ans;
}

int bs() {
    int pas(1<<17), r(0);
    while (pas) {
        if (cate(r + pas) >= m)
            r += pas;
        pas >>= 1;
    }
    return r;
}

int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; ++i)
        s[i] = s[i - 1] + a[i];
    int x = bs();
    long long y = cate(x);
    assert(y >= m && cate(x + 1) < m);
    int j(n);
    long long ans(0);
    for (int i = 1; i <= n; ++i) {
        while (j > 1 && a[j - 1] + a[i] >= x)
            --j;
        if (a[j] + a[i] >= x)
            ans += s[n] - s[j - 1] + 1LL * a[i] * (n - j + 1);
    }
    cout << ans + (m - y) * x;
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>

int main(void){
	char s[131072],t[131072];
	int q,a,b,c,d,i,sl,tl;
	int w,x,y,z;
	int sa[131072]={0},sb[131072]={0};
	int ta[131072]={0},tb[131072]={0};
	scanf("%s%s",s,t);
	sl = strlen(s);tl = strlen(t);
	for(i = 0;i < sl;i++){
		if(s[i] == 'A'){sa[i+1] = sa[i]+1;sb[i+1] = sb[i];}
		else{sb[i+1] = sb[i]+1;sa[i+1] = sa[i];}
	}
	for(i = 0;i < tl;i++){
		if(t[i] == 'A'){ta[i+1] = ta[i]+1;tb[i+1] = tb[i];}
		else{tb[i+1] = tb[i]+1;ta[i+1] = ta[i];}
	}
	scanf("%d",&q);
	for(i = 1;i <= q;i++){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		w = sa[b]-sa[a-1];
		x = sb[b]-sb[a-1];
		y = ta[d]-ta[c-1];
		z = tb[d]-tb[c-1];
		if((w*2+x)%3 == (y*2+z)%3){printf("YES\n");}else{printf("NO\n");}
	}
	return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>

int main(void){
  int n, b[100];
  int i, sum = 0;
  scanf("%d",&n);
  for(i = 0; i < n - 1; i++){
    scanf("%d",&b[i]);
  }
  sum = sum + b[0];
  for(i = 0; i < n - 1; i++){
    sum = sum + b[i];
    if(i > 0 && b[i - 1] >= b[i]){
      sum = sum - b[i - 1] + b[i];
    }
  }
  printf("%d",sum);
  return 0;
}


Measured memory_bytes: 256
/*  
    ┬┴┬┴┤(･_├┬┴┬┴ hiding from those WAs
*/

#include <bits/stdc++.h>
using namespace std;

void ngk(){
    string s;
    cin >> s;
    set <int> z;
    for(auto v: s)	z.insert(v);
    if (z.size() == 1)
    	cout << "No";
    else
    	cout << "Yes";
}

int main(int argc, char *argv[]){
    iostream::sync_with_stdio(0);
    int test = 1;
    while(test--){
        ngk();
    }
    return 0;
}

Measured memory_bytes: 256
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
l = inp.shift().split(" ")
A = l.shift() * 1
B = l.shift() * 1
C = l.shift() * 1
K = l.shift() * 1

if (K - A < 0) {
    console.log(K)
} else {
    k = K - A;
    if (k - B < 0) {
        console.log(A)
    } else {
        k = k - B
        if (k - C < 0) {
            console.log(A - k)
        } else {
            console.log(A - C)
        }
    }
}


Measured memory_bytes: 29848
from heapq import heappush, heappop
n, m = map(int, input().split())
jobs = {}
for _ in range(n):
  a, b = map(int, input().split())
  if a > m:
    continue
  if a in jobs:
    jobs[a].append(b)
  else:
    jobs[a] = [b]
result = 0
candidates = []
for a in range(1, m + 1):
  if a in jobs:
    for b in jobs[a]:
      heappush(candidates, -b)
  else:
    if len(candidates) == 0:
      continue
  result += -heappop(candidates)
print(result)

Measured memory_bytes: 26072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll ans=0;
  ll n;
  cin >> n;
  for(ll i=1;i<=n;i++) {
    if(i%3&&i%5) ans+=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
MOD = 998244353


def main():
    N, S = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    dp = [[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        dp[i+1][0] += 1
        for j in range(S+1):
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= MOD
            if j + A[i] <= S:
                dp[i+1][j+A[i]] += dp[i][j]
                dp[i+1][j+A[i]] %= MOD
    ans = 0
    for i in range(N+1):
        ans += dp[i][S]
        ans %= MOD
    print(ans % MOD)


if __name__ == '__main__':
    main()


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


vector<int> todecimal(int n) {
  if (n == 0) return {0};
  vector<int> ret;
  while (n) {
    ret.push_back(n % 10), n /= 10;
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  reverse(A.begin(), A.end());
  for (int j = 0; ; ++j) {
    auto d = todecimal(j);
    bool find = false;
    for (int i = 0; not find and i + d.size() <= n; ++i) {
      bool test = true;
      for (int k = 0; k < d.size(); ++k) {
        test &= d[k] == A[i + k];
      }
      find |= test;
    }
    if (not find) cout << j << '\n', exit(0);
  }
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = ((res % m) * (x % m)) % m;
        x = ((x % m) * (x % m)) % m;
        p >>= 1;
    }
    return res % m;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm(int a, int b){
    return a / gcd(a, b) * b;
}

const int N = 2e3 * 2e3 + 5;

int main() {
    ll n = LLD(), a = LLD(), b = LLD();
    printf("%lld", min(a * n, b));
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i,n ;
    int arr[100];
    scanf("%d",&n);
    for(i = 0;i < n; i++){
        scanf(" %d",&arr[i]);
    }
    for(i = 0; i < n;i++){
        if(i)printf(" ");
        printf("%d",arr[n-i-1]);
    }
    printf("\n");
    return 0;
    
}



Measured memory_bytes: 2732
#include<bits/stdc++.h>
using namespace std;
const int N = 4001, mod = 998244353;

int n;
vector<bitset<N> > a;
bitset<N> k;

string in;

int sz (bitset<N> &T) {
	for(int i=N;i--;) {
		if(T[i] == 1) return i+1;
	}
	return 0;
}

int val (bitset<N> T) {
	int R = 0;
	for(int i=N;i--;) {
		R = (2*R + T[i]) % mod;
	}
	return (R + 1) % mod;
}

bool cmp (bitset<N> A, bitset<N> B) {
	for(int i=N;i--;) {
		if(A[i] < B[i]) return true;
		if(A[i] > B[i]) return false;
	}
	return false;
}

void elim (bitset<N> &A, bitset<N> &B) {
	int S = sz(B)-1;
	for(int i=N-1;i>=S;i--) {
		if(A[i] == 1) A ^= (B << (i-S));
	}
}

int main()
{
	cin >> n >> in;
	k = bitset<N>(in);
	for(int i=1;i<=n;i++) {
		cin >> in;
		a.push_back(bitset<N>(in));
	}
	for(int i=1;i<n;i++) {
		if(sz(a[0]) > sz(a[i])) {
			swap(a[0], a[i]);
		}
	}
	while(a.size() > 1) {
		auto &A = a[0], &B = a.back(), T = B;
		elim(B, A);
		swap(A, B);
		if(sz(A) == 0) {
			A = T;
			swap(A, B);
			a.pop_back();
		}
		else {
			a.push_back(T);
		}
	}
	auto T = k;
	elim(T, a[0]);
	cout << (val(k>>(sz(a[0])-1)) + mod - cmp(k, k^T)) % mod << endl;
}


Measured memory_bytes: 1420
#include <bits/stdc++.h>
using namespace std;
//int 整数 double 小数（実数） string 文字列 bool 0以外真 if else char ''
// != 等しくない true 1 真  false 0 偽
// ! 偽 && かつ || または 文字列変数.size() 文字数 文字列.at(i)　i文字目

int main() {

    int n;
  cin >> n;
  if(n <= 999){
      cout << "ABC" << endl;
  }
  if(n > 999){
      cout << "ABD" << endl;
  }
}


Measured memory_bytes: 256
#include<math.h>
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
 
#include<map>
using std::map;
 
#include<string>
using std::string;
 
#include<stdlib.h>
long long int P=1000000007;


int main(void){
		long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		if(0>c-a-b){
		printf("No"); return 0;
		}	
	

	if((a+b-c)*(a+b-c)>4*a*b){
		printf("Yes");
	}else{
		printf("No");
	}
}


Measured memory_bytes: 256