akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int H, W;

    scanf("%d%d", &H, &W);

    char a[H][W+1];

    for(int i = 0; i < H; i++){
        scanf("%s", a[i]);
    }

    for(int i = 0; i < W + 2; i++){
        printf("#");
    }
    printf("\n");

    for(int i = 0; i < H; i++){
        printf("#");
        printf("%s", a[i]);
        printf("#\n");
    }

    for(int i = 0; i < W + 2; i++){
        printf("#");
    }
    printf("\n");

    return 0;
}

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

int main() {
  string N;
  cin >>N;
  int X = N.size()-1;
  
  if(N.at(X)=='3')
  cout<<"bon";
  
  else if(N.at(X)=='0'||N.at(X)=='1'||N.at(X)=='6'||N.at(X)=='8')
  cout<<"pon";
  
  else
  cout<<"hon";
}

Measured memory_bytes: 3616
l = input().split()

for i in range(len(l)):
    l[i] = int(l[i])

w = l[0]    
a = l[1]
b = l[2]

if a + w < b:
    print(b - a - w)
elif b + w < a:
    print(a - b - w)
else:
    print(0)

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var max = 10 * 10 * 10 * 10 * 10 * 10;
        var count = new int[max + 1];
        for (int i = 0; i < n; i++)
        {
            count[arr[i]]++;
        }
        var isMultiples = Enumerable.Repeat(true, max + 1).ToArray();
        foreach (var value in arr.Distinct())
        {
            for (int i = value * 2; i <= max; i += value)
                isMultiples[i] = false;
        }
        var answer = 0;
        for (int i = 0; i < n; i++)
        {
            if (isMultiples[arr[i]] && count[arr[i]] == 1) answer++;
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 53216
#include<bits/stdc++.h>
#define ll long long 
#define ld long double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX 10000003
using namespace std;
vector<vector<vector<ld>>> dp(310,vector<vector<ld>>(310,vector<ld>(310,-1)));
ld count(ll n,ll a,ll b,ll c)
{
    if(a+b+c==0) return 0.00;
    if(dp[a][b][c]!=-1) return dp[a][b][c];
    ld k=a+b+c;
    ld sum=n/k;
    if(a) sum+=(a/k)*count(n,a-1,b,c);
    if(b) sum+=(b/k)*count(n,a+1,b-1,c);
    if(c) sum+=(c/k)*count(n,a,b+1,c-1);
    return dp[a][b][c]=sum;
}
void solve()
{
    ll n;  cin>>n;
    ll a=0,b=0,c=0,x;
    rep(i,0,n)
    {
        cin>>x;
        if(x==1) a++;
        else if(x==2) b++;
        else if(x==3) c++;
    }
    cout<<fixed<<setprecision(12)<<count(n,a,b,c);
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    return 0;
}


Measured memory_bytes: 474160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b)+min(c,d) << endl;
}

Measured memory_bytes: 256
N,M,Q = map(int,input().split())
qs = [list(map(int,input().split())) for i in range(Q)]

from itertools import combinations_with_replacement 
com = combinations_with_replacement(range(1,M+1),N)

ans = 0
for A in com:
    tmp = 0
    for a,b,c,d in qs:
        if (A[b-1] - A[a-1] == c): tmp += d
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 9168
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

typedef long long llong;
using namespace std;



int main() {
	char ch[1300];
	fgets(ch,1201,stdin);
	for (int i = 0; ch[i] != '\0'; i++) {
		if (65 <= ch[i] && ch[i] <= 90)ch[i] += 32;
		else if (97 <= ch[i] && ch[i] <= 122)ch[i] -= 32;
	}
	cout << ch;
	return 0;
}



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

#define rep(i, n) for(int i = 0; i < (n); ++i)

typedef long long ll;
typedef pair<ll, ll> P;

const int MAX = 1e6 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

ll dataa[MAX], datb[MAX];

int N;
void initA(int n) {
    N = 1;
    while (N < n) N *= 2;
    if (N == 1) N *= 2;
    rep(i, N) dataa[i] = 0;
}

void initB() {
    rep(i, N) datb[i] = 0;
}

void add(int a, int b, ll x, int k, int l, int r) {
    if (a <= l && r <= b) {
        dataa[k] += x;
    } else if (l < b && a < r) {
        datb[k] += (min(b, r) - max(a, l)) * x;
        add(a, b, x, k * 2 + 1, l, (l + r) / 2);
        add(a, b, x, k * 2 + 2, (l + r) / 2, r);
    }
}

ll sum(int a, int b, int k, int l, int r) {
    if (b <= l || r <= a) return 0;
    else if (a <= l && r <= b) {
        return dataa[k] * (r - l) + datb[k];
    } else {
        ll res = (min(b, r) - max(a, l)) * dataa[k];
        res += sum(a, b, k * 2 + 1, l, (l + r) / 2);
        res += sum(a, b, k * 2 + 2, (l + r) / 2, r);
        return res;
    }
}

