akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
using namespace std;

int main() {
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int  n, m, a[20000], b, c, d, k,sa, h, w, left = 1, right = 0;
	long long int sc, sr, num2, no[1005][1005] = {}, res = 999999999, count = 0, now = 0, mi = 9999999999;

	string str, t;

	cin >> h>>w;
	while (1) {
		res = 0;
		sa = 999999999999;
		now = 0;
		if (h == 0&&w==0) { return 0; }
		now = h * h + w * w;
		for (int i = 1; i <= 150; i++) {
			for (int j = i + 1; j <= 150; j++) {
				if (sa > i * i + j * j - now && i * i + j * j > now) { sa = i * i + j * j-now; left = i; right = j; }
				else if (i * i + j * j == now && h < i) { cout << i << " "<< j << endl; goto nex; }
			}
		}
		cout <<left << " " << right << endl;
		nex:
		cin >> h >> w;
	}
	
}



Measured memory_bytes: 3092
def main():
    n = int(input())
    monsters = list(map(int, input().split(" ")))
    peoples = list(map(int, input().split(" ")))

    score = 0
    kurikoshi = 0
    for i in range(n):
        if monsters[i] > peoples[i] + kurikoshi:
            score += peoples[i] + kurikoshi
            kurikoshi = 0
        elif monsters[i] <= peoples[i] + kurikoshi:
            score += monsters[i]
            if monsters[i] < kurikoshi:
                kurikoshi = peoples[i]
            else:
                kurikoshi = peoples[i] + (kurikoshi - monsters[i])

    if monsters[n] > kurikoshi:
        score += kurikoshi
    else:
        score += monsters[n]

    print(score)
    
main()

Measured memory_bytes: 18476
#include <stdio.h>
int main(void){
    // Your code here!
    int A,B,C,D;
    
    scanf("%d%d%d%d",&A,&B,&C,&D);
    
    if(A*B >= C*D){
        printf("%d\n",A*B);
    }
    else{
        printf("%d\n",C*D);
    }
}


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

using pii = pair<int, int>;

constexpr int INF = 1e9;

struct edge {
    int to, cost, type;
};

