akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 998244353;
//printf("%.10f\n", n);
char maze[101][101];
signed main() {
    ll n, m, a = 1, b = 1; cin >> n >> m;
    cout << 100 << ' ' << 100 << endl;
    if (n < m) {
        while (true) {
            if (n == 1) { break; }
            maze[a][b] = '.'; maze[a + 1][b + 1] = '#';
            maze[a + 1][b] = '#'; maze[a][b + 1] = '#';
            b += 2;
            if (b > 100) { b = 1; a += 2; }
            n--;
        }
        for (int h = 1; h <= 20; h++) {
            for (int i = 1; i <= 100; i++) {
                if (maze[h][i] != '.') { maze[h][i] = '#'; }
            }
        }
        for (int i = 1; i <= 100; i++) { maze[21][i] = '.'; }
        a = 22; b = 1; m--;
        while (true) {
            if (m == 0) { break; }
            maze[a][b] = '#'; maze[a + 1][b + 1] = '.';
            maze[a + 1][b] = '.'; maze[a][b + 1] = '.';
            b += 2;
            if (b > 100) { b = 1; a += 2; }
            m--;
        }
        for (int h = 1; h <= 100; h++) {
            for (int i = 1; i <= 100; i++) {
                if (maze[h][i] != '#') { maze[h][i] = '.'; }
            }
        }
        for (int h = 1; h <= 100; h++) {
            for (int i = 1; i <= 100; i++) {
                cout << maze[h][i];
            }
            cout << endl;
        }
    }
    else {
        swap(n, m);
        while (true) {
            if (n == 1) { break; }
            maze[a][b] = '#'; maze[a + 1][b + 1] = '.';
            maze[a + 1][b] = '.'; maze[a][b + 1] = '.';
            b += 2;
            if (b > 100) { b = 1; a += 2; }
            n--;
        }
        for (int h = 1; h <= 20; h++) {
            for (int i = 1; i <= 100; i++) {
                if (maze[h][i] != '#') { maze[h][i] = '.'; }
            }
        }
        for (int i = 1; i <= 100; i++) { maze[21][i] = '#'; }
        a = 22; b = 1; m--;
        while (true) {
            if (m == 0) { break; }
            maze[a][b] = '.'; maze[a + 1][b + 1] = '#';
            maze[a + 1][b] = '#'; maze[a][b + 1] = '#';
            b += 2;
            if (b > 100) { b = 1; a += 2; }
            m--;
        }
        for (int h = 1; h <= 100; h++) {
            for (int i = 1; i <= 100; i++) {
                if (maze[h][i] != '.') { maze[h][i] = '#'; }
            }
        }
        for (int h = 1; h <= 100; h++) {
            for (int i = 1; i <= 100; i++) {
                cout << maze[h][i];
            }
            cout << endl;
        }
    }
    return 0;
}

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

	#define ll long long int
	#define inv(name,Type,size) vector<Type> name(size);for(int index=0;index<size;index++) cin>>name[index];
	#define F(a,n,i) for(int i=a;i<n;i++)
	#define pb push_back
	#define endl "\n"
	#define mod 1000000007
	#define modpro 99824435

	const int d8i[8]={-1,0,1,0,-1,1,1,-1},d8j[8]={0,1,0,-1,1,1,-1,-1};


	void solve(){
		ll a,b,c;
		int k;
		cin>>a>>b>>c>>k;
		while(b<=a){
			b*=2;
			k--;
		}
		while(c<=b){
			c*=2;
			k--;
		}
		cout<<(k>=0?"Yes":"No");
	}

	int main()
	{
	  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	  
	  //int t;cin>>t;while(t--) solve(),cout<<endl;
	  solve();
	}



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

