akhauriyash/Code-Regression huggingface dataset:
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

struct Data{
    int A;
    string S;
    
    bool operator<( const Data& right ) const {
        return A == right.A ? S < right.S : A < right.A;
        //return A < right.A;
    }
};

int Func(){
    int x = 0;
    return x;
}

int main(){
    int N, A, B;
    
    cin >> N >> A >> B;
    if (N==1) cout << "Hello World" << endl;
    else cout << A+B << endl;
    
    
    return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
 
#define N 101
 
void maxchain();
int n,m[N][N],p[N];
 
int main(){
  int  r[N],c[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&r[i],&c[i]);
    p[i]=r[i];
    if(i==n-1) p[i+1]=c[i];
  }
  n++;
  maxchain();
  printf("%d\n",m[1][n-1]);
  return 0;
}
 
void maxchain(){
  int s,q,i,l,j,k;
  s=n-1;
  for(i=1;i<=s;i++){
    m[i][i]=0;
  }
  for(l=2;l<=s;l++){
    for(i=1;i<=s-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<29);
      for(k=i;k<=j-1;k++){
    q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
    if(m[i][j]>q) m[i][j]=q;
      }
    }
  } 
}

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

int main(){
    cin>>a;
    if(a[0]==a[1]&&a[1]==a[2])cout<<"Yes"<<endl;
    else if(a[1]==a[2]&&a[3]==a[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n) cin>>a[i];

  sort(ALL(a));
  ll ans=1;
  if(n%2){
    bool f=1;
    REP(i,n){
      if(i%2){
        if(a[i]!=i+1) f=0;
      }else{
        if(a[i]!=i) f=0;
      }
    }
    if(f){
      REP(i,n/2) ans=ans*2%1000000007;
    }else ans=0;
  }else{
    bool f=1;
    REP(i,n){
      if(i%2){
        if(a[i]!=i) f=0;
      }else{
        if(a[i]!=i+1) f=0;
      }
    }
    if(f){
      REP(i,n/2) ans=ans*2%1000000007;
    }else ans=0;
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int number = 0;
  string str;
  string str2;
  bool check = false;
  vector<string> strs;
  strs.clear();
  cin >> number;
  cin >> str;
  strs.emplace_back(str);
  str2 = str;
  for(int i = 1; i < number; ++i)
  {
    cin >> str;
    if(find(strs.begin(), strs.end(), str) != strs.end())
    {
      check = true;
    }
    if(str[0] != str2[str2.length() - 1])
    {
      check = true;
    }
    strs.emplace_back(str);
    str2 = str;
    if(check)
    {
      break;
    }
  }
  if(check)
  {
    cout << "No" << endl;
  }
  else
  {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long m, std::vector<long long> s, std::vector<long long> c){

    for(int i = 0;; ++i){
        string str = to_string(i);
        if(str.size() < n)
            continue;
        if(str.size() > n)
            break;
        bool fl = true;
        for(int j = 0; j < m; ++j){
            if(str[s[j] - 1] != '0' + c[j])
                fl = false;
        }
        if(fl){
            cout << i << endl;
            return;
        }
    }
    cout << -1 << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> s(M);
    std::vector<long long> c(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&s[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, M, std::move(s), std::move(c));
    return 0;
}


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

int main() {
    double n,m,d;
    std::cin >> n>>m>>d;
    if(d==0){
        std::cout << std::setprecision(10) << (1/n)*(m-1) << std::endl;
    }else{
        std::cout << std::setprecision(10) << ( (2*n-2*d) / ( n*n ) ) * (m-1) << std::endl;
    }
}


Measured memory_bytes: 256
def main():
    num, t = map(int, input().split())
    data = list(map(int, input().split()))
    ans = 0
    now_time = 0

    for i in range(num):
        ans += min(t, data[i] + t - now_time)
        now_time = data[i] + t
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 85968
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

int main() 
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  char c = '0';
  int count = 0;
  for (int i = 0; i < N; i++){
    if (c != S[i]){
      count++;
      c = S[i];
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
struct UnionFind {

    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main() {
  int n,k,l;
  cin >> n >> k >> l;
  UnionFind road(n),rail(n);
  map<P,int> d;
  int p,q;
  rep(i,k) {
    cin >> p >> q;
    road.merge(p-1,q-1);
  }
  rep(i,l) {
    cin >> p >> q;
    rail.merge(p-1,q-1);
  }
  map<pair<ll,ll>,int> a;
  rep(i,n) {
    a[{road.root(i), rail.root(i)}]++;
  }
  rep(i,n) {
    cout << a[{road.root(i), rail.root(i)}] << ' ';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 20504
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
    }

    let mut stack = Vec::new();
    let mut ans = 0;

    for c in s {
        if stack.len() == 0 {
            stack.push(c);
            continue;
        }

        if stack[stack.len() - 1] == c {
            stack.push(c);
        } else {
            stack.pop();
            ans += 2;
        }
    }
    println!("{:?}", ans);
}


Measured memory_bytes: 2936
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val N = sc.nextInt
    println(Array.fill[Long](N)(sc.nextInt).sum / N: Long)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 61052
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
	int a[5],b[5],i;
	for(i=0;i<4;i++){
		cin>>a[i]>>b[i];
	}
	for(i=0;i<4;i++){
		if(a[i]==1){
			cout<<b[i]*6000<<endl;
		}
		else if(a[i]==2){
			cout<<b[i]*4000<<endl;
		}
		else if(a[i]==3){
			cout<<b[i]*3000<<endl;
		}
		else{
			cout<<b[i]*2000<<endl;
		}
	}
return 0;
}
	

Measured memory_bytes: 3100
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define N 100000

int n;

int partition(int *,int,int);

int main(){
  int i,k,A[N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf(" %d",&A[i]);
  }
  k=partition(A,0,n-1);

  for(i=0;i<n;i++){
    if(i==k){
      printf("[%d]",A[i]);
    }
    else{
      printf("%d",A[i]);
    }
    if(i!=n-1){
      printf(" ");
    }
  }
  printf("\n");

  return 0;
}

int partition(int *A,int p,int r){
  int x,i,j,temp;
   x = A[r];
   i = p-1;
  for (j=p;j<r;j++){
     if (A[j] <= x){
       i = i+1;
       temp=A[i];
       A[i]=A[j];
       A[j]=temp;
     }

     /* A[i] と A[j] を交換*/
   }


   temp=A[i+1];
   A[i+1]=A[r];
   A[r]=temp;
   /*A[i+1] と A[r] を交換*/
   return i+1;
 }



Measured memory_bytes: 2168
n=int(input())
b=list(map(int,input().split()))
ans=0
a=[]
a.append(b[0])
for i in range(1,n-1):
  a.append(min(b[i-1],b[i]))

a.append(b[n-2])
for i in range(n):
  ans+=a[i]
  
print(ans)


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

int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	long long s = b / x;
	long long t;
	if (a == 0) {
		t = -1;
	}
	else {
		t = (a - 1) / x;
	}
	cout << s - t << endl;
	return 0;
}

Measured memory_bytes: 3648
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
    n,m=map(int,input().split())

    if n%2:
        for i in range(1,m+1):
            print(i,2*m-i+1)
    else:
        i,j=1,n
        a=[]
        while i<=n//4:
            a.append([i,j])
            i,j=i+1,j-1
        j-=1
        while i<j:
            a.append([i,j])
            i,j=i+1,j-1
        for i in range(m):
            print(a[i][0],a[i][1])
        # print(a)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 78008
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
const ll INF = 1001001001;
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; }

int dp[100005][2];

int main(){
    string s;
    cin >> s;
    int n = int(s.size());
    dp[0][0] = 1;
    rep(i,n){
        //a+b = 0
        if(s[i]=='0'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];
        }else{
            dp[i+1][1] = (dp[i][1] + dp[i][0]) % mod;
        }
        //a+b = 1
        if(s[i]=='0'){
            (dp[i+1][1] += (dp[i][1]*2) % mod) %= mod;
        }else{
            (dp[i+1][0] += (dp[i][0]*2) % mod) %= mod;
            (dp[i+1][1] += (dp[i][1]*2) % mod) %= mod;
        }
    }
    int ans = (dp[n][0]+dp[n][1]) % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long long a,b,c;
    cin >> a >> b >> c;
    long long d = c-a-b;
    if(d>0 and d*d>4*a*b)cout << "Yes" << endl;
    else cout << "No" << endl;
 }    


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ALDS1_5_D {
    class Problem {
        private int[] _nums, _workL, _workR;
        private long _count;

        public Problem(int[] nums,int n) {
            _nums = nums;

            int capacity = n / 2 + 2;
            _workL = new int[capacity];
            _workR = new int[capacity];
            
            _count = 0;
            MergeSort(0, n);
        }

        public long Count {
            get { return _count; }
        }
        
        private void MergeSort(int left,int right) {
            if (left + 1 < right) {
                int mid = (left + right) / 2;
                MergeSort(left, mid);
                MergeSort(mid, right);
                Merge(left, mid, right);
            }
        }

        private void Merge(int left,int mid,int right) {
            int lenL = mid - left;
            for(int i = 0; i < lenL; i++)
                _workL[i] = _nums[left + i];
            _workL[lenL] = int.MaxValue;

            int lenR = right - mid;
            for(int i = 0; i < lenR; i++)
                _workR[i] = _nums[mid + i];
            _workR[lenR] = int.MaxValue;

            int indexL = 0;
            int indexR = 0;
            for(int i = left; i < right; i++) {
                if (_workL[indexL] <= _workR[indexR]) {
                    _nums[i] = _workL[indexL];
                    indexL++;
                    _count += indexR;
                }
                else {
                    _nums[i] = _workR[indexR];
                    indexR++;
                }
            }
        }
    }

    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Problem p = new Problem(arr, n);
            Console.WriteLine(p.Count);
        }
    }
}

Measured memory_bytes: 27664
a, b, k = gets.split.map(&:to_i)
size = [k, b - a + 1].min
left_array = Array.new(size){ |i| a + i }
right_array = Array.new(size){ |i| b - i }.reverse!
array = (left_array + right_array).uniq
array.each { |item| puts item }


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

int main() {
	string n;
	cin >> n;
	for (int i = 0; i<n.size(); i++){
		if (n[i] == 'A'){
			cout << 'X';
		}
		else if (n[i] == 'B'){
			cout << 'Y';
		}
		else if (n[i] == 'C'){
			cout << 'Z';
		}
		else{
			cout << (char)(n[i] - 3);
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1180
// D - joisino's travel

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

const int MAX = 200;
const ll INF = 9223372036854775807;

int N, M, R;
ll d[MAX][MAX]; // d[i][j] : 頂点iから頂点jへの最小コスト


void Warshall_Floyd() {
	for (int k=0; k<N; k++) {
		for (int i=0; i<N; i++) {
			if (d[i][k] == INF) continue;
			for (int j=0; j<N; j++) {
				if (d[k][j] == INF) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int main() {
	cin >> N >> M >> R;

	vector<int> r_list;
	vector<int> indices;
	int r;
	for (int i=0; i<R; i++) {
		cin >> r;
		r--;
		r_list.push_back(r);
		indices.push_back(i);
	}

  // 自分自身への最小コストを0、それ以外をINFで初期化
	for (int i=0; i<N; i++) {
		for (int j=0; j<N; j++) {
			d[i][j] = ((i == j) ? 0 : INF);
		}
	}

  // 辺の情報を与える
	int A, B, C;
	for (int i=0; i<M; i++) {
		cin >> A >> B >> C;
		A--;
		B--;
		d[A][B] = C;
		d[B][A] = C;
	}

	Warshall_Floyd();

	ll ans = INF;
	do {
		ll total_dist = 0;
		for (int i=0; i<R-1; i++) {
			total_dist += d[r_list[indices[i]]][r_list[indices[i+1]]];
		}
		ans = min(ans, total_dist);
	} while (next_permutation(indices.begin(), indices.end()));

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<ll,ll>> pc;
//int ABS(int a){return max(a,-a);}
int main(){
    ll k,a,b;
    ll c=1;
    cin>>k>>a>>b;
    if(b<=a+2){
        cout<<k+1<<endl;
    }else{
        for(ll i=k;i>0;i--){
            if(i==1) c++;
            else if(c<a){
                c++;
            }
            else{
                c+=(b-a);
                i--;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n,m;
	cin >> n >> m;
	string res;

	if(n==m) res = "Yes";
	else res = "No";
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#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>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	
	int n,m;
	cin>>n>>m;
	int pre[n+2]={0};
	int temp=m;
	while(m--)
	{
		int l,r;
		cin>>l>>r;
		pre[l]++;
		pre[r+1]--;
	}
	f(i,1,n)
	pre[i]+=pre[i-1];
	int ans=0;
	f(i,1,n)
	{
		if(pre[i]==temp)
		ans++;
	}
	cout<<ans;
}

signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}




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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

decltype(1) main() {
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    double r;
    cin >> r;
    printf("%.20f\n", 2.0 * 3.14159265358979323846 * r);
    return 0;
}


Measured memory_bytes: 3756
import math
D, G = map(int,input().split())
p = [0] * D
c = [0] * D
for i in range(D):
    p[i], c[i] = map(int, input().split())
ans = 10**10
for i in range(2**D):
    rest = G
    problems = 0
    for j in range(D):
        if i & 2**(D-j-1):
            problems += p[j]
            rest -= p[j] * (j+1) * 100 + c[j]
        if rest <= 0:
            break
    for j in reversed(range(D)):
        if rest <= 0:
            break
        if i & 2**(D-j-1):
            continue
        add_problems = min(p[j] - 1, math.ceil(rest//((j+1)*100)))
        problems += add_problems
        rest  -= add_problems * (j+1) * 100
    if rest <= 0:
        ans = min(ans, problems)
print(ans)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Max(a, b) (a > b ? a : b)
#define Min(a, b) (a < b ? a : b)
#define ii pair<int, int>
#define fi first
#define se second
const int MAX = 200000; //2 * 10^5
const int MOD = 1000000007; //10^9 + 7
const int OO = 0x3f3f3f3f; // 0x3f3f3f3f;

int32_t main()
{
	int n, l;
	cin >> n >> l;

	for(int x = 0; x <= 100; x++)
		for(int y = 0; y <= 100; y++)
			if(x + y == n and 2 * x + 4 * y == l)
				return puts("Yes"), 0;
				
	puts("No");


	return 0;
}

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

int cnt=0,K_tmp;
string s;
bool flag=false;

void dfs(string subs){
  if(cnt==K_tmp){
    cout << subs << endl;
  }
  else if(cnt<=K_tmp){
    for(char c='a';c<='z';++c){
      if(s.find(subs+c)>=0 && s.find(subs+c)<s.size()){
        cnt++;
        dfs(subs+c);
      }
    }
  }
}


int main(){
  cin>>s;
  int K;cin>>K;
  K_tmp=K;
  dfs("");
}

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for (int i = 0; i < N; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int tmp;
			cin >> tmp;
			A.at(tmp - 1)++;
		}
	}

	int ans = 0;
	for (int i = 0; i < M; i++) {
		if (A.at(i) == N) ans++;
	}

	cout << ans << endl;
}

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

using namespace std;
int main(void){
      int n;
      cin >> n;
      string s;
      cin >> s;
      vector<int> v(26,1);
      
      for(int i = 0;i < s.size();i++){
            v[s[i] - 'a']++;
      }
      long ans = 1;
      for(int i = 0;i < v.size();i++){
            ans = ans * v[i] % 1000000007;
      }
      ans = (ans - 1 + 1000000007) % 1000000007;
      cout << ans << endl;
}
   


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int X;
	cin >> X;
	int res = 1;
	for (int i = 2; i <= X; i++) {
		bool ok = false;
		for (int j = 2; j < i; j++) if (i % j == 0) {
			int tmp = i;
			while (tmp % j == 0) tmp /= j;
			if (tmp == 1) {
				ok = true;
				break;
			}
		}
		if (ok) res = i;
	}
	cout << res << endl;
	return 0;
}


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

using namespace std;

int main()
{
  int ans = 0;
  int N;
  cin >> N;

  vector<int> L(2*N);

  for(int i = 0; i < 2*N; i++) {
    cin >> L[i];
  }

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

  for(int i = 0; i < 2*N-1; i+=2) {
    ans += min(L[i], L[i+1]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>

using namespace std;


int main() {
    long long  N; cin >> N;
    string S; cin >> S;
    long long b = 0;
    long long w = 0;
    for (long long i = 0; i < N; ++i) {
        if (S[i] == '#') ++b;
        else ++w;
    }
    long long BL = 0;
    long long WR = w;
    long long res = BL+WR;
    for (long long i = 0; i < N; ++i) {
        if (S[i] == '#') ++BL;
        else --WR;
        res = min(res, BL+WR);
    }
    cout << res << endl;
}



Measured memory_bytes: 640
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	int n;
	//scanf("%d", &n);
	cin >> n;

	int rest = n / 15;
	int y = 200 * rest;
	int x = 800 * n;

	printf("%d\n", x - y);

}

Measured memory_bytes: 256
r, c =[int(i) for i in input().split()]
 
date =[]
sum_row = [0] * (c + 1)
 
for ri in range(r):
    date.append([int(i) for i in input().split()])
    date[ri].append(sum(date[ri]))
    print(" ".join([str(d) for d in date[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += date[ri][ci]
 
print(" ".join([str(s) for s in sum_row]))

Measured memory_bytes: 7760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define int long long
#define P pair<int,int>

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    string s;
    cin >> s;

    int N = 0, W = 0, S = 0, E = 0;
    for(auto c : s){
        if(c == 'N') N = 1;
        if(c == 'W') W = 1;
        if(c == 'S') S = 1;
        if(c == 'E') E = 1;
    }

    bool ok = true;
    if((N != S) || (W != E)) ok = false;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp33 {
    class Program {
        static void Main(string[] args) {
            char b = Console.ReadLine()[0];

            switch (b) {
                case 'A':
                    Console.WriteLine('T');
                    break;
                case 'C':
                    Console.WriteLine('G');
                    break;
                case 'G':
                    Console.WriteLine('C');
                    break;
                case 'T':
                    Console.WriteLine('A');
                    break;
            }
        }
    }
}


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

using namespace std;

const int mxk = 1e5 + 7, mod = 998244353;

int n, m; long long base = 1e18;

struct node {
	int nxt, to;
} edge[mxk << 1];

int tot = 0, head[mxk];

void addedge(int u, int v) {edge[++tot].to = v; edge[tot].nxt = head[u]; head[u] = tot;}

long long sg[mxk], len = 9; long long cnt1[mxk], cnt2[mxk], cnt3[mxk], pwr[mxk], ans[mxk];
bool vis[mxk];

int main() {
	cin >> n; base = base % mod;
	pwr[0] = 1;
	for(int i = 1; i <= n; ++i)
		pwr[i] = pwr[i - 1] * base % mod;
		
	tot = 0; memset(head, 0, sizeof(head)); cin >> m;
	for(int i = 1; i <= m; ++i)	{ int u, v; cin >> u >> v; 
			if(u > v) swap(u, v); addedge(u, v); }
	memset(sg, 0, sizeof(sg)); memset(vis, 0, sizeof(vis));
	cnt1[0] = (cnt1[0] + pwr[n]) % mod;
	for(int u = n - 1; u >= 1; --u) {
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 1;
		int ptr = 0; while(vis[ptr]) ++ptr;
		sg[u] = ptr; cnt1[ptr] = (cnt1[ptr] + pwr[u]) % mod;
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 0;
	}	
	
	tot = 0; memset(head, 0, sizeof(head)); cin >> m;
	for(int i = 1; i <= m; ++i)	{ int u, v; cin >> u >> v; 
			if(u > v) swap(u, v); addedge(u, v); }
	memset(sg, 0, sizeof(sg)); memset(vis, 0, sizeof(vis));
	cnt2[0] = (cnt2[0] + pwr[n]) % mod;
	for(int u = n - 1; u >= 1; --u) {
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 1;
		int ptr = 0; while(vis[ptr]) ++ptr;
		sg[u] = ptr; cnt2[ptr] = (cnt2[ptr] + pwr[u]) % mod;
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 0;
	}		
	
	tot = 0; memset(head, 0, sizeof(head)); cin >> m;
	for(int i = 1; i <= m; ++i)	{ int u, v; cin >> u >> v; 
			if(u > v) swap(u, v); addedge(u, v); }
	memset(sg, 0, sizeof(sg)); memset(vis, 0, sizeof(vis));
	cnt3[0] = (cnt3[0] + pwr[n]) % mod;
	for(int u = n - 1; u >= 1; --u) {
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 1;
		int ptr = 0; while(vis[ptr]) ++ptr;
		sg[u] = ptr; cnt3[ptr] = (cnt3[ptr] + pwr[u]) % mod;
		for(int i = head[u]; i; i = edge[i].nxt)
			vis[sg[edge[i].to]] = 0;
	}	
	for(int i = 0; i < (1 << 9); ++i)
		for(int j = 0; j < (1 << 9); ++j)
			ans[i ^ j] = (ans[i ^ j] + cnt1[i] * cnt2[j] % mod) % mod;
	memcpy(cnt1, ans, sizeof(ans));
	memset(ans, 0, sizeof(ans));
	for(int i = 0; i < (1 << 9); ++i)
		for(int j = 0; j < (1 << 9); ++j)
			ans[i ^ j] = (ans[i ^ j] + cnt1[i] * cnt3[j] % mod) % mod;
	
	cout << ans[0] << endl;
}

Measured memory_bytes: 7996
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static void exec(MyScanner in, PrintWriter out) {
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int d = in.nextInt();
		int e = in.nextInt();
		int k = in.nextInt();
		int[] ary = {a, b, c, d, e};
		for (int i = 0; i < ary.length - 1; i += 1) {
			for (int j = i + 1; j < ary.length; j += 1) {
				if (ary[j] - ary[i] > k) {
					out.println(":(");
					return;
				}
			}
		}
		out.println("Yay!");
	}

	public static void main(String[] args) {
		PrintWriter w = new PrintWriter(System.out);
		exec(new MyScanner(System.in), w);
		w.flush();
	}

	static class MyScanner {
		static final int BUFFER_SIZE = 1024;
		private final InputStream in;
		private final byte[] buffer = new byte[BUFFER_SIZE];
		private int point;
		private int readLength;
		MyScanner(InputStream in) {
			this.in = in;
		}
		private int readByte() {
			if (point < readLength) {
				int result = buffer[point];
				point += 1;
				return result;
			}
			try {
				readLength = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (readLength == -1) {
				return -1;
			}
			point = 1;
			return buffer[0];
		}
		static boolean isPrintableCharExceptSpace(int c) {
			return 33 <= c && c <= 126;
		}
		String next() {
			StringBuilder b = new StringBuilder();
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			do {
				b.appendCodePoint(c);
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return b.toString();
		}
		long nextLong() {
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long result = 0L;
			do {
				if (!('0' <= c && c <= '9')) {
					throw new InputMismatchException();
				}
				result = result * 10L + (c - '0');
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return minus ? -result : result;
		}
		int nextInt() {
			long n = nextLong();
			if (Integer.MIN_VALUE <= n && n <= Integer.MAX_VALUE) {
				return (int) n;
			}
			throw new InputMismatchException();
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}


Measured memory_bytes: 21844
//2017-7-15
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int MaxN = 2e5;
int n;
int a[MaxN + 5];
LL presum[MaxN + 5];
LL sum;

int main(){
	while(~scanf("%d", &n)){
		for(int i = 1; i <= n; i++){
			scanf("%d", &a[i]);
			presum[i] = presum[i - 1] + a[i];
			sum += a[i];
		}
		LL ans = 1LL << 60;
		for(int i = 1; i < n; i++){
			LL a = presum[i];
			LL b = sum - presum[i];
			ans = min(ans, abs(a - b));
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2560
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

int main() {
    long double A,B,result=0;
    cin >> A >> B;
    cout << (long long)floor(A*B) << endl;
}

Measured memory_bytes: 3796
#include<stdio.h>
int main(){
int h, w, i, j;
while(1){
scanf("%d %d", &h, &w);
if(h == 0 && w == 0){
  break;
}
for(i = 0; i < h; i++){
  for(j = 0; j < w; j++){
    printf("#");
  }
  printf("\n");
}
printf("\n");
}
return 0;
}



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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  vll a(n);
  vll win(n);
  REP(i, n) {
    cin >> a[i];
    a[i]--;
    win[a[i]]++;
  }

  priority_queue<P, vector<P>, greater<P>> que;
  REP(i, n) {
    if (win[i] == 0) {
      que.emplace(0, i);
    }
  }

  vll depth(n);
  while (!que.empty()) {
    auto tmp = que.top();
    ll loser = tmp.second;
    que.pop();

    if (loser == 0)
      break;

    ll winner = a[loser];
    chmax(depth[winner], depth[loser]);
    depth[winner] += 1;

    win[winner]--;
    if (win[winner] == 0) {
      que.emplace(depth[winner], winner);
    }
  }

  cout << depth[0] << endl;

  return 0;
}


Measured memory_bytes: 7148
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

	Map<Long, Long> m = new HashMap<Long,Long>();
	Map<Long, Long> ansm = new HashMap<Long,Long>();
	Map<Long, Long> ansm2 = new HashMap<Long,Long>();
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long a[] = new long[n];
		long sum = 0;
		for(int i=0; i<n; i++) {
			long l = sc.nextLong();
			a[i]=l;
			m.put(l, m.containsKey(l) ? m.get(l)+1 : 1);
		}
		for(Map.Entry<Long, Long> e : m.entrySet()) {
			long key = e.getKey();
			long value = e.getValue();
			sum += (value)*(value-1)/2;
			ansm.put(key, (value)*(value-1)/2);
			ansm2.put(key, (value-1)*(value-2)/2);
		}
		for(int i=0; i<n; i++) {
			long l = a[i];
			long ans = sum;
			ans -= ansm.get(l);
			ans += ansm2.get(l);
			System.out.println(ans);
		}
		sc.close();
	}


}


Measured memory_bytes: 122180
# include <bits/stdc++.h>
using namespace std;
int main() {
    long long N, M;
    cin >> N >> M;

    if (N == 1 || M == 1) {
        // N = M = 1 のコーナーケースと
        // N か Mが 1 のときのコーナーケースを考慮
        if (N == 1 && M == 1) {
            cout << 1 << "\n";
        }
        else {
            cout << max(N, M) - 2 << "\n";
        }
    }
    else {
        cout << (N-2)*(M-2) << "\n";
    }
    
    return 0;
}


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

int T;
bool tag;
ll a,b,c,d,now,x,y,g;

ll gcd(ll a,ll b){
	if (!b) return a;
	else return gcd(b,a%b);
} 

int main(){
//	freopen("b.in","r",stdin);
//	freopen("b.out","w",stdout);
	int i;
	scanf("%d",&T);
	while (T--){
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if (a<b){
			printf("No\n");
			continue;
		}
		now=a; tag=1;
		if (b>d){
			printf("No\n");
			continue;
		}
		if (b<=c){
			printf("Yes\n");
			continue;
		}
		if (b==d){
			if (now%b>c) printf("No\n");
			else printf("Yes\n");
			continue;
		}
		now=now%b;
		x=d%b;
		if (now>c){
			printf("No\n");
			continue;
		}
		if (x==0){
			printf("Yes\n");
			continue;
		}
		if (c==b-1){
			printf("Yes\n");
			continue;
		}
		g=gcd(x,b);
		if (b-g+now%g<=c) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

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

int main()
{
	 string s;
	 cin>>s;
	 vector<char>v;
	 v.push_back(s[0]);
	 v.push_back(s[1]);
	 v.push_back(s[2]);
	 v.push_back(s[3]);
	 sort(v.begin(),v.end());
	 if(v[0]==v[1]&&v[2]==v[3]&&v[1]!=v[2]){
        cout<<"Yes"<<endl;
	 }
	 else{
        cout<<"No"<<endl;
	 }
}


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

const int MaxM=1e5+5;

int N,M,Ans;
int X[MaxM],Y[MaxM];
int Lst[405],T[405][405];
bool Tag[405];

int main(){
	int i,j,k;
	bool f;
	scanf("%d%d",&N,&M);
	for(i=1;i<=M;i++){
		scanf("%d%d",&X[i],&Y[i]);
		Lst[X[i]]=Lst[Y[i]]=i;
	}
	for(i=1;i<=N;i++){
		Tag[i]=true,T[i][i]=Lst[i]+1;
		for(j=Lst[i];j;j--){
			if(T[i][X[j]]&&T[i][Y[j]]){
				Tag[i]=false;
				break;
			}
			if(T[i][X[j]])
				T[i][Y[j]]=j;
			else if(T[i][Y[j]])
				T[i][X[j]]=j;
		}
	}
	for(i=1;i<N;i++)
		for(j=i+1;j<=N;j++)
			if(Tag[i]&&Tag[j]){
				if(T[j][i]&&T[j][i]<=Lst[i])
					continue;
				if(T[i][j]&&T[i][j]<=Lst[j])
					continue;
				f=true;
				for(k=1;k<=N;k++)
					if(k^i&&k^j&&T[i][k]&&T[j][k]&&T[i][k]^T[j][k]){
						f=false;
						break;
					}
				Ans+=f;
			}
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 1664
#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 a=0,b=0,c=0,k=0;
    cin>>a>>b>>c>>k;
    if(a+b>=k)
        cout<<min(k,a);
    else{
        ll r=k-(a+b);
        cout<<a-r;
    }
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

#define NOT_FOUND -1
#define MAX 10000
#define MAX2 500

int LinearSearch(int [],int,int);

int main(){
  int n,q,S[MAX + 1],T[MAX2];
  int sum = 0;
  int i;

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

  scanf("%d",&q);

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

  for (i = 0;i < q;i++)
    if (LinearSearch(S,n,T[i]) != -1)
      sum++;

  printf("%d\n",sum);
  
  return 0;
}

int LinearSearch(int S[],int n,int key){
  int i;

  S[n] = key;
  i = 0;
  
  while (S[i] != key)
    i++;

  if (i == n)
    return NOT_FOUND;

  return i;
}



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

int main(){
  int N, K; cin >> N >> K;
  vector<int> x(N);
  for(int i = 0; i < N; i++){
    cin >> x[i];
  }
  int ans = 1e9;
  for(int i = 0; i <= N - K; i++){
    int min1, max_K, min_K;
    max_K = x[i + K - 1];
    min_K = x[i];
    if(min_K >= 0) min1 = max_K;
    else if(max_K <= 0) min1 = -min_K;
    //else min1 = min(abs(min_K), max_K)*2 + max(abs(min_K), max_K);
    else min1 = min(abs(min_K)*2+max_K , max_K*2+abs(min_K)) ;
    ans = min(ans, min1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import sys
import heapq

def main():
    n, m = map(int, input().split())
    graph = {}
    for i in range(n):
        graph[i + 1] = []
    for _ in range(m):
        a, b = map(int, sys.stdin.readline().split())
        graph[a].append(b)
        graph[b].append(a)
    
    visited = set()
    stack = [1]
    ans = [None] * (n + 1)
    while stack:
        temp = []
        while stack:
            node = stack.pop()
            if node in visited:
                continue
            visited.add(node)
            for i in graph[node]:
                if ans[i] == None:
                    ans[i] = node
                if i not in visited:
                    temp.append(i)
        stack = temp[:]
    if len(visited) != n:
        print("No")
    else:
        print("Yes")
        for i in range(2, n + 1):
            print(ans[i])
    
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 111400
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 210000;

int n;
ll a[MAXN];


ll dp[5];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i) {
		for (int i = 1; i <= 4; ++i)
			dp[i] = min(dp[i], dp[i - 1]);
		dp[4] += a[i];
		if (a[i] == 0) {
			dp[1] += 2;
			dp[2] += 1;
			dp[3] += 2;
		}
		else if (a[i] % 2 == 0) {
			dp[2] += 1;
		}
		else {
			dp[1] += 1;
			dp[3] += 1;
		}
		dp[0] += a[i];
	}
	ll ans = *min_element(dp, dp + 5);
	cout << ans << "\n";
	return 0;
}




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

using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

int main(){
	int N;
	LL K;
	cin >> N >> K;
	vector<P> ab(N);
	rep(i,N){
		LL a, b;
		cin >> a >> b;
		ab[i]=P(a,b);
	}
	sort(ab.begin(),ab.end());
	LL num=0;
	rep(i,N){
		num+=ab[i].second;
		if(num>=K){
			cout << ab[i].first << endl;
			return 0;
		}
	}

	return 0;
}

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

int main(){
    int h, n; cin >> h >> n;
    int a[n], b[n];
    rep(i, n) cin >> a[i] >> b[i];

    vector<vector<int> > dp(n+1, vector<int>(h+1, 1e8));
    rep(i, n+1) dp[i][0] = 0;

    loop(i, 1, n+1)loop(j, 1, h+1){
        if(j-a[i-1] > 0) dp[i][j] = min(dp[i-1][j], dp[i][j-a[i-1]] + b[i-1]);
        else dp[i][j] = min(dp[i-1][j], b[i-1]);
    }
    cout << dp[n][h] << endl;

    return 0;
}

Measured memory_bytes: 39424
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
using namespace std;
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

    ll N, M, ans = 0;
    cin >> N >> M;
    vector<ll> A(N), B(M), C(M);
    REP (i, N) {
        cin >> A[i];
        ans += A[i];
    }
    REP (i, M) cin >> B[i] >> C[i];

    sort(A.begin(), A.end());
    vector<pair<ll, ll>> act(M);
    REP (i, M) {
        act[i].first = B[i];
        act[i].second = C[i];
    }
    sort(act.begin(), act.end(), compare_by_b);
    reverse(act.begin(), act.end());

    // for (auto e : A) cout << e << " ";

    // REP (i, M) {
    //     cout << act[i].first << ":" << act[i].second << "\n";
    // }

    ll count = 0;
    ll now = 0;
    REP (i, N) {
        if (count < act[now].first) {
            if (A[i] < act[now].second) {
                ans += act[now].second - A[i];
                count++;
                // cout << act[now].second << " " << -A[i] << "\n";
            }
        } else {
            now++;
            count = 0;
            if (now >= M) break;
            if (A[i] < act[now].second) {
                ans += act[now].second - A[i];
                count++;
            }
        }
        // cout << i << ":" << ans << "\n"; 
    }

    cout << ans << "\n";
}

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

using namespace std;
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)

int main()
{
    const long long A = 1000000000 + 7;
    long long N;
    cin >> N;

    long long power = 1;
    for (long long i = 1; i <= N; i++) {
        long long i_m = i % A;
        power = (i_m * power) % A;
    }

    cout << power << endl;
}


Measured memory_bytes: 256
// atcoder/abc164/D/main2.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  while (cin >> s) {
    map<int, lli> m;
    reverse(s.begin(), s.end());
    int x = 0;
    int w = 1;
    each (c, s) {
      x = (x + (c - '0') * w) % 2019;
      (w *= 10) %= 2019;
      ++m[x];
    }

    lli y = m[0];
    each (i, m) y += i.second * (i.second - 1) / 2;
    cout << y << endl;
  }

  return 0;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int N;
ll ans[100010];
template<class T> void chmin(T& x, T y) {if(x > y) x = y;}
struct edge{
    int num;
    int idx;
    bool operator < (const edge& e) const {
        return (num != e.num ? num < e.num : idx < e.idx);
    }
};

int main(){
    cin >> N;

    vector<edge> sq;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        sq.push_back(edge{a, i});
    }
        sq.push_back(edge{0, N});
    sort(sq.rbegin(), sq.rend());
    int mini = 1 << 30;
    for(int i = 0; i < N; i++){
        if(sq[i].num != sq[i + 1].num){
            chmin(mini, sq[i].idx);
            int gap = sq[i].num - sq[i + 1].num;
            ans[mini] += (ll)gap * (ll)(i + 1);
        }
    }
    for(int i = 0; i < N; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 2804
import java.util.Scanner;

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

        if(a>b){
            str = "a > b";
        }else if(a<b){
            str = "a < b";
        }else{
            str = "a == b";
        }
        
        System.out.println(str);
    }
}

Measured memory_bytes: 26232