int main() {
    int N, M;
    cin >> N >> M;
    map<pii, vector<edge>> g;
    for(int i = 0; i < M; ++i) {
        int p, q, c;
        cin >> p >> q >> c;
        p--; q--;
        g[make_pair(p, c)].emplace_back(edge{q, 0, c});
        g[make_pair(q, c)].emplace_back(edge{p, 0, c});
        g[make_pair(p, c)].emplace_back(edge{p, 0, -1});
        g[make_pair(q, c)].emplace_back(edge{q, 0, -1});
        g[make_pair(p, -1)].emplace_back(edge{p, 1, c});
        g[make_pair(q, -1)].emplace_back(edge{q, 1, c});
    }

    using state = tuple<int, int, int>; // now, type, cost
    map<pii, int> d;
    priority_queue<state, vector<state>, greater<state>> que;
    d[make_pair(0, -1)] = 0;
    que.push(make_tuple(0, -1, 0));
    while(!que.empty()) {
        int now, type, cost;
        tie(cost, type, now) = que.top();
        que.pop();
        auto p = make_pair(now, type);
        if(d[p] < cost) {
            continue;
        }
        for(auto e : g[p]) {
            auto next = e.to, nt = e.type;
            auto np = make_pair(next, nt);
            if(d.count(np) == 0 || d[np] > d[make_pair(now, type)] + e.cost) {
                d[np] = d[make_pair(now, type)] + e.cost;
                que.push(make_tuple(d[np], nt, next));
            }
        }
    }
    auto dest = make_pair(N - 1, -1);
    if(d.count(dest) == 0) {
        cout << -1 << endl;
    } else {
        cout << d[dest] << endl;
    }
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  char c;
  cin >> a >> c >> b;
  if (c == '+') cout << a + b << '\n';
  else cout << a - b << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(...)
#include <complex.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
int n, m, k;
int t = 1;

pair<int , int> bal(  vector<vector<int>>& a , int i , int j){
    while(j <= m && a[i][j] == 0)j++;
    assert(a[i][j] != 0);
    return {a[i][j] , j};
}


int32_t main() {
    ios::sync_with_stdio (false);
    cin.tie (0);
    #ifdef LOCAL
        //freopen("f.txt", "r", stdin);
      // freopen("g.txt", "w", stdout);
    #endif

    cin >> n >> m >> k;
    vector<vector<char>>grid (n + 1, vector<char> (m + 1));
    vector<vector<int>>a (n + 1, vector<int> (m + 1, 0));
    for (int i = 1; i <=n; i++) {
        int last = t;
        for (int j = 1; j <=m; j++) {
            cin >> grid[i][j];
            if (grid[i][j] == '#') {
                a[i][j] = t++;
            }
        }
        if (last != t) {
            a[i][0] = t - last;
        }
    }

    int id = 1;
    for(int i = 1; i <=n; i++){
        if(a[i][0]){
            id = i;
            break;
        }
    }
    debug(a, id);

    int mx = 0;
    for(int i = id; i <= n; i++){
        if(!a[i][0]){
            for(int j = 1; j <=m; j++){
                a[i][j] = a[i - 1][j];
            }
            continue;
        }
        bool first = 0;
        for(int j = 1; j <=m; j++){
            if(a[i][j] != 0) { first = 1; continue; }
            if(!first){
                auto nw = bal(a, i , j);
                a[i][j] = nw.first;
                first = 1;

            }
            else{
                first = 1;
                a[i][j]  = a[i][j - 1];

            }

        }
    }

    for(int i = id - 1; i >= 1; i--){
        for(int j = 1; j <=m; j++){
            a[i][j] = a[i + 1][j];
        }
    }



    for(int i = 1; i <= n; i++){
        for(int j = 1; j <=m; j++){
            cout << a[i][j] << " \n"[j==m];
        }
    }




    return 0;
}













Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
using namespace std;
using ll=long long;


int main(){
	const int M=100000;
	int n,m,dx[M],x[100000],ans=0;

	cin>>n>>m;
	for(int i=0;i<m;i++)cin>>x[i];

	if(n>=M){
		cout<<"0"<<endl;
		return 0;
	}
	sort(x,x+m);
	for(int i=1;i<m;i++)dx[i-1]=x[i]-x[i-1];
	sort(dx,dx+m-1);
	for(int i=0;i<m-n;i++)
		ans+=dx[i];

	cout<<ans<<endl;
}

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

using namespace std;

int main() {
    int N,M; cin >> N >> M;
    vector<vector<int>> s;
    vector<int> p(M);

    for(int i=0;i<M;i++) {
        int k; cin >> k;
        vector<int> a(k);
        for(int j=0;j<k;j++) {
            cin >> a[j];
            a[j]--;
        }
        s.push_back(a);
    }

    for(int i=0;i<M;i++) {
        cin >> p[i];
    }

    int count = 0;
    for(int i=0;i<(1<<N); i++) {
        int light = 0;
        for(int j=0;j<M;j++) {
            int sws = 0;
            for(auto sw : s[j]) {
                sws += (i >> sw) & 1;
            }
            if(sws%2 == p[j]) light++;
        }
        if(light == M) count++;
    }

    cout << count << endl;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll n,m;
string s;
//Write From this Line

int main()
{
	cout << setprecision(10);
	cin >> n ;

	vector<int> a(n);

	int M = 0;
	rep(i,n) {
		cin >> a[i];
		M = max(M,a[i]);
	}
	//M / 2; に近いものを見つける

	ll search = (M+1) / 2 ;
	ll sa = M ;
	ll ans = M ;
	rep(i,n){
		ll tmp = abs ( search - a[i] );
		if(sa >= tmp){
			ans = a[i];
			sa = tmp;
		}
	}
	cout << M <<" " << ans << endl;

}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
}

Measured memory_bytes: 21076
#include <stdio.h>
#include<string.h>
int main(void)
{
	char h[1001],w[10001];
	int i,j;
	int x=0;
	int z=0;
	int a[1000];
	int n;

	do{
		
		scanf("%s",h);
		if(strcmp(h,"0")==0){
			break;
			
		}
			
for(i=0;i<strlen(h);i++){
	
	z+=(int)h[i]-'0';
	
	

	
	
}
	a[x]=z;
z=0;
		x++;
		}while(1);
	
for(i=0;i<x;i++){
	
	printf("%d\n",a[i]);
	
	
	
	
}
	return 0;
}

Measured memory_bytes: 540
def main
  n = gets.chomp.to_i
  n.times do
    mcxi1,mcxi2 = gets.chomp.split(' ').map{ |x| to_integer(x)}
    puts to_mcxi(mcxi1 + mcxi2)
  end
end

def to_integer mcxi
  integer = 0
  num = 1
  0.upto(mcxi.size - 1) do |idx|
    if mcxi[idx] =~ /[2-9]/
      num = mcxi[idx].to_i
      next
    end

    integer += num * begin
      case mcxi[idx]
      when 'm'; 1000
      when 'c'; 100
      when 'x'; 10
      when 'i'; 1
      end
    end
    num = 1
  end
  integer
end

def to_mcxi integer
  mcxi = ''
  m = integer / 1000
  unless m == 0
    mcxi << m.to_s unless m == 1
    mcxi << 'm'
  end

  c = integer % 1000 / 100
  unless c == 0
    mcxi << c.to_s unless c == 1
    mcxi << 'c'
  end

  x = integer % 100 / 10
  unless x == 0
    mcxi << x.to_s unless x == 1
    mcxi << 'x'
  end

  i = integer % 10 / 1
  unless i == 0
    mcxi << i.to_s unless i == 1
    mcxi << 'i'
  end

  mcxi
end

main

Measured memory_bytes: 6140
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)