int main(){
    ll n, D, A;
    cin >> n >> D >> A;

    initA(n);
    initB();

    vector<P> V(n);
    rep(i, n) {
        int x, h;
        cin >> x >> h;
        V[i] = P(x, h);
    }

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

    ll ans = 0;
    rep(i, n) {
        ll xi = V[i].first;
        ll h = V[i].second - sum(i, i + 1, 0, 0, N) * A;
        if (h < 0) continue;
        int r = lower_bound(V.begin(), V.end(), P(xi + 2 * D + 1, 0)) - V.begin();
        ll res = (h + A - 1) / A;
        ans += res;
        add(i, r, res, 0, 0, N);
    }

    cout << ans << endl;
}

Measured memory_bytes: 13568
//Name: Project Management
//Level: 2
//Category: グラフ,Graph,DAG,最長経路
//Note:

/*
 */
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define FOREACH(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); ++it)
#define TIMES(i,n) for(int i = 0; i < (n); ++i)

struct Edge {
    int from, to;
    int cost;
};

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

    int N, M;
    while(cin >> N >> M) {
        vector<Edge> edges(M);
        TIMES(i, M) {
            Edge &edge = edges[i];
            cin >> edge.from >> edge.to >> edge.cost;
        }
        vector<int> dist(N, 0);
        TIMES(_, N) {
            FOREACH(it, edges) {
                const Edge &edge = *it;
                dist[edge.to] = max(dist[edge.to], dist[edge.from] + edge.cost);
            }
        }
        cout << *max_element(dist.begin(), dist.end()) << endl;
    }
    return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a,b;
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl;
    else cout<<0<<endl; 
    return 0;
 } 

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

int main(){
	int y, m, d;
	char c1, c2;
	cin >> y >> c1 >> m >> c2 >> d;
	cout << (m <= 4 ? "Heisei" : "TBD") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>

using namespace std;

int bottomUp(const vector<int> &h)
{
	vector<int> dp(h.size());
	int n = h.size() - 1;

	dp[n] = 0;
	dp[n-1] = dp[n] + abs(h[n - 1] - h[n]);

	for(int i = n-2; i >= 1;i--)
		dp[i] = min(dp[i + 1] + abs(h[i] - h[i + 1]), dp[i + 2] + abs(h[i] - h[i + 2]));
	
	return dp[1];
}



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

	vector<int> h(n+1);

	for(int i = 1;i < h.size();i++)
		cin>>h[i];
	
	cout<<bottomUp(h)<<'\n';
	return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>

std::vector<int> bit_found(unsigned int n)
{
    std::vector<int> v;
    int end = n;
    for (int i=0; i<=end; n=(n>>1),++i) {
        if ( 0 != (n&0x01) ) v.push_back(i+1);
    }
    return v;
}

int main(int argc, char **argv)
{
    std::string input;
    std::getline(std::cin, input);

    long long int answer = std::atoll(input.c_str());
    int count = std::pow(2, input.length()-1);

    for (int i=1; i<count; ++i) {
        std::vector<int> bits = bit_found(i);
        int bitcounted = bits.size();
        int j=0;
        answer += std::atoll(input.substr(0, bits[j]).c_str());
        for (j=1; j<bitcounted; ++j) {
            answer += std::atoll(input.substr(bits[j-1], bits[j]-bits[j-1]).c_str());
        }
        answer += std::atoll(input.substr(bits[j-1]).c_str());

    }

    std::cout << answer << std::endl;

    return 0;
}

Measured memory_bytes: 384
#include <stdlib.h>
#include <iostream>
using namespace std;

struct card{
	char value;
	char suit;
};
void bubble_sort(card *array, int n);
void selection_sort(card *array, int n);
bool is_stable(card *stable, card *compare, int n);
void print_array(card *array, int size);
void print_stable(bool is_stable);

int main(){
	int n;

	cin >> n;

	card* bubble = (card*)malloc(n * sizeof(card));
	card* select = (card*)malloc(n * sizeof(card));

	if(n < 1){
		return 0;
	}

	for(int i = 0; i < n; i++){
		string card;
		cin >> card;

		bubble[i].suit  = card[0];
		bubble[i].value = card[1];

		select[i].suit  = card[0];
		select[i].value = card[1];
	}
	bubble_sort(bubble, n);
	selection_sort(select, n);

	print_array(bubble, n);
	// bubble sort is always stable
	print_stable(true);

	print_array(select, n);
	print_stable(is_stable(bubble, select, n));
	return 0;
}

void bubble_sort(card *array, int n){
	for(int i = n-1; i > 0; --i){
		bool is_swaped = false;
		for(int j = 0; j < i; ++j){
			if(array[j].value > array[j+1].value){
				swap(array[j], array[j+1]);
				is_swaped = true;
			}
		}
		if(!is_swaped){
			return;
		}
	}
}
void selection_sort(card *array, int n){
	for(int i = 0; i < n; ++i){
		bool is_swaped = false;
		int minj = i;
		for(int j = i; j < n; ++j){
			if(array[j].value < array[minj].value){
				minj = j;
				is_swaped = true;
			}
		}
		if(is_swaped){
			swap(array[i], array[minj]);
		}
	}
}

void print_array(card *array, int size){
	for(int i = 0; i < size; i++){
		cout <<  array[i].suit << array[i].value;
		if(i != size - 1){
		cout << " " ;
		}
	}
	cout << endl;
}

bool is_stable(card *stable, card *compare, int n){
	for(int i = 0; i < n; ++i){
		if(stable[i].suit != compare[i].suit){
			return false;
		}
	}
	return true;
}
void print_stable(bool is_stable){
	if(is_stable){
		cout << "Stable" << endl;
	}else{
		cout << "Not stable" << endl;
	}
}

Measured memory_bytes: 1200
// In the name of Allah the Most Merciful.

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

typedef long long ll;

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

    int n;
    cin >> n;
    vector<int>v(n);
    for(auto &x:v)cin >> x;
    vector<int>temp = v;
    sort(temp.begin() , temp.end());
    for(int i=0;i<v.size();i++){
        if(v[i]==temp[v.size()-1]){
            cout << temp[v.size()-2] << endl;
        }
        else cout << temp[v.size()-1] << endl;
    }

    return 0;
}


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


