akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }




void solve(){
    ll n,k;
    ll h[200010];
    cin>>n>>k;
    rep(i,n) cin>>h[i];
    sort(h,h+n);
    reverse(h,h+n);
    ll ans=0;
    rep(i,n){
        if(i<k) continue;
        ans+=h[i];
    }
    cout<<ans<<endl;


}

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

    solve(); 


    return 0;
}


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

int main() {
    string str, ans = "";
    cin >> str;
    rep(i, str.length()) {
        if(str.at(i) == '?') ans += 'D';
        else ans += str.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3864
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;

string A, B, C;

int main() {
	while(cin >> A, A != "0") {
		cin >> B >> C;

		reverse(A.begin(), A.end());
		reverse(B.begin(), B.end());
		reverse(C.begin(), C.end());

		int n = B.size();

		ll dp[55][2] = { 0 };

		dp[0][0] = 1;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				int q = 0, s = 0, t = 0;
				if(A[i] == '?') q++;
				else s += A[i] - '0';
				if(B[i] == '?') q++;
				else s += B[i] - '0';
				if(C[i] != '0') t = C[i] - '0';

				if(q == 2) {
					for(int a = 0; a <= 9; a++) {
						if(i == n - 1 && a == 0) continue;
						for(int b = 0; b <= 9; b++) {
							if(i == n - 1 && b == 0) continue;
							if(i == n - 1 && (t == 0 || (a + b + j) % 10 == 0)) continue;
							if((C[i] == '?' || (a + b + j) % 10 == t)) {
								int nj = a + b + j >= 10;
								(dp[i + 1][nj] += dp[i][j]) %= MOD;
							}
						}
					}
				}
				else if(q == 1) {
					for(int a = 0; a <= 9; a++) {
						if(i == n - 1 && a == 0) continue;
						if((i == n - 1 && (s + a + j) % 10 == 0)) continue;
						if(C[i] == '?' || (s + a + j) % 10 == t) {
							int nj = s + a + j >= 10;
							(dp[i + 1][nj] += dp[i][j]) %= MOD;
						}
					}
				}
				else { // q == 0
					if((i == n - 1 && (s + j) % 10 == 0)) continue;
					if(C[i] == '?' || (s + j) % 10 == t) {
						int nj = (s + j) >= 10;
						(dp[i + 1][nj] += dp[i][j]) %= MOD;
					}
				}
			}// for j
		}// for i
		cout << dp[n][0] << endl;
	}// while
}// main

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
    ll h, w;
    while (cin >> h >> w) {
        if (h!=0 || w!=0) {
            rep(i, h) {
                rep(j, w) cout << '#';
                cout << endl;
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
string S,s,p,q;
int k=1;
int main()
{
    cin>>S;
    p+=S[0];
    for(int i=1;i<S.size();i++)
    {
        s=q+S[i];
        if(s!=p){
            k++;
            p=s;
            q="";
        } else q=s;
    }
    cout<<k;
}


Measured memory_bytes: 640
#include <cstdio>
int main(){
	int n;
	scanf("%d",&n);
	for (int i = 0; i <= 100; i++){
		for (int j = 0; j <= 100; j++){
			if (4 * i + 7 * j == n){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
}

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

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

  for(int i=0; i<5; i++)
    cout << s.at(i);
  
  cout << ' ';
  
  for(int i=6; i<13; i++)
    cout << s.at(i);
  
  cout << ' ';
  
  for(int i=14; i<19; i++)
    cout << s.at(i);
  
  cout << endl;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
typedef long long ll;
using vi=vector<ll>;
ll num(ll x,ll y){
  return max(x,y)-min(x,y);
}
void solve() {
  ll n; cin>>n;
  vi h(n),dp(n);
  rep(i,n) cin>>h[i];
  dp[0]=0; dp[1]=num(h[0],h[1]);
  if(n>2){
    REP(i,2,n){
      dp[i]=min(dp[i-2]+num(h[i-2],h[i]),dp[i-1]+num(h[i-1],h[i]));
    }
  }
  cout<<dp[n-1]<<endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}

int main()
{
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    if (e - a <= k)
    {
        cout << "Yay!" << endl;
    }
    else
    {
        cout << ":(" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	string cha;
	cin >> cha;
	if (cha[2] == cha[3] && cha[4] == cha[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

N = INT()
X = LIST()
SUM = np.zeros(max(X)-min(X)+1)
SUM = list(SUM)

for i in range(N):
  for j in range(min(X), max(X)+1):
    SUM[j-min(X)] += (j-X[i])**2
    
print(int(min(SUM)))

Measured memory_bytes: 13596
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//    #pragma GCC optimize("unroll-loops")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC optimize("-O3")
//    #pragma GCC optimize("no-stack-protector")
//    #pragma GCC optimize("fast-math")

#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b emplace_back
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ll long long
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define getfiles    ifstream cin("input.txt");ofstream cout("output.txt");
#define pw(x) (1ll << x)
#define sz(x) (ll)x.size()
#define endl "\n"
#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)
//#define for(int i=0;i<n;i++) for(ll i=0;i<n;i++)
using namespace std;
//using namespace __gnu_pbds;
ld eps = (ld)1 / 1e7;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//const ll to[5]={0,4,6,7,9};
//const ll N=2*1e5+1;
const ll R=1e4;
//const ll to[7]={1,2,3,1,3,2,1};
const ll tx[4]={2,-1,2,1};
const ll ty[4]={-1,2,1,2};
const char rev_to[4]={'E','W','N','S'};
const int N=3001;
int dp[N][N],a[N],b[N],p[N][N];int ans[N];
signed main(){
    ll n;
    cin>>n;
    ld ans=n*2*3.14;
    cout<<fixed<<setprecision(2)<<ans;
    return 0;
}
/*

    если WA , то чекер говно, поэтому почекай l8 строчку

*/


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

const int MAXN = 1e5 + 5;

int N;
vector <int> E[MAXN];
int dep[MAXN], parent[MAXN];
set <int> ch[MAXN];
bool leaf[MAXN];

struct cmp {
	bool operator()(const int &lhs, const int &rhs) const {
		if (dep[lhs] != dep[rhs])
			return dep[lhs] > dep[rhs];
		return lhs < rhs;
	}
};

set <int, cmp> S;

void load() {
	scanf("%d", &N);
	for (int i = 1; i < N; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a++; b++;
		E[a].push_back(b);
		E[b].push_back(a);
	}
}

void dfs(int x, int p, int d) {
	dep[x] = d;
	parent[x] = p;
	for (auto it : E[x])
		if (it != p) {
			dfs(it, x, d + 1);
			ch[x].insert(it);
		}
	leaf[x] = ch[x].size() < 2;
	for (auto it : ch[x])
		leaf[x] &= leaf[it];
}

int solve() {
	int root = 0;
	for (int i = 1; i <= N; i++)	
		if (E[i].size() > 2)
			root = i;
	
	if (!root)
		return 1;
	
	dfs(root, 0, 0);

	for (int i = 1; i <= N; i++)
		S.insert(i);
	
	int sol = 0;
	while (!S.empty()) {
		int x = *S.begin();
		S.erase(x);
		if (x == root)
			break;
		int dad = parent[x];
		if (ch[dad].size() == 1)
			continue;
		int cnt = 0;
		for (auto it : ch[dad]) {
			cnt += leaf[it];
			if (S.count(it))
				S.erase(it);
		}
		if (cnt)
			sol += cnt - 1;
		ch[dad].clear();
		S.erase(dad);
		if (dad != root) 
			ch[parent[dad]].erase(dad);
	}
	
	return sol;
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}

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

using namespace std;
typedef long long ll;

int N, T;
int t[200010];
long long sum = 0;

int main() {
    cin >> N >> T;
    for (int i = 0; i < N; i++) {
        scanf("%d", &t[i]);
    }

    int i = 0;
    ll pre = t[i];
    while (i < N) {
        ll s = t[i++];
        while (i < N && t[i] < s + T) {
            s = t[i++];
        }
        sum += s + T - pre;
        pre = t[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1024
from collections import Counter

n=int(input())
d=Counter(list(map(int,input().split())))
m=int(input())
t=Counter(list(map(int,input().split())))
flag=0
for key in t.keys():
    if key in d.keys():
        if d[key] < t[key]:
            flag=1
            break
    else:
        flag=1
        break
if flag: print("NO")
else: print("YES")

Measured memory_bytes: 55256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

int main(){
   int h,w,ch,cw,dh,dw;
   cin>>h>>w>>ch>>cw>>dh>>dw;
   ch--,cw--,dh--,dw--;
   char fi[h][w];
   rep(i,h){
       rep(j,w){
           cin>>fi[i][j];
       }
   }

   int d[h][w];
   rep(i,h){
       rep(j,w){
           d[i][j]=-1;
       }
   }

   queue<pair<int,int>> q1,q2;
   q1.push({ch,cw});
   d[ch][cw]=0;
   while(!q1.empty() || !q2.empty()){
       if(q1.empty()){
           auto p=q2.front();
           q2.pop();
           for(int i=-2;i<=2;i++){
               for(int j=-2;j<=2;j++){
                   if(i==0 && j==0) continue;
                   int nx=p.first+i;
                   int ny=p.second+j;
                   if(0<=nx && nx<h && 0<=ny && ny<w && fi[nx][ny]!='#' && (d[nx][ny]==-1 || d[nx][ny]>d[p.first][p.second]+1)){
                      q1.push(make_pair(nx,ny));
                      d[nx][ny]=d[p.first][p.second]+1;
                    }
               }
           }
       }
       else{
           auto p=q1.front();
           q1.pop();
           q2.push(p);
           for(int i=0;i<4;i++){
               int nx=p.first+dx[i];
               int ny=p.second+dy[i];
               if(0<=nx && nx<h && 0<=ny && ny<w && fi[nx][ny]!='#' && d[nx][ny]==-1){
                   q1.push(make_pair(nx,ny));
                   d[nx][ny]=d[p.first][p.second];
               }
            }
        }
    }

    /*
    rep(i,h){
        rep(j,w){
            cout<<d[i][j]<<" ";
        }
        cout<<endl;
    }*/

    cout<<d[dh][dw]<<endl;
}


Measured memory_bytes: 8548
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 200010, M = 2000005;
ll n, a[N], x;
int solve()
{
    in1(n);
    for (int i = 0; i < n; i++)
    {
        in1(a[i]);
        x=x^a[i];
    }
    for (int i = 0; i < n; i++)
    {
        if(i) printf(" ");
        printf("%lld", x^a[i]);
    }
    printf("\n");
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int ret = solve();
    return 0;
}
/*

*/


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using P = std::tuple<int,int>;
using ll = long long;

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

int N, A;
int xs[50];
ll dp[51][2501][51];

int main(){
    //*
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    /*/
      /*/

    std::cin >> N >> A;
    for(int i=0;i<N;++i){
        std::cin >> xs[i];
    }

    dp[0][0][0] = 1ll;
    
    for(int i=0;i<N;++i){
        for(int j=0;j<2501;++j){
            for(int k=0;k<N;++k){
                dp[i+1][j][k] += dp[i][j][k];

                if(j + xs[i] > 2500){continue;}

                dp[i+1][j+xs[i]][k+1] += dp[i][j][k];
            }
        }
    }

    ll res = 0ll;
    for(int j=1;j<2501;++j){
        for(int k=0;k<N+1;++k){
            if(j == 1ll * A * k){
                res += dp[N][j][k];
            }
        }
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 50048
#include<bits/stdc++.h>
#define ld long double
using namespace std;

int main() {
  ld a,b,c; cin>>a>>b>>c;
  ld eps=1.0E-14;
  if (sqrt(a)+sqrt(b)+eps<sqrt(c)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
A = []
for i in range(3):
  A.append(list(map(int, input().split())))

hit_flag = [[False for i in range(3)] for j in range(3)]

N = int(input())
for i in range(N):
  b = int(input())

  for j in range(3):
    for k in range(3):
      if A[j][k] == b:
        hit_flag[j][k] = True

res = 'No'
if hit_flag[0][0] + hit_flag[0][1] + hit_flag[0][2] == 3:
  res = 'Yes'
elif hit_flag[1][0] + hit_flag[1][1] + hit_flag[1][2] == 3:
  res = 'Yes'
elif hit_flag[2][0] + hit_flag[2][1] + hit_flag[2][2] == 3:
  res = 'Yes'
elif hit_flag[0][0] + hit_flag[1][0] + hit_flag[2][0] == 3:
  res = 'Yes'
elif hit_flag[0][1] + hit_flag[1][1] + hit_flag[2][1] == 3:
  res = 'Yes'
elif hit_flag[0][2] + hit_flag[1][2] + hit_flag[2][2] == 3:
  res = 'Yes'
elif hit_flag[0][0] + hit_flag[1][1] + hit_flag[2][2] == 3:
  res = 'Yes'
elif hit_flag[0][2] + hit_flag[1][1] + hit_flag[2][0] == 3:
  res = 'Yes'

print(res)

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(0, 0); }
	V<V<pin>> qab(2);
	int sz = ab.size();
	qab[0].reserve(sz);
	qab[1].reserve(sz);
	for (pin& x : ab) {
		qab[x.second & 1].push_back(mkp(x.first>>1, x.second>>1));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first>>1, (x.second + 1)>>1)); }
	}
	int c = 0;
	for (pin& x : qab[0]) {
		int qc = 2 * x.first + x.second;qc%=3;
		c ^= (qc+1);
	}
	if (!c) {
		pin ans = solve(qab[1], ex - 1);
		ans.first *= 2; ans.second *= 2; ans.second++;
		return ans;
	}
	pin ans = solve(qab[0], ex - 1);
	c = 0;
	int d = 0;
	for (pin& x : qab[1]) {
		int w = ans.second - x.second - 1;
		if ((w & x.first) == w) { c ^= 1; }
		w++;
		if ((w & x.first) == w) { d ^= 1; }
	}
	ans.first *= 2; ans.second *= 2;
	ans.first += (c | d); ans.second -= c;
	return ans;
}
signed main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long inf = 1e17;
	int n; cin >> n;
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; cin >> a >> b;
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 59);
	cout << ret.first - inf << " " << ret.second - inf << "\n";
}


Measured memory_bytes: 7552
#include <stdio.h>

int main(void)
{
    int num;
    char str[20];

    scanf("%d", &num);
    scanf("%s", str);

    if(num >= 3200){
        printf("%s", &str[0]);
    }else if(num < 3200){
        printf("red\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define ALL(x) x.begin(), x.end()
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    while (true)
    {
        int r0, w0, c, r;
        cin >> r0 >> w0 >> c >> r;
        if (r0 == 0 && w0 == 0)
        {
            break;
        }
        int ans = 0;
        while (w0 * c > (r0 + r * ans))
        {
            // cerr << w0 << "," << c << "," << r << endl;
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3044
n,k=map(int,input().split())
s=input()
s+="?"

tmp=[]
l=1
for i in range(n):
    if s[i]==s[i+1]:
        l+=1
    else:
        tmp.append(l)
        l=1

RLs=max(1, len(tmp)-2*k)

ans=n-RLs
print(ans)

Measured memory_bytes: 3956
#include<stdio.h>

int main(void){
	int N;
  	scanf("%d",&N);
  
  	N = N % 10;
  	//printf("%d\n",N);
    if(N == 3)
        printf("bon\n");
    else if(N == 0 || N == 1 || N == 6 || N == 8)
        printf("pon\n");
    else
        printf("hon\n");
        
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
 
#define pb push_back
#define ll long long        
using namespace std;
 
void scan()
{
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
 
}
const int N = 1e6 + 500;
const int mod = 1e9 + 7;

int main() 
{
    scan();    
    int r, d;
    cin >> r >> d;
    int x;
    cin >> x;
    for (int i = 1; i <= 10; i++)
    {
    	x = x * r - d;
    	cout << x << "\n";
    }

}     
//JUDGE_ID: 295965SY
//Tis I

Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <stack>

using namespace std;

int H,W;
char field[100][100];


void dfs(int y, int x , char type){

    char cur_type = field[y][x];

    field[y][x] = '.';

    for(int dy = -1; dy<= 1; dy++){
        for(int dx = -1; dx<= 1; dx++){
            int nx = x + dx;
            int ny = y + dy;

            if( 0<= nx
                && nx < W
                && 0<= ny
                && ny < H
                && field[ny][nx] == cur_type
                && dx * dy == 0 ){
                dfs(ny,nx,cur_type);
            }
        }
    }
    return;
}


void solve(){
    int res = 0;
    for(int i = 0; i< H; i++){
        for(int j = 0; j< W; j++){
            if(field[i][j] != '.'){

                dfs(i,j,field[i][j]);

                res++;
            }
        }
    }
    cout << res << endl;
}



int main() {

    while(1){

        cin >> H >> W;cin.ignore();

        if( H == 0 && W == 0 ){
            break;
        }
        string line;

        for(int i = 0; i< H; i++){
            getline(cin,line);
            for(int j = 0; j< W; j++){
                field[i][j] = line[j];
            }
        }
        solve();

    }

    return 0;
}



/*
10 10
####*****@
@#@@@@@*#*
@##***@#@*
#****#*@**
##@*#@@*##
*@@@@*@@@#
***#@*@##*
*@@@*@@##@
*@*#*@##**
@****#@@*#
2 1
#
@
0 0
 */

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=6000000;
int k,tot=0,f[N];
LL a[N];
double calc(LL x){
	LL y=x,z=0;
	while (y)
		z+=y%10,y/=10;
	return 1.0*x/z;
}
int main(){
	for (LL i=1,v=1;i<=15;i++,v*=10)
		for (int j=2;j<=1000;j++)
			a[++tot]=v*j-1;
	sort(a+1,a+tot+1);
	tot=unique(a+1,a+tot+1)-a-1;
	memset(f,0,sizeof f);
	double mx=1e16;
	for (int i=tot;i>=1;i--){
		double x=calc(a[i]);
		if (x>mx)
			f[i]=1;
		else
			mx=x;
	}
	scanf("%d",&k);
	for (int i=1,j=1;i<=k;i++,j++){
		while (f[j])
			j++;
		printf("%lld\n",a[j]);
	}
	return 0;
}

Measured memory_bytes: 25600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define fi first`
#define se second
const int N = 1e5 + 500;
void solve()
{
	string s;
	cin>>s;
	string end="",start="";
	ll n,x,y;
	char c;
	cin>>n;
	bool flag=0;
	while(n--)
	{
		cin>>x;
		if(x==1)
		{
			flag^=1;
		}
		else
		{
			cin>>y>>c;
			y--;
			if((y^flag)==0)
			{
				start+=c;

			}
			else
			{
				end+=c;

			}
		}

	}
	reverse(start.begin(),start.end());
	s=start+s+end;
	if(flag)
	{
		reverse(s.begin(), s.end());
	}
	cout<<s;


}

int main()
{

    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while(t--)
    {
        solve();
        // cout << endl;
    }

}




Measured memory_bytes: 1348
/*
    ASEEN AAN 
            PINDAN AALE JATT!!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1000000007;   
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
//lli dp[3005][3005];
double dp[3005][3005];
//string sdp[3005][3005];
int main()
{
    ios_base::sync_with_stdio(0);
    cin>>n;
    double p[n+1];
    cout<<setprecision(15)<<"\0";
    for(int i=1;i<=n;i++)
    cin>>p[i];
    double ans=0;
    dp[1][0]=1-p[1];
    dp[1][1]=p[1];
    if(n==1)
    ans+=dp[1][1];
    for(int i=2;i<=n;i++)
    {
        for(int k=0;k<=i;k++)
        {
            if(k>0)
            dp[i][k]=dp[i-1][k-1]*p[i];
            dp[i][k]+=dp[i-1][k]*(1-p[i]);
        }
        if(i==n)
        {
            for(int k=n/2+1;k<=n;k++)
            ans+=dp[n][k];
        }
    }
    cout<<ans;
    //for(int i=1;i<=n;i++)
}

Measured memory_bytes: 69120
#include <iostream>
#include <string>
#include<cmath>
using namespace std;
int main(int argc, char const *argv[])
{

    long long n;

    long long buf = 1;
    cin >> n;
    for (long long i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            buf = i;
        }
    }

    cout << buf + (n / buf) - 2;

    return 0;
}


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

ll n, a[M], dp[M][5];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    dp[1][0] = a[1], dp[1][1] = -a[1];
    for (int i = 2; i < n; i++){
        dp[i][0] = max(dp[i - 1][0] + a[i], dp[i - 1][1] - a[i]);
        dp[i][1] = max(dp[i - 1][0] - a[i], dp[i - 1][1] + a[i]);
    }
    cout << max(dp[n - 1][1] - a[n], dp[n - 1][0] + a[n]);
    return 0;
}


Measured memory_bytes: 6400
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

int H, W;
char c[52][52];
int main() {
	scanf("%d%d",&H,&W);
	for (int i = 0; i < H;i++) {
		scanf("%s",c[i]);
		c[i][W] = '.';
	}

	bool f = true;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (c[i][j] =='#') {
				if ((i==0 || c[i-1][j] == '.') &&
					(j==0 || c[i][j-1] == '.') &&
					c[i+1][j] == '.' &&
					c[i][j+1] == '.' ) {
					f = false;
					break;
				}
			}
		}
	}
	if (f) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 128
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll arr[100005];

int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}
	ll curr = 0;
	ll ans = 0;
	if(N == 1) {
		printf("0\n");
		return 0;
	}
	int i = 0; 
	int j = 1;
	while(i < N - 1) {
		if(arr[i] >= arr[j]) {
			// cout << i << " " << j << " \n";
			curr++;
			ans = max(ans, curr);
		}
		else {
			curr = 0;
		}
		i++;
		j++;
	}
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 1024
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
// int dx[]={0,1,0,-1,1,1,-1,-1};
// int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int dx[]={-1,-1,0,0,1,1};
int dy[]={-1,0,-1,1,0,1};//RDLU
#define MOD 1000000007
vvi mul(vvi A,vvi B){
	vvi C(A.size(),vi(B[0].size()));
	rep(i,A.size())rep(k,B.size())rep(j,B[0].size())
		(C[i][j]+=A[i][k]*B[k][j])%=MOD;
	return C;
}
vvi pow(vvi A,ll n){
	vvi B(A.size(),vi(A.size()));
	rep(i,A.size())B[i][i]=1;
	while(n){
		if(n&1)B=mul(B,A);
		A=mul(A,A);
		n>>=1;
	}
	return B;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
int main(){
	ll n,m,k;
	cin>>n>>m>>k;
	vs in(n);
	rep(i,n)cin>>in[i];
	int coh=0,cow=0,co1=0,co2=0,co=0;
	rep(i,n)if(in[i][0]=='#'&&in[i][m-1]=='#')coh++;
	rep(i,m)if(in[0][i]=='#'&&in[n-1][i]=='#')cow++;
	rep(i,n)rep(j,m)if(in[i][j]=='#')co++;
	rep(i,n)rep(j,m-1)if(in[i][j]=='#'&&in[i][j+1]=='#')co1++;
	rep(i,n-1)rep(j,m)if(in[i][j]=='#'&&in[i+1][j]=='#')co2++;
	if(coh&&cow)cout<<1<<endl;
	else if(coh==0&&cow==0)cout<<powmod(co,k-1)<<endl;
	else{
		vvi A(2);
		A[0]={co,-(coh?co1:co2)};
		A[1]={0,max(coh,cow)};
		A=pow(A,k-1);
		cout<<(MOD+A[0][0]+A[0][1])%MOD<<endl;
	}
}
// 1 a-b  a(a-b)-bc





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

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

ll inv[200010];
ll fact[200010], finv[200010];
void init(ll n, ll mod = 1e9 + 7) {
  inv[1] = 1;
  for (int i = 2; i <= n; i++) {
    inv[i] = mod - (mod / i) * inv[mod % i] % mod;
  }
  fact[0] = finv[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = fact[i - 1] * i % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
ll comb(int n, int k, ll mod = 1e9 + 7) {
  if (!(0 <= k && k <= n)) return 0;
  return fact[n] * finv[k] % mod * finv[n - k] % mod;
}

const ll mod = 1e9 + 7;
int H, W, A, B;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  init(200000);
  cin >> H >> W >> A >> B;
  ll ans = 0;
  for (int i = 1; B - 1 + i <= W - 1 && A - 1 + i <= H - 1; i++) {
    (ans += (comb(H - A + B - 1, B - 1 + i) * comb(W + A - B - 1, A - 1 + i) % mod)) %= mod;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5500
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int a=in.nextInt(),b=in.nextInt(),c=in.nextInt();
		if(a<b && b<c)System.out.println("Yes");
		else System.out.println("No");
	}

}



Measured memory_bytes: 26152
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String result = "WA";
		if("A".equals(S.substring(0,1)) &&
				(S.substring(S.length()-1)).toLowerCase().equals(S.substring(S.length()-1)) &&
				(S.substring(1,2).toLowerCase()).equals(S.substring(1,2))) {
			for(int i = 2; i < S.length()-1; i++) {
				if("C".equals(S.substring(i,i+1))) {
					if("WA".equals(result)) {
						result = "AC";
					}else {
						result = "WA";
						break;
					}
				}else if(!(S.substring(i,i+1).toLowerCase()).equals(S.substring(i,i+1))) {
					result = "WA";
					break;
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 27032
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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; }

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, d;
  cin >> h >> w >> d;
  map<int, p> mp;
  vector<vector<int>> v(h, vector<int> (w));
  rep(i, h) rep(j, w){
    cin >> v[i][j];
    mp[v[i][j]] = {i, j};
  }
  int q;
  cin >> q;
  vector<p> qs(q);
  rep(i, q) cin >> qs[i].first >> qs[i].second;
  vector<int> dp(h*w+10);

  rep(i, d){
    int now = i+1;
    ll cost = 0;
    while(now <= h*w){
      dp[now] = cost;
      int next = now + d;
      int y = mp[next].first;
      int x = mp[next].second;
      int b = mp[now].first;
      int a = mp[now].second;
      cost += abs(y - b) + abs(x - a);
      now = next;
    }
  }
  // print(dp);

  rep(i, q){
    int now = qs[i].first;
    int goal = qs[i].second;
    cout << dp[goal] - dp[now] << endl;
  }
}


Measured memory_bytes: 13952
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()


int main(){
  ll r;
  cin >> r;
  cout << 3*r*r << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(string[] args){
    var vals = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    int X=vals[0];
    int A=vals[1];
    if(X<A){
    Console.WriteLine(0);
    }
    else{
        Console.WriteLine(10);
    }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << (s.find("YAKI") == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main (String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int s = n % 60;
        int m = n / 60 % 60;
        int h = n / 3600;
        System.out.println(h + ":" + m + ":" + s);
    }
}


Measured memory_bytes: 26380
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,m,i,j,mx,x,a[1000];
	while(1)	{
		scanf("%d %d",&n,&m);
		if(n==0 && m==0)	break;
		for(i=0;i<n;i++)	scanf("%d",&a[i]);
		mx=0;
		for(i=0;i<n-1;i++)	{
			for(j=i+1;j<n;j++)	{
				if(a[i]+a[j]<=m)	{
					mx=max(mx,a[i]+a[j]);
				}
			}
		}
		if(mx!=0)	printf("%d\n",mx);
		else printf("NONE\n");
	}
	return 0;
}


Measured memory_bytes: 2656
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		int k = sc.nextInt();
		long[] x1 = new long[x];
		long[] y1 = new long[y];
		long[] z1 = new long[z];
		for(int i = 0; i<x; i++){
			x1[i]=sc.nextLong();
		}
		for(int i = 0; i<y; i++){
			y1[i]=sc.nextLong();
		}
		for(int i = 0; i<z; i++){
			z1[i]=sc.nextLong();
		}
		long[] ab=new long[x*y];
		int index=0;
		for(int i = 0; i<x; i++){
			for(int j = 0; j<y; j++){
				ab[index++]=x1[i]+y1[j];
			}
		}
		Arrays.sort(ab);
		index=0;
		long[] abc = new long[Math.min(x*y,3000)*z];
		for(int i = 0; i<Math.min(x*y,3000); i++){
			for(int j = 0; j<z; j++){
				abc[index++]=ab[x*y-1-i]+z1[j];
			}
		}
		Arrays.sort(abc);
		for(int i = 0; i<k; i++){
			System.out.println(abc[abc.length-1-i]);
		}
	}
}


Measured memory_bytes: 62408
#!/usr/bin/env python3

MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

X, Y, Z = map(int, input().split())

print(str(Z)+' '+ str(X) + ' ' + str(Y))


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(Math.max(c - (a - b), 0));

	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int a;
cin>>a;
int b=0;
for(int i=0;i<=a;i++)
b+=i;
cout<<b;
system("pause");
return 0;
}

Measured memory_bytes: 504
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let vec_str: Vec<String> = s.trim().split_whitespace().map(|x| x.to_string()).collect();
    let N = vec_str[0].parse::<i32>().unwrap();
    
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let vec_str: Vec<String> = s.trim().split_whitespace().map(|x| x.to_string()).collect();
    let a_vec: Vec<f64> = vec_str.iter().map(|x| x.parse::<f64>().unwrap()).collect();

    println!("{:?}", 1.0 / a_vec.iter().fold(0.0,|sum, x| sum + 1.0 / x));

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

ll mod(ll &a) {
	return ((a%=MOD) > 0 ? a : a+MOD);
}

const int MAXN = 1e5+10;
ll fact_[MAXN] = {0};

ll fact(ll n) {
	if(n == 1) return fact_[n] = 1;
	if(fact_[n] != 0) return fact_[n];
	return fact_[n] = (n * fact(n-1)) % MOD;
}

//aのb乗
ll powMod(ll a, ll b) {
	ll res = 1;
	while(b > 0) {
		if(b & 1) res = res * a % MOD;
		if(res==0) res = MOD;
		a = a * a % MOD;
		if(a==0) a = MOD;
		b >>= 1;
	}
	return res;
}

ll comb(ll a, ll b){
  if(a==b || b==0) return 1;
  return (((fact(a)*powMod(fact(b),MOD-2))%MOD)*powMod(fact(a-b),MOD-2))%MOD;
}

int main(){
	int N, K;
	cin >> N >> K;
	vector<ll> A(N);
	for(auto &a : A) cin >> a;
	sort(A.begin(), A.end());
	ll ans = 0;
	for(ll n=0;n<=N-K;n++) {
		ll plus =  ((A[N-1-n] - A[n]) * comb(N-1-n,K-1)) % MOD;
		if(plus < 0) plus += MOD;
		ans += plus;
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
N = int(input())
H = list(map(int, input().split()))
H.append(10**10)
num = 0
ans = 0
for i in range(N):
  if H[i] >= H[i+1]:
    num += 1
  else:
    ans = max(num, ans)
    num = 0
print(ans)

Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n;
    int ar[200002];
    scanf("%d",&n);
    for(int i=0;i<=n-1;i++)
    {
        scanf("%d",&ar[i]);
    }
    int cur =1;
    int cnt=0;
    for(int i=0;i<=n-1;i++)
    {
        if(ar[i]==cur)
        {
            cur++;
        }
        else
        {
            cnt++;
        }
    }
    if(cnt<n)
    printf("%d",cnt);
    else
    {
        printf("-1");
    }
    return 0;

}


Measured memory_bytes: 1024
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
uvw = [LIST() for _ in range(N-1)]

graph = defaultdict(list)

for u, v, w in uvw:
	graph[u-1].append((v-1, w))
	graph[v-1].append((u-1, w))

#print(graph)

colors=[-1]*N
colors[0]=0

def DFS(node):
	for x, w in graph[node]:
		if colors[x] == -1:
			if w%2:
				colors[x] = colors[node]^1
			else:
				colors[x] = colors[node]
			DFS(x)

DFS(0)

#print(colors)

for x in colors:
	print(x)





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

int main() {
  int X;
  int Y;
  cin >> X >> Y;

  for (int i = 0; i <= X; i++) {
    if (2 * i + 4 * (X - i) == Y) {
      cout << "Yes" << endl;
      exit(0);
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

const long long INF = (long long) 1e11+1;
const long long mod = (long long) 100000000 ;
const long long hell = (long long) 1000000007;


ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x*res);
    x=(x*x);    
    y=y/2;
  }
  return res;
}

ll modinv(ll x,ll m){
  return power(x,m-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}

int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;

   while(test--)
   solve();
}

void solve(){
   int n,m;
   cin>>n>>m;
   int a[n];
   int sum=0;
   forn(i,0,n)
   {
       cin>>a[i];
       sum+=a[i];
   }
   sort(a,a+n);
   
   int cnt=0;
   for(int i=n-1;i>=0;i--){
      if(a[i]*4*m<sum)
      break;
      cnt++;
   }
   if(cnt>=m)
   cout<<"Yes";
   else
   cout<<"No";
}


///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/
// gcd of strings
/*
string getgcd(string s1,string s2){
    
    while(true){
        if(s1.length()<s2.length()){
            swap(s1,s2);
            continue;
        }
        if(s2.empty())
        return s1;
        
        if(s1.substr(0,s2.length())!=s2)
        return "";
        
        s1=s1.substr(s2.length());
    }
}
*/
/*
// for user defined DS hashmap and set
 
struct hash_pair{
      size_t operator()(const pair<int,pair<int,int>>& p) const{
          auto hash1=hash<int>()(p.F) ;
          auto hash2=hash<int>()(p.S.F) ;
          auto hash3=hash<int>()(p.S.S) ;
          return (hash1^hash2)^hash3;
      }  
};
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
*/



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>
#include<cassert>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

const int MAX=21;
const int INF=1<<29;

int dp[MAX][50001];

int main(){
	int n, m;
	int coin[MAX];
	cin >> n >> m;
	for (int i = 0; i < m; i ++) {
		cin >> coin[i];
	}
	dp[0][0] = 0;
	for (int k = 1; k <= n; k ++) {
		dp[0][k] = INF;
	}
	for (int i = 1; i <= m; i ++) {
		int d = coin[i - 1];
		for (int k = 0; k <= n; k ++) {
			if (k >= d) {
				dp[i][k] = min(dp[i-1][k], dp[i][k-d] + 1);
			} else {
				dp[i][k] = dp[i-1][k];
			}
		}
	}
	
	cout << dp[m][n] << endl;

	return 0;

}

Measured memory_bytes: 5264
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    	cin >> a[i];
    int x[n],y[n];
    x[0]=0,y[0]=a[0];
    x[1]=max(a[0],a[1]);
    for(int i=2;i<n;i++){
        if(i%2)
            x[i]=a[i]+max(x[i-2],y[i-3]);
        else{
            x[i]=a[i]+x[i-2];
            if(i>=4){
                x[i]=max(x[i],a[i]+y[i-4]);
                x[i]=max(x[i],a[i]+x[i-3]);
            }
            y[i]=a[i]+y[i-2];
        }
    }
    if(n%2)cout << max(x[n-1],x[n-2]);
    else cout << max(x[n-1],y[n-2]);
}

Measured memory_bytes: 8348