using namespace std;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
constexpr ll MOD = 1000000007;

int main()
{
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll res = 1;
  ll cnt = 0;
  for (char c : s) {
    if (c == 'W') {
      if ((cnt%2) == 0) {
        res *= cnt;
        --cnt;
      } else {
        ++cnt;
      }
    } else {
      if ((cnt%2) == 0) {
        ++cnt;
      } else {
        res *= cnt;
        --cnt;
      }
    }
    res %= MOD;
  }
  if (cnt != 0) res = 0;
  FOR(i,1,n+1) {
    res *= i;
    res %= MOD;
  }
  cout<<res<<endl;
  return 0;
}


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

#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define per(i,n) for (int i=(int)(n)-1;i>=0;i--)
#define For(i,n) for (int i=1;i<=(int)(n);i++)
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define vi vector <int>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define pb push_back
#define re return
#define se second
#define fi first
const int INF=0x7fffffff;
const int MAXN=10000+3;

string s,t;
int f[MAXN];

void init_fail(const string &t,int f[]){
	int k=f[0]=-1;
	for (int i=1;i<t.size();i++){
		while (k>-1 && t[k+1]!=t[i]) k=f[k];
		f[i]=k+=t[k+1]==t[i];
	}
//	dea(f,t.size());
}

void kmp(const string &s,const string &t){
	init_fail(t,f);
	int k=-1;
	for (int i=0;i<s.size();i++){
		while (k>-1 && t[k+1]!=s[i]) k=f[k];
		k+=t[k+1]==s[i];
		if (k==t.size()-1){
			cout<<i-t.size()+1<<endl;
			k=f[k];
		}
	}
}

int main(){
	fio;
	cin>>s>>t;
	kmp(s,t);
	re 0;
}


Measured memory_bytes: 4536
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=0;
	cin >>n;
	while(n>1){
		ans++;
		n /= 2;
	}
	cout<<(1LL<<ans)<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long> a1(n),a2(n);
    for(int i =0; i < n; i++){
        cin >> a1[i];
        if(i > 0)
            a1[i] += a1[i-1];
    }
    for(int i =0; i < n;i++)
        cin >> a2[i];
    for(int i = n-1; i > 0; i--)
        a2[i-1] += a2[i];
    int max = 0;
    for(int i =0; i < n; i++){
        if(a1[i]+a2[i] > max)
            max = a1[i]+a2[i];
    }
    cout << max;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

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

    int n;
    cin >> n;

    n = (int)sqrt(n);

    cout << n * n << "\n";

    int a;
    cin >> a;
}

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