int main() {
	int N, M, X,lcount=0, uCount=0,tmp;
	cin >> N >> M >> X;
	for (int i = 1; i <= M ; i++)
	{
		cin >> tmp;
		if (tmp>X)
		{
			uCount++;
		}
		else {
			lcount++;
		}
	}
	int ans = min(uCount, lcount);
	cout << ans << endl;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int k,n;
	cin >> k >> n;
	std::vector<int> a(n);
	rep(i,n) cin >> a[i];

	int sum = 0;
	int max = 0;
	rep(i,n-1){
		int d = a[i+1] - a[i];
		chmax(max, d);
	}
	int d = a[0] + (k - a[n-1]);
	chmax(max, d);

	cout << k - max << endl;

  return 0;
}


Measured memory_bytes: 1024
// {{{ Templates
#include <bits/stdc++.h>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

// }}}

inline int convert(const char c)
{
    if (c >= 'A' and c <= 'Z') {
        return c - 'A';
    } else {
        return c - 'a' + 26;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string s1, s2;
    cin >> s1 >> s2;
    vector<int> dir;  // 1 -> vertical
    int i = 0;
    while (i < N) {
        if (s1[i] == s2[i]) {
            dir.push_back(1);
            i++;
        } else {
            dir.push_back(0);
            i += 2;
        }
    }
    bool prev_vertical = false;
    ll cnt = 0;
    if (dir[0] == 1) {
        cnt = 3;
        prev_vertical = true;
    } else {
        cnt = 6;
        prev_vertical = false;
    }
    for (int i = 1; i < dir.size(); i++) {
        if (dir[i] == 1) {
            if (prev_vertical) {
                cnt = (cnt * 2) % MOD;
            } else {
                cnt = cnt;
            }
            prev_vertical = true;
        } else {
            if (prev_vertical) {
                cnt = (cnt * 2) % MOD;
            } else {
                cnt = (cnt * 3) % MOD;
            }
            prev_vertical = false;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
int a,b;
cin>>a;
cin>>b;
int s=0;
if(1<=a&&a<=10000&&1<=b&&b<=10000)
{
while(a>0)
{
    a=a-b;
    s++;
}
cout<<s;
}

else
{
    cout<<"error";
}
    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

const ll INF=1e9;
const int MOD=1e9+7;

int main(){
    ll N; cin >> N;
    map<pair<ll,ll>,ll> ma;
    ll ans=0;
 
    for(int i=0;i<N;i++){
        double a; cin >> a;
        ll res=llround(a*INF);
        ll cnt2=0; ll cnt5=0;
        while(res%2==0&&res){
            res/=2;
            cnt2++;
        }
        while(res%5==0&&res){
            res/=5;
            cnt5++;
        }
        //cout << cnt2 << " " << cnt5  << endl;
        for(auto it=ma.begin();it!=ma.end();it++){
            ll tmp2=it->first.first+cnt2;
            ll tmp5=it->first.second+cnt5;
            if(min(tmp2,tmp5)>=18) ans+=it->second;
        }
        ma[{cnt2,cnt5}]++;
        //cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
def solve():
    rec = [1000000] * 1000000
    rec[0] = 0
    odd_rec = rec.copy()
    
    for i in range(1, 181):
        t = i * (i + 1) * (i + 2) // 6
        for i, tpl in enumerate(zip(rec[t:t*3+1], rec), start=t):
            a, b = tpl
            b += 1
            if b < a:
                rec[i] = b
        if t % 2:
            for i, tpl in enumerate(zip(odd_rec[t:t*34+1], odd_rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    odd_rec[i] = b
    
    import sys
    file_input = sys.stdin
    n = int(file_input.readline())
    while n:
        print(rec[n], odd_rec[n])
        n = int(file_input.readline())

solve()


Measured memory_bytes: 28992
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
bool used[int(2e5 + 5)];
int main(){
  scanf("%d%d", &N, &M);

  int A = 1, B = N;
  for (int i = 0; i < M; i++){
    if ((N + A) - B == B - A) B--;
    while (used[(N + A) - B] || used[B - A]) B--;
    used[(N + A) - B] = true;
    used[B - A] = true;    
    printf("%d %d\n", A, B);
    A++; B--;
  }

  return 0;
}


Measured memory_bytes: 3912
#include<iostream>


using namespace std;
int main(){
  int t;
  cin>>t;
  int n;
  cin>>n;
  int count=0;
  while(t--){
      int a,b;
      cin>>a>>b;
      if(sqrt((pow(a,2)+pow(b,2)))<=n){
          count++;
      }
      
  }
  cout<<count;
}






Measured memory_bytes: 3196
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

int N, m, D[500], cnt[500], xs[40], as[40];
set<vector<int> > ans;

void rec(int c, int k) {
    if(c==N) {
        rep(i, N) as[i] = xs[i];
        sort(as, as+N);
        rep(i, N-1) as[i] = as[i+1]-as[i];
        ans.insert(vector<int>(as, as+N-1));
        return ;
    }
    while(cnt[D[k]]==0) k++;
    rep(t, 2) {
        int x = t ? D[k] : D[0]-D[k];
        xs[c] = x;
        bool ok = true;
        rep(i, c) if(cnt[abs(xs[i]-x)]--==0) ok = false;
        if(ok) rec(c+1, k+1);
        rep(i, c) cnt[abs(xs[i]-x)]++;
    }
}

int main() {
    for(;;) {
        scanf("%d", &N);
        if(N==0) return 0;
        m = N*(N-1)/2;
        rep(i, m) scanf("%d", D+i);
        memset(cnt, 0, sizeof(cnt));
        rep(i, m) cnt[D[i]]++;
        xs[0] = 0;
        xs[1] = D[0];
        cnt[D[0]]--;
        ans.clear();
        rec(2, 1);
        for(set<vector<int> >::iterator it=ans.begin(); it!=ans.end(); it++) {
            const int n = it->size();
            rep(i, n) printf("%d%c", (*it)[i], i<n-1 ? ' ' : '\n');
        }
        puts("-----");
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll  sb[200005];ll hb[200005];
int main(){
	int n;cin>>n;
	for(ll i=0;i<n;i++){
	cin>>sb[i];hb[sb[i]]++;	
	} ll sum=0;
	for(ll i=0;i<=n;i++)
		sum+=hb[i]*(hb[i]-1)/2;
	for(ll i=0;i<n;i++)
	cout<<sum-hb[sb[i]]*(hb[sb[i]]-1)/2+(hb[sb[i]]-1)*(hb[sb[i]]-2)/2<<"\n";
}

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

int main()
{
    string s;
    cin >> s;
    int i = 0;
    while (i < s.size() && s[i] != 'A') {
        i++;
    }
    int j = s.size() - 1;
    while (j >= 0 && s[j] != 'Z') {
        j--;
    }
    cout << j - i + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include <algorithm>
#include<math.h>
#include<stdio.h>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<functional>

using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)


int main(){
	int a[4];int b[2];
	FOR(i,4){cin>>a[i];}
	FOR(i,2){cin>>b[i];}
	sort(a,a+4,greater<int>());
	sort(b,b+2,greater<int>());
	cout<<a[0]+a[1]+a[2]+b[0]<<endl;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
//fflush(stdin);
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll a,b;
    cin>>a>>b;
    ll ans=max(a+b,a-b);
    cout<<max(ans,a*b)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
  int a[4];
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  if (a[0] <= a[2] && a[1] <= a[2])
  	printf("%d",a[1]+a[0]);
  else if (a[0] <= a[1] && a[2] <= a[1])
    printf("%d",a[2]+a[0]);
  else
    printf("%d",a[2]+a[1]);
}

Measured memory_bytes: 128
while input = gets
  a = input.split.map(&:to_i)
  i = (a[1]*a[5]-a[4]*a[2])/(a[3]*a[1]-a[0]*a[4]).to_f + 0.000
  j = (a[0]*a[5]-a[2]*a[3])/(a[0]*a[4]-a[1]*a[3]).to_f + 0.000
  print sprintf("%.3f",i)
  print "\s"
  puts sprintf("%.3f",j)
end


Measured memory_bytes: 6852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;
  
  int64_t s = 0;
  
  if ( A >= K) {
    s = K;
  } else if ( A + B >= K) {
    s = A;
  } else {
    s = A - (K - (A + B));
  }
  
  cout << s << endl;
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const int INF = 1e9;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
int main() {
    int n;
    cin >> n;
    cout << pow(n, 3) << endl;
}

Measured memory_bytes: 384
main(){
    int card[4][13]={0};
    int num,n;
    char m;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%c", &m);
        scanf("%c %d",&m,&num);
        if(m=='S')card[0][num-1]=1;
        else if(m=='H')card[1][num-1]=1;
        else if(m=='C')card[2][num-1]=1;
        else if(m=='D')card[3][num-1]=1;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(card[i][j]==0){
                if(i==0)printf("S %d\n",j+1);
                else if(i==1)printf("H %d\n",j+1);
                else if(i==2)printf("C %d\n",j+1);
                else if(i==3)printf("D %d\n",j+1);
            }
        }
    }
}


Measured memory_bytes: 2052
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b){return !b ? a : gcd(b, a % b);}
ll modP(ll a, ll b) {return (!b ? 1 : (modP(a, b / 2) * modP(a, b / 2) * (b % 2 ? a : 1)) % MOD);}

ll dp[maxN], sum[maxN];
int c[maxN];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, l = 0;
	cin >> n;
	for (int i = 1; i <= n; i++){
		int tmp;
		cin >> tmp;
		if (tmp != c[l]){
			c[++l] = tmp;
		}
	}
	dp[0] = 1;
	for (int i = 1; i <= l; i++){
		sum[c[i]] += dp[i - 1];
		sum[c[i]] %= MOD;
		dp[i] = sum[c[i]];
	}
	cout << dp[l] << endl;
	return 0;
}



Measured memory_bytes: 4224
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;

typedef long long Int;
string str;
#define MOD 1000000007
bool s[2160000];
void getstr(){
	str = "";
	char c = 'a';
	while(c != '\n'){
		c = getchar();
		if(c == ' ' || c == '\n')continue;
		str += c;
	}
}

Int getnum(Int &x){
	Int res = 0;
	Int base = 1;            
	while(x >= 0 && '0' <= str[x] && str[x] <= '9'){
		res += base * (str[x] - '0');
		base *= 10;
		x--;
	}
	return res;
}

Int solve(Int &x){
	Int res;
	if(str[x] == '>'){
		x--;
		res = solve(x);
		res = (res * res) % MOD;
		x -= 2;
	}
	else{
		res = getnum(x);
	}
	
	
	if(x >= 0 && str[x] == '>'){
		x -= 2;
		return solve(x) >> min(32LL, res);
	}
	return res;

}


int main(){
	while(true){
		getstr();
		if(str == "#")return 0;
		Int x = str.size() - 1;
		cout << solve(x) << endl;
	}
}

Measured memory_bytes: 2340
from copy import deepcopy
from itertools import permutations


def warshallfloyd(N, LIST):  # ワーシャルフロイド法:全頂点対最短経路 O(n**3)
    DIST = deepcopy(LIST)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j])
    return DIST


n, m, r = map(int, input().split())
town = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]

mat = [[10 ** 10] * n for _ in range(n)]
for i in range(n):
    mat[i][i] = 0
for a, b, c in abc:
    mat[a - 1][b - 1] = c
    mat[b - 1][a - 1] = c

ans = float('inf')
dist = warshallfloyd(n, mat)
for route in permutations(town, r):
    tmp = 0
    for i, j in zip(route[:-1], route[1:]):
        tmp += dist[i - 1][j - 1]
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 78400
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
using namespace std;

int main() {
    int n;
    int m;
    int l;
    int k = 0;
    
    cin >> n >> m;
    
    int a[m];
    
    
    while(cin>>l){
        
        a[k] = l;
        
        k++;
    }
  

    //cout << n << endl;
   // cout << m << endl;
   
   vector<int> data{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  
   for(int i = 0;i<m;i++){
   
    auto itr = std::find(data.begin(), data.end(), a[i]);    //  最初の要素5へのイテレータを返す
 
   // cout << itr << endl;
   
     if( itr != data.end() ) {     // 発見した場合
      
        
        //cout << itr - data.begin() << "\n";
       
        int ll =itr - data.begin();
       
         
        data.erase(data.begin() + ll); 
      }
     
   
   
     
    
     
   }
    
 
  
   for(int j = 0;j<data.size();j++){
     
     //cout << data[j] << "\n";
     
   }
  
  
   int engineerPos = -1;
  
   for(int uu = n;uu<100000;uu++){
     
     string uuu =to_string(uu);
     
    
     
   //  for(int yy = 0;yy<data.size();yy++){
     for(int yy = 0;yy<m;yy++){
       
        string uuuu=to_string(a[yy]);
      // cout << uuu << endl;
        engineerPos = uuu.find(uuuu);
       
       // cout << data[yy]<< endl;
      //  cout << yy<< endl;
       // cout << engineerPos<< endl;
       
        if(engineerPos != -1){
     
          
          break;
        }
       
     }
     
     if(engineerPos != -1){
     
 
       
     }else{
       
       cout << uuu << endl;
       break;
       
     }
     
     
   }
    
   
    return 0;
}

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

int main() {
    string N;
    cin >> N;
    int count = 0;
    rep(i, 0, N.size()){
        if(N[i] == '9') count++;
    }
    ll ans;
    if(count == N.size()-1 && N[0] != '9'){
        ans = (N[0] - '0') + 9 * (N.size()-1);
        cout << ans << endl;
        return 0;
    } 
    if(count == N.size()){
        ans = 9 * (N.size());
        cout << ans << endl;
        return 0;
    }
    ans = ((N[0] - '0')-1) + 9 * (N.size()-1);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

int main()
{
    fastio;
    ll n=0;
    cin>>n;
    string s;
    cin>>s;
    for(ll i=0;i<s.length();++i){
       s[i]+=n;
       if(s[i]>='A' and s[i]<='Z')
        cout<<s[i];
       else{
        s[i]-=26;
        cout<<s[i];
       }
    }
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\stdout", "w", stdout);
    }
    int n;
    cin >> n;
    vector<ll> v(n);
    FOR(i, n)
        cin >> v[i];

    ll s = 1;
    vector<ll> a(n);
    a[0] = 0;
    FOR(i, n){
        a[0] += s*v[i];
        s = -s;
    }
    for(int i=1; i<n; i++){
        a[i] = 2*v[i-1] - a[i-1];
    }
    FOR(i, n)
        cout << a[i] << ' ';
    cout << endl;

    //if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct _node {
    int x;
    struct _node* parent;
} Node;

typedef struct {
    Node* node;
    int height;
} Tree;

typedef struct {
    Tree* tree;
    int num;
    int size;
} Forest;

void set(Node* ptr, int x, Node* parent) {
    ptr->x = x;
    ptr->parent = parent;
}

void makeSet(Forest* forest, int x) {
    Tree* ptr = &forest->tree[x];
    ptr->node = malloc(sizeof(Node));
    set(ptr->node, x, ptr->node);
    ptr->height = 0;
}

bool isRoot(Node* ptr) {
    return ptr == ptr->parent;
}

Node* pathCompression(Node* ptr) {
    if(isRoot(ptr)) {
        return ptr;
    }

    return ptr->parent = pathCompression(ptr->parent);
}

Node* findSet(Forest* forest, int x) {
    return pathCompression(forest->tree[x].node);
}

void unite(Forest* forest, int x, int y) {
    Node* xroot = findSet(forest, x);
    Node* yroot = findSet(forest, y);
    int xRep = xroot->x;
    int yRep = yroot->x;

    if(xRep != yRep) {
        int xHeight = forest->tree[x].height;
        int yHeight = forest->tree[y].height;

        if(xHeight < yHeight) {
            xroot->parent = yroot;
        } else if(xHeight > yHeight) {
            yroot->parent = xroot;
        } else {
            yroot->parent = xroot;
            forest->tree[x].height++;
        }
    }
}

void initForest(Forest* forest, int n) {
    forest->tree = malloc(n * sizeof(Tree));
    for(int i = 0; i < n; i++) {
        makeSet(forest, i);
    }
    forest->num = 0;
    forest->size = n;
}


int main(void) {
    Forest forest;

    int n, q;

    scanf("%d %d", &n, &q);
    initForest(&forest, n);

    for(int i = 0; i < q; i++) {
        int c, x, y;
        scanf("%d %d %d", &c, &x, &y);
        
        if(c == 0) {
            unite(&forest, x, y);
        } else {
            printf("%d\n", findSet(&forest, x)->x == findSet(&forest, y)->x);
        }
    }

    return 0;
}


Measured memory_bytes: 2328
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>

using namespace std;


int main(){
    int N,M;
    cin >>N>>M;
    vector<int> p(M);
    vector<vector<int>> to(N);
    for(int i=0;i<M;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int kari;
            cin >> kari;
            kari--;
            to[kari].push_back(i);
        }
    }
    for(int i=0;i<M;i++) cin >> p[i];
    bool test;
    int count=0;
    vector<int> d(N);
    for(int i=0;i<pow(2,N);i++){

        vector<int> denkyu(M,0);
        test = true;
        int n=i;
        for(int j=0;j<N;j++){
            d[j]=n%2;
            n = n/2;
        }
        
        for(int j=0;j<N;j++){
            
            if(d[j]==0) continue;
            for(int k=0;k<to[j].size();k++) denkyu[to[j][k]]++;
            
        }

        for(int j=0;j<M;j++){ 
            if(denkyu[j]%2!=p[j]) test=false;
            if(!test) break;
        }
        if(test) count++;   
        
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
const int MAXN=2e5+10;
int a[MAXN];
struct Segtree
{
	struct node
	{
		int mx;
	}Tree[MAXN<<2];
#define root Tree[o]
#define lson Tree[o<<1]
#define rson Tree[o<<1|1]
	void pushup(int o)
	{
		root.mx=max(lson.mx,rson.mx);
	}
	void bd(int o,int l,int r)
	{
		if(l==r)
		{
			root.mx=a[l];
			return;
		}
		int mid=(l+r)>>1;
		bd(o<<1,l,mid);
		bd(o<<1|1,mid+1,r);
		pushup(o);
	}
	int query(int o,int l,int r,int L,int R)
	{
		if(L>R || L>r || l>R)
			return -1;
		if(L<=l && r<=R)
			return root.mx;
		int res=0;
		int mid=(l+r)>>1;
		if(L<=mid)
			res=max(res,query(o<<1,l,mid,L,R));
		if(R>mid)
			res=max(res,query(o<<1|1,mid+1,r,L,R));
		return res;
	}
}T;
int main()
{
	int n=read();
	for(int i=1;i<=n;++i)
		a[i]=read();
	T.bd(1,1,n);
	for(int i=1;i<=n;++i)
		printf("%d\n",max(T.query(1,1,n,1,i-1),T.query(1,1,n,i+1,n)));
	return 0;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
typedef long long  ll ;
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define bug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}



int main() {
   long k,x;
   cin>>k>>x;
   if(k*500>=x)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static boolean palindrome(String s) {
        StringBuffer sb = new StringBuffer(s);

        return s.equals(sb.reverse().toString());
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        if (palindrome(s) && palindrome(s.substring(0, (s.length() -1)/2)) && palindrome(s.substring((s.length() + 3)/2 -1))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int gcd(int x, int y)
{
	if(x == 0)
	{
		return y;
	}
	else
	{
		return gcd(y%x, x);
	}
}

int main()
{
	int n, x;
	cin >> n >> x;
	int a[100000];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		a[i] = abs(a[i] - x);
	}
	int ans = a[0];
	for (int i = 1; i < n; ++i)
	{
		ans = gcd(ans, a[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
object Main extends App {
  val sc = new FastScanner(System.in)
  val n, k, l = sc.nextInt()
  val pq = List.fill(k)((sc.nextInt()-1, sc.nextInt()-1))
  val rs = List.fill(l)((sc.nextInt()-1, sc.nextInt()-1))

  val uf1 = new UnionFindTree(n)
  for ((p, q) <- pq) {
    uf1.unite(p, q)
  }

  val uf2 = new UnionFindTree(n)
  for ((r, s) <- rs) {
    uf2.unite(r, s)
  }

  val r1 = (0 until n).map(uf1.root)
  val r2 = (0 until n).map(uf2.root)

  val rp = r1.zip(r2).groupBy(identity).view.mapValues(_.length)

  val ans = (0 until n).map(i => rp((r1(i), r2(i)))).mkString(" ")
  println(ans)
}

class UnionFindTree(n: Int) {
  private val par = Array.tabulate(n)(identity)
  private val rank = Array.fill(n)(1)
  private val size0 = Array.fill(n)(1)

  def root(x: Int): Int = {
    var res = x
    var children = List[Int]()
    while (par(res) != res) {
      children ::= res
      res = par(res)
    }

    for (y <- children) {
      par(y) = res
    }
    res
  }

  def unite(x: Int, y: Int): Unit = {
    val xr = root(x)
    val yr = root(y)
    if (xr != yr) {
      if (rank(xr) < rank(yr)) {
        par(xr) = yr
        size0(yr) += size0(xr)
      } else {
        par(yr) = xr
        size0(xr) += size0(yr)
        if (rank(xr) == rank(yr)) {
          rank(xr) += 1
        }
      }
    }
  }

  def size(x: Int): Int = size0(root(x))
}

class FastScanner(source: java.io.InputStream) {
  val buf = new Array[Byte](1024)
  var now, end = 0

  def isPrintable(b: Byte): Boolean = 33 <= b && b <= 126
  def isNum(b: Byte): Boolean = 48 <= b && b <= 57

  def hasNextByte: Boolean = {
    if (now < end) {
      true
    } else {
      now = 0
      end = source.read(buf)
      end > 0
    }
  }

  def nextByte(): Byte = {
    if (hasNextByte) {
      val b = buf(now)
      now += 1
      b
    } else {
      -1
    }
  }

  def hasNext: Boolean = {
    while (hasNextByte && !isPrintable(buf(now))) {
      now += 1
    }
    hasNextByte
  }

  def next(): String = {
    if (hasNext) {
      val sb = new StringBuilder()
      var b = nextByte()
      while (isPrintable(b)) {
        sb += b.toChar
        b = nextByte()
      }
      sb.toString
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextInt(): Int = {
    nextLong().toInt
  }

  def nextLong(): Long = {
    if (hasNext) {
      var b = nextByte()
      var sign = 1
      var n = 0L
      if (b == '-') {
        sign = -1
        b = nextByte()
      }
      while (isNum(b)) {
        n = n * 10 + (b - 48)
        b = nextByte()
      }
      sign * n
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 185220
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s1);
fscanf(STDIN, "%s", $s2);

$i = $p = 0;
$m = 1000000007;
while (isset($s1[$i])) {
	if ($s1[$i] == $s2[$i]) {
		if ($p == 1) {
			$x = ($x * 2) % $m;
		} elseif ($p == 0) {
			$x = 3;
		}
		$p = 1;
		$i++;
	} else {
		if ($p == 1) {
			$x = ($x * 2) % $m;
		} elseif ($p == 2) {
			$x = ($x * 3) % $m;
		} else {
			$x = 6;
		}
		$p = 2;
		$i += 2;
	}
}
echo $x;

Measured memory_bytes: 4728
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

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

    set<int> ans;
    for(int i=A;i<=min(B,A+K-1);i++){
        ans.insert(i);
    }
    
    for(int i=max(B-K+1,A+K);i<=B;i++){
        ans.insert(i);
    }
    
    for(auto it = ans.begin();it != ans.end();it++){
        cout << *it << endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n,m;
    cin>>n>>m;
    
    vector<int> hist(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        hist[a-1]++;
        hist[b-1]++;
    }
    
    rep(i,hist.size()){
        if(hist[i]%2){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}


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


int main() {
	int n; cin >> n;
	multiset<int> s;

	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		auto it = s.upper_bound(-a);
		if (it == s.end()) s.insert(-a);
		else {
			s.erase(it);
			s.insert(-a);
		}
	}
	
	cout << s.size() << endl;

	return 0;
}


Measured memory_bytes: 4992
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left

def solve():
    n = int(input())
    l = [int(x) for x in input().split()]
    l.sort()
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            r = bisect_left(l, l[i] + l[j])
            # if r > j:
            ans += r - j - 1
    print(ans)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 9972
s = input()
t = input()

H = len(s)
W = len(t)
dp = [[0 for x in range(W+1)] for y in range(H+1)]

for y in range(H) :
    for x in range(W) :
        if s[y] == t[x] :
            dp[y+1][x+1] = dp[y][x]+1
        else :
            dp[y+1][x+1] = max(dp[y+1][x], dp[y][x+1])

ans = ""

while (H > 0) and (W > 0) :
    if dp[H][W] == dp[H-1][W] :
        H -= 1
    elif dp[H][W] == dp[H][W-1] :
        W -= 1
    else :
        H -= 1
        W -= 1
        ans = s[H] + ans

print(ans)


Measured memory_bytes: 119772
H, W = map(int, input().split())
m = [input() for i in range(H)]
ans = 0

import sys
sys.setrecursionlimit(10**6)

class UnionFind():
  def __init__(self, n):
    self.par = [i for i in range(n)]

  def root(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    self.par[y] = x

  def same(self, x, y):
    return self.root(x) == self.root(y)

uf = UnionFind(H*W)

for i in range(H*W):
  h, w = divmod(i, W)
  if 0 <= h-1 and m[h-1][w] != m[h][w]: uf.unite(h*W + w, (h-1)*W + w)
  if h+1 < H  and m[h+1][w] != m[h][w]: uf.unite(h*W + w, (h+1)*W + w)
  if 0 <= w-1 and m[h][w-1] != m[h][w]: uf.unite(h*W + w, h*W + (w-1))
  if w+1 < W  and m[h][w+1] != m[h][w]: uf.unite(h*W + w, h*W + (w+1))

ansb = {}
answ = {}
for i in range(H*W):
  ir = uf.root(i)
  h, w = divmod(i, W)
  if m[h][w] == "#":
    ansb[ir] = ansb.get(ir, 0) + 1
  else:
    answ[ir] = answ.get(ir, 0) + 1


ans = 0
for k, vb in ansb.items():
  vw = answ.get(k, 0)
  ans += vb * vw

print(ans)

Measured memory_bytes: 20776
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

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

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

	REP(i,3){
		if(s[i] == 49)s[i] = 57;
		else if(s[i] == 57)s[i] = 49;
	}

	cout << s << endl;

	return 0;
}

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

typedef struct pp {
    char name[20];
    int time;
} P;

const int length = 100005;
P queue[length];
int head = 0; int tail = 0;

void enqueue(P p) {
    queue[tail] = p;
    tail = (tail + 1) % length;
}

P dequeue() {
    int tmpHead = head;
    head = (head + 1) % length;
    return queue[tmpHead];
}

int main() {
    int n = 0, q = 0;
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        P process;
        scanf("%s", process.name);
        scanf("%d", &process.time);
        enqueue(process);
    }
    
    int elapsedTime = 0;
    int doneCount = 0;
    
    while (doneCount < n) {
        P p = dequeue();
        
        if (p.time <= q) {
            elapsedTime += p.time;
            p.time = 0;
            cout << p.name << " " << elapsedTime << endl;
            doneCount += 1;
            continue;
        }
        
        elapsedTime += q;
        p.time -= q;
        
        enqueue(p);
    }
}


Measured memory_bytes: 5496
/*

Author: @karngyan
Team: BlundersPride

*/

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

typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vll;
typedef std::pair<ll,ll> pll;
typedef std::vector<vll> vvll;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define max3( a, b, c ) max( a , max(b , c))
#define cres(c,n) (c).clear(),(c).resize(n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ff first
#define ss second
#define mk make_pair
const ll mod = 1e9 + 7;
const ll N = 3010;
string s;
	ll n;

ll dp[N][N];
//dp[i][j] is the number of valid permutaion of length i 
//(i-1 terms are less than j and distinct) such that ith term is j


void add(ll &a , ll b)
{
	a += b;
	if(a >= mod)
		a-=mod;
	a%=mod;
	return;
}
signed main()
{

	fast;
////////////////////////////////////////////////////////////////////////////////////////////
	cin >> n >> s;

	dp[1][1] = 1;
	for(ll len = 2 ; len <= n ; ++len)
	{
		for(ll i = 2 ; i<=n ; ++i)
			dp[len-1][i]+=dp[len-1][i-1];

		for(ll i = 1 ; i<=len ; ++i)
		{


			ll L , R ;
			if(s[len-2] == '>')
			{
				L = i , R = len - 1;
			}
			else
			{
				L = 1 , R = i-1;
			}

			// for(ll j = L ; j<=R ; ++j)
			// {
			// 	add(dp[len][i] , dp[len-1][j]);
			// }
			add(dp[len][i] , dp[len-1][R] - dp[len-1][L-1]);
		}
	}

	ll ans = 0;
	for(ll j = 1 ; j<=n ; ++j)
	{
		add(ans , dp[n][j]);
	}

	cout<<ans%mod<<endl;



	return 0;
}
	

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  for(int c = 0; c <= x; c++){
    int t = x-c;
    int feet = c*2+t*4;
    if(feet == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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


int main() {
	set<int> set;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int temp;
		cin >> temp;
		set.insert(temp);
	}

	cout << (set.size() == n ? "YES" : "NO");
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(int i=0; i<(n); i++)
#define REPj(n) for(int j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* 
	add utility Algorithm
*/

bool apperance[1000000001];

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string S;
    cin >> S;
    if (S[0] == S[1] && S[1] == S[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 3612