using namespace std;

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s; cin>>s;
	int n=s.size();
	int m=(n-1)/2;
	for(int i=0; i<m; i++){
		if(s[i]!=s[m-1-i] || s[i]!=s[n-1-i] || s[i]!=s[m+1+i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdlib>
#include<string>

#define SIZE 100002
typedef long long ll;
 
using namespace std;


int main(){
    string A_D;
    cin >> A_D;
    for(int bit = 0 ; bit < (1 << 3) ; bit++){
        vector<string> op;
        int sum=A_D[0] - '0';
        for(int i =0  ; i <= 2 ; i++){
            if(bit & (1<<i)){
                sum += A_D[i+1] - '0';
                op.push_back(string("+"));
            }else{
                sum -= A_D[i+1] - '0';
                op.push_back(string("-"));
            }
        }
        if(sum  == 7){
            cout << A_D[0] << op[0] << A_D[1] << op[1] << A_D[2] << op[2] <<A_D[3] << "=7";
            break;
        }
    }
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

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

int main() {
	int k; string s;
	cin >> k >> s;
	int n = s.size();
	if (n <= k) cout << s << endl;
	else {
		string t = "";
		rep(i, k) t += s[i];
		cout << t << "..." << endl;
	}
	return 0;
}

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

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a+b<10)cout << a+b << endl;
  else cout << "error" << endl;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    if (K > (N - 1) * (N - 2) / 2) cout << -1 << endl;
    else{
        cout << (N - 1) + (N - 1) * (N - 2) / 2 - K << endl;
        for (int i = 2; i <= N; i++){
            cout << 1 << " " << i << endl;
        }
        int count = 0;
        for (int i = 2; i <= N; i++){
            for (int j = i + 1; j <= N; j++){
                if (count < (N - 1) * (N - 2) / 2 - K){
                    cout << i << " " << j << endl;
                    count++;
                }
            }
        }
    }
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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



int main() {
	ll N;
	cin >> N;
	vector<ll> A(N + 1);
	repn(i, N) cin >> A[i];

	ll mx = 1;
	ll ans = 0;

	repn(i, N) {
		ans += (A[i] - 1) / mx;

		if (A[i] > mx) { A[i] = 1;}
		mx = max(mx, A[i] + 1);
	}

	cout << ans << endl;

	system("PAUSE");
}


Measured memory_bytes: 1272
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, k = MI()
if ((n - 1) * (n - 2)) // 2 < k:
    print(-1)
else:
    m = (n * (n - 1)) // 2 - k
    print(m)
    graph = []
    for i in range(1, n + 1):
        for j in range(i, n + 1):
            if i != j:
                graph.append([i, j])
    for i in range(m):
        print(*graph[i])


Measured memory_bytes: 71020
n = int(input())
p_list = [int(x) for x in input().split()]

ans = 0
for i in range(1, n - 1):
    if p_list[i - 1] < p_list[i] < p_list[i + 1] or p_list[i - 1] > p_list[i] > p_list[i + 1]:
        ans += 1
print(ans)

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

int main() {
  int H,W;
  cin>>H>>W;
  vector<vector<char>> vec(H,vector<char>(W));
  for (int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      cin>>vec.at(i).at(j);
    }
  }
  
  vector<int> space;
  
  for (int i=0;i<H;i++){
    bool judge=true;
    for(int j=0;j<W;j++){
      if (vec.at(i).at(j)=='#'){
        judge=false;
        break;
      }
    }
    if(judge){
      space.push_back(i);
      for(int j=0;j<W;j++){
        vec.at(i).at(j)='0';
      }
    }
  }
  space.push_back(-1);
  
  for (int j=0;j<W;j++){
    bool judge=true;
    for(int i=0;i<H;i++){
      if (vec.at(i).at(j)=='#'){
        judge=false;
        break;
      }
    }
    if(judge){
      for(int i=0;i<H;i++){
        vec.at(i).at(j)='0';
      }
    }
  }
  
  //test
  //for(int k=0;k<space.size();k++){
  //  cout<<space.at(k);
  //}
  //cout<<endl;
  
  int skip,x=0;
  skip=space.at(x);
  
  for (int i=0;i<H;i++){
    if(i==space.at(x)){
      x++;
    }
    else{
      for (int j=0;j<W;j++){
        if(vec.at(i).at(j)!='0'){
          cout<<vec.at(i).at(j);
        }
      }
    cout<<endl;
    }
  }
}



Measured memory_bytes: 256
N, X, Y = map(int, input().split())

ans = [0] * (N + 1)

for i in range(1, N):
    for j in range(i+1, N+1):
        d = min(j-i, abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
        #print(i, j, d)
        ans[d] += 1

for i in range(1, N):
    print(ans[i])

Measured memory_bytes: 9344
import sys
#input = sys.stdin.buffer.readline
import bisect

def main():
    N = int(input())
    S = list(str(input()))
    
    pos = [[] for _ in range(26)]
    for x,s in enumerate(S):
        num = ord(s)-ord("a")
        pos[num].append(x)
    
    q = int(input())
    for _ in range(q):
        m,a,b = map(str,input().split())
        if m == "1":
            a = int(a)-1
            if S[a] == b:
                continue
            else:
                popind = bisect.bisect_left(pos[ord(S[a])-ord("a")],a)
                pos[ord(S[a])-ord("a")].pop(popind)
                bisect.insort(pos[ord(b)-ord("a")],a)
                S[a] = b
        else:
            a,b = int(a)-1,int(b)-1
            count = 0
            for i in range(26):
                l = bisect.bisect_left(pos[i],a)
                if l >= len(pos[i]):
                    continue
                if pos[i][l] <= b:
                    count += 1
            print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 29960
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    x, y = list(map(int, input().split()))

    total = 0

    for _ in range(2):
        if x < y:
            total += y
            y -= 1
        else:
            total += x
            x -= 1

    print(total)


if __name__ == '__main__':
    main()

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


int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> S(N);
  for (int i = 0; i < N; i++) {
    cin >> get<0>(S.at(i)) >> get<1>(S.at(i));
    get<2>(S.at(i)) = i + 1;
    get<1>(S.at(i)) *= - 1;
  }
  sort (S.begin(), S.end());
  for (int i = 0; i < N; i++) {
    cout << get<2>(S.at(i)) << endl;
  }
}

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

int main() {
  ll N;
  cin >> N;
  vector<string> W(N);
  REP(i, 0, N) {
    cin >> W[i];
  }

  set<string> st;
  char c = W[0][0];
  bool ok = true;
  REP(i, 0, N) {
    ok = ok && W[i][0] == c && st.count(W[i]) == 0;
    c = W[i][W[i].length() - 1];
    st.insert(W[i]);
  }

  cout << (ok ? "Yes" : "No") << endl;
}

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

int main(){
    int n;
    cin >> n;
    int s,t,u,v;
    int a[3][10];
    int b[3][10];
    int c[3][10];
    int d[3][10];
    for(int i=0;i<3;i++){
        for(int j=0;j<10;j++){
            a[i][j]=0;b[i][j]=0;c[i][j]=0;d[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin >> s >> t >> u >>v;
        if(s==1)a[t-1][u-1]+=v;
        if(s==2)b[t-1][u-1]+=v;
        if(s==3)c[t-1][u-1]+=v;
        if(s==4)d[t-1][u-1]+=v;
    }
    for(int i=0;i<3;i++){
        for(int j=0;j<10;j++){
            printf("%2d",a[i][j]);
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i=0;i<3;i++){
        for(int j=0;j<10;j++){
            printf("%2d",b[i][j]);
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i=0;i<3;i++){
        for(int j=0;j<10;j++){
            printf("%2d",c[i][j]);
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i=0;i<3;i++){
        for(int j=0;j<10;j++){
            printf("%2d",d[i][j]);
        }
        cout << endl;
    }
}


Measured memory_bytes: 3200
#include<stdio.h>
#include<string>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include <cmath>
#include <limits>
#include <numeric>
#include <cmath>
#include <limits>

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

int main(){
    int n;
    scanf("%d",&n);
    double x[10]={};
    double y[10]={};
    REP(i,n)scanf("%lf%lf",&x[i],&y[i]);
    double ans=0;
    REP(i,n)REP(j,n){
        if(i!=j){
            double dist = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
            dist = sqrt(dist);
            ans+=dist;
        }
    }
    ans = ans / n;
    printf("%.10f",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  rep(i, n-1){
    int a;
    cin >> a;
    v[a-1]++;
  }
  for(auto tmp: v){
    cout << tmp << endl;
  }

  return 0;
}


Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;
int main() {
    while (true) {
        int n; cin >> n;
        if (n == 0) break;
        bool g[26][26] = {};
        bool used[26] = {};
        int d[26] = {}; // relative degree
        repeat (i,n) {
            string s; cin >> s;
            int x = s.front() - 'a';
            int y = s.back()  - 'a';
            used[x] = true;
            used[y] = true;
            g[x][y] = true;
            d[x] += 1;
            d[y] -= 1;
        }
        repeat (k,26) { // warshall floyd
            repeat (i,26) {
                repeat (j,26) {
                    if (g[i][k] and g[k][j]) g[i][j] = true;
                }
            }
        }
        bool ans = true;
        repeat (i,26) {
            if (d[i] != 0) ans = false; // eulerlian cycle
        }
        repeat (i,26) if (used[i]) {
            repeat (j,26) if (used[j]) {
                if (not g[i][j]) {
                    ans = false; // not connected
                }
            }
        }
        cout << (ans ? "OK" : "NG") << endl;
    }
    return 0;
}

Measured memory_bytes: 3152
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <string>

using namespace std;

typedef long long ll;


int main() {
	ll a;
	double b;
	cin >> a >> b;
	ll ib = b * 100 + 0.5;
	a *= ib;
	a /= 100;
	printf("%lld\n", a);
	return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll A, V; cin >> A >> V;
    ll B, W; cin >> B >> W;
    ll T; cin >> T;
    if (A == B) {
        cout << "YES" << endl;
    }
    else if (A < B) {
        if (A + T*V >= B + T*W)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    else {
        if (B - T*W >= A - T*V)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
using i64 = long long;

template<typename T>
struct BIT {
    int n;
    vector<T> bit;
    BIT(int _n) : n(_n), bit(_n+1) {}
    
    T sum(int i) {
        T s = 0;
        while(i>0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    void add(int i, T x) {
        while(i<=n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b.begin(), b.end());
    map<int, int> zip;
    for(int i=0; i<n; i++) {
        zip[b[i]] = i + 1;
    }
    vector<int> c(n);
    for(int i=0; i<n; i++) {
        c[i] = zip[a[i]];
    }
    BIT<i64> bit(n);
    i64 r = 0;
    for(auto&& x : c) {
        r += bit.sum(n) - bit.sum(x);
        bit.add(x, 1);
    }
    cout << r << endl;
    
}


Measured memory_bytes: 16048
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define num(a) a-'0'
#define maxself(a,b) if(b>a)a=b
#define minself(a,b) if(b<a)a=b;
#define debug(x) cout<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"	
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n;
	cin>>n;
	vi a(n);
	int min=0;
	int ans=1;
	cin>>a[0];
	min=a[0];
	for(int i=1;i<n;i++){
		cin>>a[i];
		if(a[i]<=min){
			min=a[i];
			ans++;
		}
	}
	cout<<ans<<ln; 
}

int main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <cstring>


#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define FORC(cont, it) for(decltype((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;



int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    int h[n][3];

    FOR(i,0,n){
        FOR(j,0,3){
            cin >> h[i][j];
        }
    }

    int dp[n+5][3];

    dp[0][0] = h[0][0];
    dp[0][1] = h[0][1];
    dp[0][2] = h[0][2];

    FOR(i,1,n){
        dp[i][0] = h[i][0] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = h[i][1] + max(dp[i-1][2],dp[i-1][0]);
        dp[i][2] = h[i][2] + max(dp[i-1][0],dp[i-1][1]);
    }


    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;


	return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <string>

using namespace std;
using ll = long long;

ll N, X;

void input() {
    cin >> N >> X;
}

void solve() {
    vector<ll> thicks(N);
    vector<ll> patties(N);
    thicks[0] = 1;
    patties[0] = 1;
    for (ll i = 1; i < N; i++) {
        thicks[i] = thicks[i-1] * 2 + 3;
        patties[i] = patties[i-1] * 2 + 1;
    }
    ll ans = 0;
    for (ll i = N-1; i >= 0; i--) {
        auto t = thicks[i], p = patties[i];
        if (X-- == 1)
            break;
        if (X <= t)
            continue;
        X -= t;
        ans += p + 1;
        if (X-- == 1)
            break;
        if (X <= t)
            continue;
        X -= t + 1;
        ans += p;
        break;
    }
    if (X == 1)
        ans++;
    cout << ans << endl;
}

int main() {
    input();
    solve();
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;

 int f(vector < vector <int> >& a, int n){
  
    vector < vector <int> > dp(3, vector <int> (n,0));
    
    dp[0][0] = a[0][0];  dp[1][0] = a[0][1];  dp[2][0] = a[0][2];
    
    for(int i=1 ; i<n ; i++){
       dp[0][i] = a[i][0] + max(dp[1][i-1], dp[2][i-1]);
       dp[1][i] = a[i][1] + max(dp[2][i-1], dp[0][i-1]);
       dp[2][i] = a[i][2] + max(dp[1][i-1], dp[0][i-1]);
    }
        return max(dp[2][n-1], max(dp[1][n-1],dp[0][n-1]));
 }
 
  int32_t main() {
     int n; cin>>n; 
     vector < vector <int> > a(n, vector <int> (3,0));

     for(int i=0 ; i<n ; i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
     }
     
      cout<<f(a,n);
}

Measured memory_bytes: 8832
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
typedef long long int lli;
typedef unsigned long long int uli;
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  uli n,k,sh=0,kai=0;
  cin>>n>>k;
  vector<lli> h(n);
  rep(i,0,n){
    cin>>h.at(i);
    sh+=h.at(i);
  }
  st(h);
  if(k>=n){
    ou(0);
    return 0;
  }
  rep(i,0,n-k){
    kai+=h.at(i);
  }
  ou(kai);
}

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

using namespace std;

int main(){
  long long int L,R;
  long long int ans=2018;
  cin >> L >>R;
  
  if(R-L>=2019) cout << 0 << endl;
  else{
    for(long long int i=L;i<R;i++){
      for(long long int j=i+1;j<=R;j++){
	ans=min(ans,(i*j)%2019);
      }
    }
    cout << ans << endl;
  }
	
  return 0;
}

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

template<class T>
T knapsack(int N, int W, vector<T> v, vector<int> w) {
    vector<vector<T>> dp(N + 1, vector<T>(W + 1, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) {
                dp[i + 1][j] = dp[i][j];
            } else {
                dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
            }
        }
    }
    return dp[N][W];
}

int main() {
    int N, W; cin >> N >> W;
    vector<int> v(N), w(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }
    cout << knapsack(N, W, v, w) << endl;
    return 0;
}


Measured memory_bytes: 6836
X , Y , Z , K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = []
A.sort()
A.reverse()
B.sort()
B.reverse()
C.sort()
C.reverse()
for i in range(min(K,len(A))):
	if K // (i+1) > 0:
		for j in range(min(K // (i+1),len(B))):
			if K // ((i+1) * (j+1)) > 0:
				for l in range(min(K // ((i+1) * (j+1)),len(C))):
					ans.append(A[i] + B[j] + C[l])

ans.sort()
ans.reverse()
for i in range(K):
	print(ans[i])
	

Measured memory_bytes: 8708
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
ll s[2000];
ll a[10000];
int n,k;

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	s[0]=0;
	for(int i=0;i<n;i++){
		s[i+1]=a[i]+s[i];
	}
	vector<ll>sum;
	for(int i=0;i<n+1;i++){
		for(int j=i+1;j<n+1;j++){
			sum.push_back(s[j]-s[i]);
		}
	}
	// for(auto itr:sum){
	// 	cout<<" sum "<<itr<<endl;
	// }
	//cout<<sum.size()<<endl;
	ll ans=0;
	for(int i=50;i>=0;i--){
		int count=0;
		ll flag=ans|(1LL<<i);
		for(auto &itr:sum){
	//		cout<<itr<<" "<<flag<<" and "<<(flag&itr)<<endl;
	// &には括弧をつけないと違う意味になる
			if((flag&itr)==flag){
				count++;
			}
		}
	//	cout<<count<<" "<<flag<<endl;
		if(count>=k){
			ans=ans|flag;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 6512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
	using namespace std;
const int N=100010;
int n,m,q;
int ihead[N],to[2*N],inext[2*N],cnt;
bool vis[N][11];
int clr[N];
int V[N],d[N],c[N];
void addedge(int u,int v) {
	inext[++cnt]=ihead[u]; ihead[u]=cnt; to[cnt]=v;
	inext[++cnt]=ihead[v]; ihead[v]=cnt; to[cnt]=u;
}
void paint(int a,int b,int c){
	if (!clr[a]) clr[a]=c;
	if (vis[a][b] || b==0) return;
	vis[a][b]=1;
	for (int i=ihead[a];i;i=inext[i]) {
		int v=to[i];
		paint(v,b-1,c);
	}
}
int main(){
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
		int u,v;
		cin>>u>>v;
		addedge(u,v);
	}
	cin>>q;
	for (int i=q;i>=1;i--) 
		cin>>V[i]>>d[i]>>c[i];
	for (int i=1;i<=q;i++) 
		paint(V[i],d[i],c[i]);
	for (int i=1;i<=n;i++) cout<<clr[i]<<endl;
	return 0;
}

Measured memory_bytes: 5248
//
//  main.c
//  A
//
//  Created by s1262004 on 2019/07/23.
//  Copyright Â© 2019 s1262004. All rights reserved.
//

#include <stdio.h>

#define INF 3000

int n;
int A[100][100];
int weight[100];
int color[100]; // 0 -> WHITE, 1 -> BLACK

void prim(int);
int minWeight();

int main(int argc, const char * argv[]) {
	int from, to;
    scanf("%d", &n);
    for (from = 0; from < n; from++){
        for (to = 0; to < n; to++){
            scanf("%d", &A[from][to]);
        }
    }
    prim(0);
    return 0;
}

void prim(int start){
	int i, tolWeight = 0;
	
	for (i = 0; i < n; i++){
	    weight[i] = INF;
	    color[i] = 0;
	}
	weight[start] = 0;
	
	while(1){
		int u = minWeight();
		if (u == -1) break;
		color[u] = 1;
		
		for (i = 0; i < n; i++){
			if(color[i] == 0 && A[u][i] != -1 && A[u][i] < weight[i]){
				weight[i] = A[u][i];	
			}
		}
	}
	
	//printf("Node\t Weight\n");
	for (i = 0; i < n; i++){
	    //printf("%d\t%d\n", i, weight[i]);
		if(weight[i] > 0) tolWeight += weight[i];
	}
	printf("%d\n", tolWeight);
}

int minWeight(){
	int i;
	int min = INF;
	int anchor = -1;
	
	for (i = 0; i < n; i++){
		if(color[i] == 0 && weight[i] < min){
			min = weight[i];
			anchor = i;
		}
	}
	return anchor;
}



Measured memory_bytes: 2112
/*Let's start.............*/
#define   ll                long long
#define   pb                push_back
#define   ff                first
#define   ss                second
#define   srt(v)            sort(v.begin(),v.end())
#define   inf               2000000000000000000
#define   mxn               mxn
#define   pi                acos(-1)
#define   MOD               1000000007
#define   db(x)             printf("### VALUE: (%lld) ###\n",(ll)x)
#include  <bits/stdc++.h>
using namespace std;



int main()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vector<ll> posR,posG,posB,sumR,sumG,sumB;
    ll sR = 0,sG = 0,sB = 0;
    for(ll i = 0;i < n;i++){
        char c = s[i];

        if(c == 'R'){
            sR += (i+1);
            posR.pb(i+1);
        }
        else if(c == 'G'){
            sG += (i+1);
            posG.pb(i+1);
        }
        else{
            sB += (i+1);
            posB.pb(i+1);
        }
    }

    ll a,b,c;
    a = posR.size();
    b = posG.size();
    c = posB.size();


    ll ans = 0;
    for(ll i = 0;i < n;i++){
        for(ll j = i+1;j < n;j++){
            if(s[i] == s[j]) continue;
            if(s[i] != 'R' && s[j] != 'R'){
                ll pos = upper_bound(posR.begin(),posR.end(),j+1) - posR.begin();
                if(pos < a){
                    ans += (a - pos);
                }
                ll keep = (j - i);
                if(j+keep < n) if(s[j+keep] == 'R') ans--;
            }
            else if(s[i] != 'G' && s[j] != 'G'){
                ll pos = upper_bound(posG.begin(),posG.end(),j+1) - posG.begin();
                if(pos < b){
                    ans += (b - pos);
                }
                ll keep = (j-i);
                if(j+keep < n) if(s[j+keep] == 'G') ans--;
            }
            else{
                ll pos = upper_bound(posB.begin(),posB.end(),j+1) - posB.begin();
                if(pos < c){
                    ans += (c - pos);
                }
                ll keep = j-i;
                if(j+keep < n) if(s[j+keep] == 'B') ans--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}
/*
".....but the truth is that you can increase it slightly."
Day 29
*/



Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int a,b;
int main()
{
    cin>>a>>b;
    if(a > b) swap(a,b);
    if(a == 1) cout<<1<<endl;
    else cout<<(ll)((ll)a*b+1)/2;
    return 0;
}

Measured memory_bytes: 256
S=list(str(input()))
ans=0
sofar=0
j=1
nax=0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        ans+=j
        j+=1
    elif S[i]=='<' and S[i+1]=='>':
        ans+=j
        nax=j
        j=1    
    else:
        ans+=j
        if nax!=0:
            ans-=j
        j=1
        nax=0
    if j>nax:
        ans-=nax
        nax=0
if j>nax:
    ans+=j
    ans-=nax
print(ans)

Measured memory_bytes: 13232
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc161
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToList();
            var temp = new int[n];
            for (int i = 0; i < n-1; i++)
            {
                var x = a[i];
                temp[x - 1]++;
            }
            foreach (var item in temp)
            {
                Console.WriteLine(item);
            }

        }
    }
}

Measured memory_bytes: 43592
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int n,m,K,f[4010][4010],ans;
int main(){
	cin>>n>>m>>K;
	FOR(i,1,m)
		FOR(j,0,n)
			if (i+j==K && i<K && j<K) f[i][j]=1;
	FOR(i,1,m)
		FOR(j,0,n)
			if (f[i][j]){
				FOR(k,0,K-1)
					(f[i+k][j+K-1-k]+=f[i][j])%=MO;
			}
	FOR(i,1,m)
		FOR(j,1,n)
			if ( (m-i)%(K-1)==0 && (n-j)%(K-1)==0 )
				(ans+=f[i][j])%=MO;
	ans=(ans%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 61312
#include <iostream>
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll n,k,c[2001][2001];
int main(void){
    cin>>n>>k;
    for(int i=0;i<2001;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i)c[i][j]=1;
            else c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
        }
    }
    for(ll i=1LL;i<=k;i++){
        cout<<c[n-k+1][i]*c[k-1][i-1]%MOD<<endl;
    }
}


Measured memory_bytes: 30080
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const MAX = 8

var sc = bufio.NewScanner(os.Stdin)
var X [MAX]float64
var Y [MAX]float64

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanFloat() float64 {
	return float64(scanInt())
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}

func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	p := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}

		nums[i], nums[j] = nums[j], nums[i]
		*ret = append(*ret, makeCopy(nums))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}

func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}

func calDist(from, to int) float64 {
	xd := math.Pow(X[from]-X[to], 2)
	yd := math.Pow(Y[from]-Y[to], 2)
	return math.Sqrt(xd + yd)
}

func main() {
	n := scanInt()
	t := make([]int, n)
	for i := range t {
		t[i] = i
		X[i] = scanFloat()
		Y[i] = scanFloat()
	}

	total := 0.0
	cnt := 0.0
	for _, towns := range Permute(t) {
		cnt += 1
		from := towns[0]
		for i := 1; i < n; i++ {
			to := towns[i]
			total += calDist(from, to)
			from = to
		}
	}
	fmt.Println(total / cnt)
}


Measured memory_bytes: 4224
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll a, b, k;
	
	cin >> a >> b >> k;

	if (a <= k)
	{
		cout << 0 << " ";
		//if ()
		ll r = k - a;
		if (r <= b)
		{
			cout << b - r << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
	else
	{
		cout << a - k << " " << b << endl;
	}
	

	
	return 0;
}


Measured memory_bytes: 256
from scipy.sparse.csgraph import floyd_warshall
N,M,L,*X = map(int, open(0).read().split())
ls = X[:3*M]
Els = [[0]*N for i in range(N)]
Q = X[3*M]
query = X[3*M+1:]
for a,b,c in zip(*[iter(ls)]*3):
  if c<=L:
    Els[a-1][b-1] = c
    Els[b-1][a-1] = c
dist = floyd_warshall(Els)
      
Els2 = [[1 if dist[i][j]<=L else 0 for j in range(N)] for i in range(N)]
ans = floyd_warshall(Els2)

for s,t in zip(*[iter(query)]*2):
  if ans[s-1][t-1]==float('inf'):
    print(-1)
    continue
  print(int(ans[s-1][t-1])-1)

Measured memory_bytes: 40872
#include <stdio.h>
int main(void){
   int nowTime;
   int later;
   int startTime;
   scanf("%d", &nowTime);
   scanf("%d", &later);
   if( nowTime >= 24)
      nowTime = nowTime - 24;
   if( later >= 24 )
      later = later - 24;
   startTime = nowTime + later;
   if (startTime >= 24)
      startTime = startTime - 24;
   printf("%d" , startTime);
   return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main() {
	int N;
	scanf("%d", &N);
	int ans = 0;
	for (int i = 1; i <= N; i += 2) {
		int count = 0;
		for (int i2 = 1; i2 <= N; i2 += 2) {
			if (i % i2 == 0)count++;
		}
		if (count == 8)ans++;
	}
	printf("%d", ans);
	return 0;
}

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

#define rep(i,n) for(int (i)=0; (i)<(int)(n); (i)++)
#define all(x) (x).begin(), (x).end()
#define sqr(x) (x)*(x)
#define CEIL(a,b) ((a)+(b)-1) /(b)

typedef long long ll;
const int INF = 1001001001;

void sort_second(vector<pair<ll, ll>> &A, int N); //A:array of pair, N:size of array

int main() {
    int a, b;
    cin >> a >> b;
    if(a>=b) {
        rep(i, a) cout << b;
        cout << endl;
    }
    else {
        rep(i, b) cout << a;
        cout << endl;
    }
    return 0;
}

void sort_second(vector<pair<ll, ll>> &A, int N) {
    rep(i, N) swap(A.at(i).first, A.at(i).second);
    sort(all(A));
    rep(i, N) swap(A.at(i).first, A.at(i).second);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;


int main(){
    int K;
    cin >> K;
    vector<LL> v;
    for(int i=0;i<K;i++){
        LL a;
        cin >> a;
        v.push_back(a);
    }
    reverse(v.begin(),v.end());
    LL l=2,r=2;
    for(int i=0;i<K;i++){
        if(l/v[i]==r/v[i]&&l%v[i]!=0){
            puts("-1");
            return 0;
        }
        l=(l+v[i]-1)/v[i]*v[i];
        r=(r/v[i]+1)*v[i]-1;
    }
    cout << l <<" "<< r << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	int h,w;
	cin >> h >> w;
	vector<string> grid(h);
	rep(i,h) cin >> grid[i];
	vector<bool> flagh(h), flagw(w);
	rep(i,h){
		flagh[i] = true;
		rep(j,w) {
			if(grid[i][j] == '#') {
				flagh[i] = false;
			}
		}
	}
	rep(i,w) {
		flagw[i] = true;
		rep(j,h) {
			if(grid[j][i] == '#') {
				flagw[i] = false;
			}
		}
	}
	rep(i,h) {
		rep(j,w) {
			if(flagh[i] == false && flagw[j] == false) cout << grid[i][j];
		}
		if(flagh[i] == false) cout << endl;
	}

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
int a[26],x,n=1,c;
main(){
  string s;
  cin>>s;
  r(i,s.size())a[s[i]-'a']++;
  r(i,26)if(a[i]%2)x++;
  if(x>1)cout<<0<<endl;
  else{
    r(i,26)r(j,a[i]/2)n*=c+++1;
    r(i,26)r(j,a[i]/2)n/=j+1;
    cout<<n<<endl;
  }
}

Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>

using namespace std;

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

  set<int> isAC;
  map<int, int>  WA_count;

  for (int i = 0; i < M; ++i)
  {
    int p;
    string S;
    cin >> p >> S;

    WA_count.insert(make_pair(p, 0));
    if (isAC.count(p) == 0)
    {
      if (S == "WA")
      {
        ++WA_count[p];
      }
      else
      {
        isAC.insert(p);
      }
    }
  }

  int sum = 0;
  for (auto itr = isAC.begin(); itr != isAC.end(); ++itr)
  {
    sum += WA_count[*itr];
  }
  cout << isAC.size() << " " << sum << endl;
}


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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  VI h(n);
  rep(i, n) cin >> h[i];
  VI a(m), b(m);
  VLL edge[n];
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    edge[a[i]].push_back(b[i]);
    edge[b[i]].push_back(a[i]);
  }
  ll ans = 0;
  rep(i, n) {
    bool ok = true;
    for(int next : edge[i]) {
      if(h[i] <= h[next])
        ok = false;
    }
    if(ok) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10308
h,w = [int(x) for x in input().split()]
a = [input() for _ in range(h)]

ans = "Possible"
for i in range(h-1):
    for j in range(w-1):
        if a[i][j+1] == a[i+1][j] == "#":
            ans = "Impossible"
            break
print(ans)

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

int x[200010];
long long f[200010];
int L, n;

long long get_f(){
	long long res = x[n - 1];
	f[n - 1] = x[n - 1];
//	cout << f[n - 1] << " ";
	for (int i = n - 2; i >= 0; i--){
		int end = n - 1 - (n - 1 - i) / 2;
		f[i] = f[i + 1] + x[i] * 2 - x[end];
		if ((n - 1 - i) & 1) f[i] += L - x[end];
		else f[i] += L - x[end + 1]; 
		res = max(res, f[i]);
//		cout << f[i] << " ";
	}
//	cout << endl;
	return res;
}

int main(){
	scanf("%d%d", &L, &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &x[i]);
	}
	long long res = get_f();
	reverse(x, x + n);
	for (int i = 0; i < n; i++){
		x[i] = L - x[i];
	}
	printf("%lld\n", max(res, get_f()));
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if (s < t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);




ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}


ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

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




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll h,n;
    cin>>h>>n;
  FOR(i,0,n){
    ll a;
      cin>>a;
    h-=a;
    if(h<=0){
      cout<<"Yes\n";
      return;
    }
  }

    cout<<"No\n";
}


Measured memory_bytes: 256