void solve(){
    string S;
    cin >> S;
    int N = S.size();
    string left = S.substr(0, (N-1)/2);
    string right = S.substr((N+3)/2-1, N-((N+3)/2-1));
    if(left == right){
        reverse(left.begin(), left.end());
        if(left == right) cout << "Yes" << endl;
        else cout << "No" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

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

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    long long n, k;
    cin >> n >> k;
    long long s = n / k;
    long long ans = s * s * s;
    if(k % 2 == 0) {
        long long l = n - k / 2;
        l /= k;
        if(n >= k / 2) l++;
        ans += l * l * l;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using std::cin;
using std::cout;
typedef long long ll;
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e6 + 5;
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
struct str
{
	int cnt, *addr;
	bool operator<(str A) const { return cnt < A.cnt; }
} d[Maxn];
int Disc(int t)
{
	rg int tmp = 0;
	std::sort(d + 1, d + t + 1);
	for (int i = 1; i <= t; i++)
	{
		if (i == 1 || d[i].cnt != d[i - 1].cnt)
			d[++tmp] = d[i];
		*d[i].addr = tmp;
	}
	return tmp;
}
int prime[Maxn], cnt, ans;
bool P[Maxn];
ll A, B;
ll gcd(ll x, ll y)
{
	ll z = x % y;
	while (z)
	{
		x = y;
		y = z;
		z = x % y;
	}
	return y;
}
int main()
{
	for (int i = 2; i <= 1000000; i++)
	{
		if (!P[i])
			prime[++cnt] = i;
		for (int j = 1; j <= cnt && i * prime[j] <= 1000000; j++)
		{
			P[i * prime[j]] = true;
			if (i % prime[j] == 0)
				break;
		}
	}
	rg ll x;
	cin >> A >> B;
	x = gcd(A, B);
	for (int i = 1; i <= cnt && x != 1; i++)
		if (x % prime[i] == 0)
		{
			ans++;
			while (x % prime[i] == 0)
				x /= prime[i];
		}
	if (x != 1)
		ans++;
	cout << ans + 1 << '\n';
	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	const int N =1e6;
    
     int mod= 1e9+7;
     
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};
   
   
   
    int sum;
    
    void solve(){
      int n;
      cin>>n;
      vi v(n+1,0),b(n,0);
      
      rep(i,0,n+1)
       cin>>v[i];
       
       rep(i,0,n)
        cin>>b[i];
             
      rep(i,0,n){
		    
		   if(b[i]==v[i]){
			   sum+=b[i];			   
			   b[i]-=v[i];
			   v[i]=0;			   
		   }
		   
		   else if(b[i]>v[i]){
				sum+=v[i];
				b[i]-=v[i];
				v[i]=0;
				
				if(b[i]<=v[i+1]){
				 sum+=b[i];				 
				 v[i+1]-=b[i];
				 b[i]=0;				 
			 }
				else{ 
				   sum+=v[i+1];
				   b[i]-=v[i+1];
				   v[i+1]=0;				  
			  }		  
		   }
		   
		   else{
			   sum+=b[i];
			   v[i]-=b[i];
		   }         
         }
         
        cout<<sum<<endl; 
            
      
     }
   
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,l,r) for (int i=l; i<=r; i++)
typedef long long ll;
using namespace std;

int n,ans;
char s[200];
bool b[30],c[30];

int main(){
	scanf("%d",&n); scanf("%s",s+1);
	rep(i,1,n-1){
		int res=0;
		rep(j,0,27) b[j]=0;
		rep(j,0,27) c[j]=0;
		rep(j,1,i) b[s[j]-'a'+1]=1;
		rep(j,i+1,n) c[s[j]-'a'+1]=1;
		rep(j,1,26) if (b[j] && c[j]) res++;
		ans=max(ans,res);
	}
	printf("%d\n",ans);
	return 0;
}

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

#define MOD 1000000007
typedef unsigned long long ull;

int h, n, a;
int main() {
  cin >> h >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    h -= a;
  }

  if (h <= 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};

int main() {
    int n;
    while (cin >> n, n) {
        int W, H;
        cin >> W >> H;
        vvb field(H, vb(W));
        REP(i, n) {
            int x, y;
            cin >> x >> y;
            x--;
            y--;
            field[y][x] = true;
        }
        int s, t;
        cin >> s >> t;
        s--;
        t--;

        int ma = 0;
        REP(y, H) {
            REP(x, W) {
                int sx = x + s, sy = y + t;
                if (0 <= sx && sx < W && 0 <= sy && sy < H) {
                    int cnt = 0;
                    FOR(yy, y, sy+1) {
                        FOR(xx, x, sx+1) {
                            if (field[yy][xx]) {
                                cnt++;
                            }
                        }
                    }
                    ma = max(ma, cnt);
                }
            }
        }
        cout << ma << endl;
    }
}

Measured memory_bytes: 3160
#include<iostream>
#include<algorithm>
#include <vector>
#include<math.h>
#include <map>
#include <functional>
#include <queue>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
using namespace std;
int n;
vector<int> g[100005];
int cnt[100005];
int val[100005];
int main(){
	cin >>n;
	for(int i=0;i<n-1;i++){
		int a,b; cin >>a>>b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
		cnt[a]++;
		cnt[b]++;
	}
	vector<int> c(n);
	cinf(n,c);
	sort(c.begin(),c.end());
	queue<int> q;
	for(int i=0;i<n;i++){
		if(cnt[i]==1)q.push(i);
	}
	ll ans=0;
	int cur=0;
	while(q.size()){
		int v=q.front();
		q.pop();
		val[v]=c[cur];
		cur++;
		for(int i=0;i<g[v].size();i++){
			int nv=g[v][i];
			cnt[nv]--;
			if(cnt[nv]==1){
				q.push(nv);
			}
		}
	}
	for(int i=0;i<n-1;i++){
		ans+=c[i];
	}
	cout << ans << endl;
	for(int i=0;i<n;i++){
		cout << val[i] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 3452
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

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

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	int n;
	int a[111];

	cin >> n;
	rep(i, n) cin >> a[i];

	int ans = 0;
	rep(i, n)
	{
		if ((i + 1) % 2 == 1 && a[i] % 2 == 1)
			ans++;
	}

	cout << ans << endl;
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j;
	cin>>n;
	double v[n+2];
	for(i=1;i<=n;i++)
	{
		cin>>v[i];
	}
	double dp[n+4][n+4];
	dp[0][0]=1;
	dp[1][0]=(1-v[1]);
	for(i=2;i<=n;i++)
	{
		dp[i][0]=(1-v[i])*dp[i-1][0];
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			dp[i][j]=(1-v[i])*dp[i-1][j]+v[i]*dp[i-1][j-1];
		}
	}
	double ans=0;
	for(j=n/2+1;j<=n;j++)
	{
		ans=ans+dp[n][j];
	}
	cout<<fixed<<setprecision(30)<<ans<<endl;
}

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

int main(){
	int a,b,c;
	
	cin >> a >> b >> c;
	
	if (a<b){
		if(b<c){
			cout << "Yes" << endl;
		}else if(b>c){
			cout << "No" << endl;
		}
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

struct mint
{
    ll x;
    mint(ll 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 pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }
    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;
    }
};
int main()
{
    ll n,a,b;
    cin >> n >> a >> b;
    mint ans = 0;
    mint t = 2;
    ans += t.pow(n) - 1;
    t = 1;
    mint ma = 1;
    rep(i,a){
        t *= (n - i);
        ma *= (i + 1);
    }
    ans -= t * ma.inv();
    for(int i = a; i<b;i++){
        t *= (n - i);
        ma *= (i + 1);
    }
    ans -= t * ma.inv();
    std::cout << ans.x << endl;


}

Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int n;
	cin>>n;
	string ans = "No";
	int k = 1;
	for(;k<=2*sqrt(n);k++) {
		if(k*(k-1)/2==n){ans="Yes";break;}
	}
	cout<<ans<<"\n";
	if(ans=="Yes") {
		cout<<k<<"\n";
		vector<vi> arr(k,vi());
		int num = 1;
		REP(i,0,k-1){
			REP(j,i+1,k-1){
				arr[i].PUB(num);
				arr[j].PUB(num);
				num++;
			}
		}
		REP(i,0,k-1) {
			cout<<arr[i].size()<<" ";
			for(auto j:arr[i])cout<<j<<" ";
			cout<<"\n";
		}
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 4272
INF = 10 ** 9
s = input()
n = len(s)
l = [0] * (n + 1)
for i in range(n):
    l[i + 1] = l[i] ^ (1 << (ord(s[i]) - ord('a')))
dp = dict()
dp[0] = 0
for x in l[1:]:
    if x not in dp:
        dp[x] = INF
    for j in range(26):
        t = x ^ (1 << j)
        if t in dp:
            dp[x] = min(dp[x], dp[t] + 1)
ans = dp[l[-1]]
if ans == 0:
    print(1)
else:
    print(ans)


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD =  1000000007;
const ll INF = 1LL << 60;


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

    V<int> dp(n + 1, 0);
    for(int i = 1; i <= n; i++) dp[i] = i;
    for(int i = 1; i <= n; i++){
        for(int j = 6; j <= i; j*= 6){
            dp[i] = min(dp[i - j] + 1, dp[i]);
        }
        for(int j = 9; j <= i; j*= 9){
            dp[i] = min(dp[i - j] + 1, dp[i]);
        }
    }
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 3712
s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+2)
        break
    a.append(f(a[i]))

Measured memory_bytes: 3060
h, w = gets.chomp.split.map(&:to_i)
s = []
h.times do |i|
  s[i] = gets.chomp.split("")
  w.times do |j|
    s[i][j] = 0 if s[i][j] == "."
  end
end
h.times do |i|
  w.times do |j|
    if s[i][j] == "#"
      s[i-1][j-1] += 1 if i>0 && j>0 && s[i-1][j-1] != "#"
      s[i-1][j] += 1 if i>0 && s[i-1][j] != "#"
      s[i-1][j+1] += 1 if i>0 && j<w-1 && s[i-1][j+1] != "#"
      s[i][j-1] += 1 if j>0 && s[i][j-1] != "#"
      s[i][j+1] += 1 if j<w-1 && s[i][j+1] != "#"
      s[i+1][j-1] += 1 if i<h-1 && j>0 && s[i+1][j-1] != "#"
      s[i+1][j] += 1 if i<h-1 && s[i+1][j] != "#"
      s[i+1][j+1] += 1 if i<h-1 && j<w-1 && s[i+1][j+1] != "#"
    end
  end
end
h.times do |i|
  puts s[i].join
end


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

namespace ABC_Training
{

    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var result = Program.Prediction(s);
            Console.WriteLine(result ? "Yes" : "No");
        }
        private static bool Prediction(string s)
        {
            for(int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0 && s[i] == 'L') return false;
                if (i % 2 == 1 && s[i] == 'R') return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 11092
line = gets.chomp.split(" ")
a = line[0].to_i
b = line[1].to_i
c = line[2].to_i
d = line[3].to_i

if (a - c).abs <= d || (a - b).abs <= d && (b - c).abs <= d
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 2e5 + 123;
int n , m , k;
int a[N];
string s;
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n;
	ll ans = 1e18;
	for(int i = 1 ;i <= n; i++){
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 2; i <= n; i++){
		ans = min(ans , abs(a[n] - a[i - 1]*2));
	}
	cout << ans ;
}

Measured memory_bytes: 1792
public class Main {
	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		String original = sc.next();
		String to_reverse = "";
		
		for (int i = original.length() - 1; i >= 0; i--) {
			to_reverse += original.charAt(i);
		}
		
		System.out.println(to_reverse);
	}

}

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

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    int N; cin >> N;
    string S;
    if(N==0){
        cout << 0 << endl;
        return 0;
    }
    while(N!=0){
        if(N>0){
            if(N%2==0) S.push_back('0');
            else S.push_back('1');

            N/=2;
            N = -N;
        }else{
            N = -N;
            N++;
            if(N%2==0) S.push_back('1');
            else S.push_back('0');

            N/=2;
        }
    }
    reverse(ALL(S));
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb emplace_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define rreps(i,j,k) for(int i = (j); i >= (k); --i)
#define rrep(i,j) rreps(i,j,0)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<int, ll> Pil;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
	int a[3];
	rep(i,3){
		cin >> a[i];
	}
	sort(a,a+3);
	if(a[0] == 5 && a[1] == 5 && a[2] == 7){
		puts("YES");
	}
	else{
		puts("NO");
	}
	return 0;
}

Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

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

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    long long N,A,B;cin >> N >> A >> B;
    vector<long long> retu(N);
    long long ans = 0;
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    for(int i = 0;i<N-1;i++){
        if((retu.at(i+1) - retu.at(i))*A > B){
            ans += B;
        }
        else{
            ans += A*(retu.at(i+1)-retu.at(i));
        }
    }

    cout << ans << endl;
}


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

int main(){
  int n, k, count = 0;
  cin >> n >> k;
  int h[n];
  for(int i=0; i<n; i++){
    cin >> h[i];
  }
  for(int i=0; i<n; i++){
    if(h[i]>=k){
      count ++;
    }
  }
  cout << count << endl;
  return 0;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}


Measured memory_bytes: 3620
n = int(input())
#a1~an
l = list(map(int, input().split()))
box = [0]*n
num_box = list(range(1,n+1))
x = list(reversed(range(n)))
for i in x:
    if l[i] == 1 and sum(box[i::num_box[i]])%2==0:
        box[i] += 1
    elif l[i] == 1 and sum(box[i::num_box[i]])%2==1:
        continue
    elif l[i] == 0 and sum(box[i::num_box[i]])%2==0:
        continue
    elif l[i] == 0 and sum(box[i::num_box[i]])%2==1:
        box[i] += 1

num_lis = [str(i) for i in num_box if box[i-1] == 1]
print(len(num_lis))
print(' '.join(num_lis))


Measured memory_bytes: 32060
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	// 「0からbまでのxor」 と 「0からa-1までのxor」 のxorを計算する
	ans := calc(b) ^ calc(a-1)

	fmt.Println(ans)
}

// 0~xのxor
func calc(x int) (result int) {
	// ｘは(0,1,2,...,x)区間の数字の個数なので、0を含めるために1を足す
	x++

	// 2進数のそれぞれの桁の偶奇を調べる
	for i := 0; i < len(strconv.FormatInt(int64(x), 2)); i++ {
		count := 0             // その桁の1の数
		loop := 1 << uint(i+1) // 周期

		// 周期に収まっている1を数える
		count += (x / loop) * (loop / 2)

		// 1周期に満たなかった部分の1を拾う
		if (x%loop)-(loop/2) > 0 {
			count += (x % loop) - (loop / 2)
		}

		// 1が奇数個だったら2進数でその桁は1になる
		if count%2 == 1 {
			result += 1 << uint(i) // 2のi乗を足してる
		}
	}
	return
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <queue>
#include <bits/stdc++.h>
#include <stack>
#include <vector>
#include <list>
#define NUMBER 100000001

using namespace std;

int main(){

  int ans = 0;
  int N;
  cin >> N;
  for(int i = 1; i <= N; i++){
    ans+=i;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char q[15];
	char w[15];
	char e[15];
	char r,t;
	scanf("%s %s %s",q,w,e);
	
	for(int i = 0; q[i]!= '\0';i++){
	r=q[i];
	}
	for(int i =0; w[i] != '\0'; i++){
		t =w[i];
	}
	if (r == w[0] && t ==e[0]){
		printf("YES");
	}
	else{
	printf ("NO");
	}
	return 0;
}



Measured memory_bytes: 1716
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, K) = ReadStream<int, int>();
        var p = RInts();
        Array.Sort(p);
        int ans = 0;
        for (int i = 0; i < K; i++)
        {
            ans += p[i];
        }
        WriteLine(ans);
    }
}

class Scanner
{
    public static int RInt() => int.Parse(Console.ReadLine());
    public static long RLong() => long.Parse(Console.ReadLine());
    public static string RString() => Console.ReadLine();
    public static double RDouble() => double.Parse(Console.ReadLine());

    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static string[] RStrings() => Console.ReadLine().Split();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static T1 ReadStream<T1>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadStream<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadStream<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadStream<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[0], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[0], typeof(T4));
        return (r1, r2, r3, r4);
    }
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;

signed main()
{
    ll n;
    cin >> n;

    string s = "LUDR";
    vector<ll> x(n);
    vector<ll> y(n);
    for(ll i = 0; i < n; ++i)
        cin >> x[i] >> y[i];
    bool flag = abs(x[0] + y[0]) % 2;
    for(ll i = 1; i < n; ++i){
        if(abs(x[i] + y[i]) % 2 != flag){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << (flag ? 36 : 37) << endl;
    if(!flag)
        cout << "1 ";
    for(ll i = 0; i < 36; ++i)
        cout << (1LL << i) << (i == 35 ? "\n" : " ");

    for(ll i = 0; i < n; ++i){
        if(!flag){
            cout << "R";
            x[i]--;
        }

        ll u = x[i] + y[i];
        ll v = x[i] - y[i];
        ll ua = abs(u) >> 1;
        ll va = abs(v) >> 1;
        ua |= (1LL << 35);
        va |= (1LL << 35);
        if(u < 0)
            ua = ~ua;
        if(v < 0)
            va = ~va;
        for(ll j = 0; j < 36; ++j){
            ll ind = ((ua & (1LL << j)) >> j) + (((va & (1LL << j)) >> j) << 1LL);
            cout << s[ind];
        }
        cout << endl;
    }

}


Measured memory_bytes: 256
object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val n = scanner.nextInt()
  val m = scanner.nextInt()
  val l = scanner.nextInt()

  val A = Array.fill(n, m)(0L)
    .map { _.map(_ => scanner.nextInt()) }

  val B = Array.fill(m, l)(0L)
    .map { _.map(_ => scanner.nextInt()) }

  val C =
    (0 until n).map { i =>
      (0 until l).map { j =>
        (0 until m).foldLeft(0L) { (c, k) =>
          c + A(i)(k) * B(k)(j)
        }
      }
    }

  val outputs = C.map(_.mkString(" "))

  outputs.foreach(println)
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

void solve() {
  int h, w;
  cin >> h >> w;
  vector<string> f(h);
  cin >> f;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (f[i][j] == '#') {
        bool judge = false;
        for (int k = 0; k < 4; k++) {
          int ni = i + dx[k];
          int nj = j + dy[k];
          if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
          if (f[ni][nj] == '#') judge = true;
        }
        if (!judge) {
          cout << "No" << endl;
          return;
        }
      }
    }
  }
  cout << "Yes" << endl;
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();
  return 0;
}


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

using namespace std;

int main() {
	
	long long n,m;
	cin >> n >> m;
	long long ans=0;
	
	if (n == 1 && m == 1) {
		ans = 1;
	}
	else if (n == 1) {
		ans = m-2;
	}
	else if (m == 1) {
		ans = n-2;
	}
	else {
		ans = (n-2) * (m-2);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int main(){
	stack<int >data;
	int a;
	while(cin>>a){
		if(a==0){
			cout<<data.top()<<endl;
			data.pop();
		}
		else {
			data.push(a);
		}
	
	}
}

Measured memory_bytes: 1200
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s == "SUN")
        cout << 7;
    if(s == "MON")
        cout << 6;
    if(s == "TUE")
        cout << 5;
    if(s == "WED")
        cout << 4;
    if(s == "THU")
        cout << 3;
    if(s == "FRI")
        cout << 2;
    if(s == "SAT")
        cout << 1;
    return 0;
}


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

int solve(int n, vector<int> &a, vector<int> &b, vector<int> &c) {
	vector<vector<int>> dp(n, vector<int>(3, 0));
	for (int i = 0; i < n; ++i)
	{
		if (i==0) {
			dp[i][0] = a[i];
			dp[i][1] = b[i];
			dp[i][2] = c[i];
		} else {
			dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
			dp[i][1] = b[i] + max(dp[i-1][2], dp[i-1][0]);
			dp[i][2] = c[i] + max(dp[i-1][1], dp[i-1][0]);
		}
	}
	return max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
}

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i] >> b[i] >> c[i];
	}
	cout << solve(n,a,b,c) << "\n";
	return 0;
}

Measured memory_bytes: 9816