akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<limits>
#include<stack>

using namespace std;

typedef unsigned long long ll;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;

int INF = std::numeric_limits<int>::max();
int NINF = std::numeric_limits<int>::min();
int MOD = 1e9+7;

int col[] = {0,-1,0,1,1,1,-1,-1};
int row[] = {-1,0,1,0,1,-1,1,-1};

//knight moves
int cc[] = {1,2,2,1,-1,-1,-2,-2};
int rr[] = {-2,-1,1,2,-2,2,1,-1};

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

    int n,k;
    cin >> n >> k;

    vi hight(n);
    vll cost(n,INF);

    cin >> hight[0];
    cost[0] = 0;

    for(int i = 1 ; i < n ; ++i)
    {
        cin >> hight[i];

        if(i > k)
        {
            for(int j = i-1; j >= i-k ; --j)
            {
                ll one = abs(hight[i]-hight[j]);

                cost[i] = min(one+cost[j],cost[i]);
            }
            //cout << i << " " << cost[i] << endl;
        }
        else
        {
            cost[i] = abs(hight[0]-hight[i]);
        }
    }

    cout << cost[n-1];

    return 0;
}


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

int main() {
  
  int N, M; cin >> N >> M; int sum = 0;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) {
    int A; cin >> A;
    vec[i] = A; sum += A;
  }
  
  sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end());
  
  double criterion = double(sum) / M / 4;
  
  for (int i = 0; i < M; i++) {
    
    if (double(vec[i]) < criterion) {
      cout << "No" << endl;
      return 0;
    }
    
  }
  
  cout << "Yes" << endl;
  
}

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

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

int main() {

    int m,d; cin >> m >> d;

    int ans = 0;
    erep(i, m) erep(j, d) {
        auto d1 = j%10;
        auto d10 = j/10;
        if(d1 >= 2 && d10 >= 2 && d1*d10 == i) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}



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

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

  int len = s.length();

  for (int i = 0; i < len; i++) {
    if (s[i] != '?') continue;
    if (i - 1 >= 0) {
      if (i + 1 < len) {
        if (s[i - 1] == 'P') {
          s[i] = 'D';
          continue;
        } else {
          if (s[i + 1] == 'D') {
            s[i] = 'P';
          } else {
            s[i] = 'D';
          }
          continue;
        }
      } else {
        s[i] = 'D';
        continue;
      }
    } else {
      if (i + 1 < len) {
        if (s[i + 1] == 'P') {
          s[i] = 'D';
        } else {
          s[i] = 'P';
        }
        continue;
      } else {
        s[i] = 'D';
      }
      continue;
    }
  }
  cout << s << endl;
}


Measured memory_bytes: 3724
//============================================================================
// Name        : HelloCPP.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {

	bool cards[4][14];
	int n,rank;
	char suit;

	for (int s = 0; s < 4; s++ )
		for(int r = 1; r <= 13; r++ )
			cards[s][r] = 0;

	cin >> n;
	for (int i = 0; i < n; i++ ){
		cin >> suit >> rank;
		if(suit == 'S')cards[0][rank] = 1;
		if(suit == 'H')cards[1][rank] = 1;
		if(suit == 'C')cards[2][rank] = 1;
		if(suit == 'D')cards[3][rank] = 1;
	}

	for (int s = 0; s < 4; s++ ){
		for(int r = 1; r <= 13; r++ ){
			if(cards[s][r]==0){
				if(s == 0) suit = 'S';
				if(s == 1) suit = 'H';
				if(s == 2) suit = 'C';
				if(s == 3) suit = 'D';
				cout << suit << " " << r << endl;
			}
		}
	}
	/*
	int cards[4][13];
	int n,cardNum;
	char t;

	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 13; j++){
			cards[i][j] = 0;
		}
	}

	cin >> n;

	for(int k = 0; k < n + 1; k++){
		cin >> t >> cardNum;
		cout << t << " " << cardNum << endl;
		if(t == 'S')cards[0][cardNum] = 1;
		if(t == 'H')cards[1][cardNum] = 1;
		if(t == 'C')cards[2][cardNum] = 1;
		if(t == 'D')cards[3][cardNum] = 1;
	}

	for(int i = 0; i < 4; i++){
			for(int j = 0; j < 13; j++){
				cout << cards[i][j] << " ";
			}
		cout << endl;
	}


	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 13; j++){
			if((cards[i][j] == 0)){
				if(i == 0) cout << 'S' << " " << j + 1  << endl;
				else if(i == 1) cout << 'H' << " " << j + 1  << endl;
				else if(i == 2) cout << 'C' << " " << j + 1 << endl;
				else if(i == 3) cout << 'D' << " " << j + 1 << endl;
			}
		}
	}

	return 0;
	*/

}

Measured memory_bytes: 3076
#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int h,w; cin >> h >> w;
  vector<vector<char> > a(h,vector<char>(w));
  rep(i,h) rep(j,w) cin >> a[i][j];
  set<int> tate,yoko;
  rep(i,h){
    rep(j,w){
      if(a[i][j] == '#'){
        tate.insert(i);
        continue;
      }
    }
  }
  rep(j,w){
    rep(i,h){
      if(a[i][j] == '#'){
        yoko.insert(j);
        continue;
      }
    }
  }
  for(auto y : tate){
    for(auto x : yoko){
      cout << a[y][x];
    }
    cout << "\n";
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <sstream>
#include <bitset>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N, M;
int a[55], b[55];
vector<int> G[55];
bool visit[55];

bool dfs(int v, int g)
{
    if (v == g) return true;
    visit[v] = true;
    for (int ne : G[v]) {
        if (!visit[ne] && dfs(ne, g)) return true;
    }
    return false;
}

signed main()
{
    cin >> N >> M;
    REP(i,M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    int ans = 0;
    REP(i,M) {
        REP(j,N) G[j].clear();
        REP(j,M) {
            if (i == j) continue;
            G[a[j]].push_back(b[j]);
            G[b[j]].push_back(a[j]);
        }
        fill(visit, visit + 55, false);
        if (!dfs(a[i], b[i])) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[110],B[110], C[110];
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N - 1) cin >> C[i];
    int ans = 0;
    rep(i, N) {
        ans += B[A[i] - 1];
        if (i != N - 1 && A[i] + 1 == A[i + 1])
            ans += C[A[i] -1];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
AB = {}
for i in range(N):
  A,B = map(int,input().split())
  if B in AB.keys():
    AB[B] += A
  else:
    AB[B] = A
time = 0
for b in sorted(AB.keys()):
  time += AB[b]
  if time > b:
    print("No")
    break
else:
  print("Yes")

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

const int hmax=100000;
int N;
vector<int> h;
vector<int> cost;

int dfs(int i, vector<int> &cost){
  if (i==N){
    cost.at(N)=0;
    return h.at(N);
  }
  if (i==N+1){
    cost.at(N+1)=0;
    return hmax;
  }
  if (cost.at(i) != -1)
    return h.at(i);
  dfs(i+2,cost);
  dfs(i+1,cost);
  cost.at(i)=min( abs(h.at(i)-dfs(i+2,cost))+cost.at(i+2)
                 ,abs(h.at(i)-dfs(i+1,cost))+cost.at(i+1) );
  return h.at(i);
}

int main(){
  cin >> N;
  h.resize(N+1);
  for (int i=1;i<=N;i++){
    cin >> h.at(i);
  }
  cost.resize(N+2,-1);
  dfs(1,cost);
  /*
  for (auto c:cost){
    cout << c;
  }
  cout << endl;
  */
  cout << cost.at(1) << endl;
  
  
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, d, a, b, s;
  in2(n, d);
  d = d * d;
  s = 0;
  rep(i, n){
    in2(a, b);
    a = a * a;
    b = b * b;
    if(a + b <= d)
      s++;
  }
  out(s);
  memi;
}

Measured memory_bytes: 3648
import sys
n, m = map(int, input().split())
danger = [int(input()) for i in range(m)]

MOD = 1000000007
MAX = 200000           #適当な数を入力
fac, finv, inv = [[0]*MAX for i in range(3)]
def combinit():     #MAXまでの下準備
  fac[0] = fac[1] = 1
  finv[0] = finv[1] = 1
  inv[1] = 1
  for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

def modcomb(n, k):      #mod(nCk)を計算、ただしn<MAX
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
combinit()          #下準備の実行 O(MAX)

def poss(n):
  n -= 1
  k = n//2
  ans = 0
  for i in range(k+1):
    ans += modcomb(n-i, i) % MOD
  return ans % MOD
if m == 0:
  print(poss(n+1))
  sys.exit()
ans = poss(danger[0])
for i in range(1, m):
  if danger[i] - danger[i-1] == 1:
    print(0)
    sys.exit()
  ans *= poss(danger[i] - danger[i-1] - 1)
  ans = ans % MOD
ans *= poss(n - danger[m-1])

print(ans % MOD)



Measured memory_bytes: 30776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif
 
using namespace std;
 
typedef long long int ll;
 
template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
 
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    
    auto greedy = [&] (ll X) {
	ll x = 0;
	for (int i = 60; i >= 0; i--) {
	    ll mask = 1LL << i;
	    int cnt = 0;
	    REP (j, 0, N) {
		if (A[j] & mask) {
		    cnt++;
		}
	    }
	    if (2 * cnt < N) {
		x += 1LL << i;
	    }
	}
	return x & X;

    };

    auto calc = [&](ll X) {
	ll res = 0;
	REP (i, 0, N) {
	    res += A[i] ^ X;
	}
	return res;
    };
    
    ll ans = calc(K);
    ll X = 0;
    for (int i = 60; i >= 0; i--) {
	ll mask = 1LL << i;
	if (!(K & mask)) continue;
	ll x = greedy(mask - 1);
	ans = max(ans, calc(x + X));
	X += mask;
    }
    
    
    cout << ans << endl;
 
    return 0;
}


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

set<int> X;
int s;
int m = 1;

int main(){
  cin >> s;
  X.insert(s);
  while (true){
    m ++;
    if (s % 2 == 0) s /= 2;
    else s = s*3 + 1;
    if (X.count(s)) break;
    X.insert(s);
  }
  cout << m << endl;
}


Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long n;
  cin >> n;
  if (n % 2) {
    cout << 0 << '\n';
    return 0;
  }
  long long ans = 0;
  for (long long x = 10; x <= n; x *= 5) {
    ans += n / x;
    if (5. * x > 1e18) break;
  }
  cout << ans << '\n';
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	int ans = 700;
	if (S[0] == 'o') ans += 100;
	if (S[1] == 'o') ans += 100;
	if (S[2] == 'o') ans += 100;
	cout << ans;
}

Measured memory_bytes: 256
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    var c: Pair<Long, Long>? = null
    var count = 1
    0.until(n).map {
        val (x, l) = longList()
        Pair(x - l, x + l)
    }
        .sortedBy { it.second }
        .forEach { next ->
            c?.let {
                if (it.second <= next.first) {
                    count++
                    c = next
                }
            } ?: run {
                c = next
            }
        }
    println(count.toString())
}

Measured memory_bytes: 71508
#include<iostream>
using namespace std;
int main()
{
    int x1,x2,x3,x4,x5,n;
    cin>>x1>>x2>>x3>>x4>>x5;
    n=0;
    if(x1==n)
    {
        cout<<"1";
    }
    else if(x2==n)
    {
        cout<<"2";
    }
    else if(x3==n)
    {
        cout<<"3";
    }
    else if(x4==n)
    {
        cout<<"4";
    }
    else if(x5==0)
    {
        cout<<"5";
    }

}

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

string s;
int v[26], cnt[26];

char rec(int &pos){
    if(s[pos] >= 'a' && s[pos] <= 'z'){
        return s[pos++];
    }
    char lhs, rhs, winner;
    if(s[pos] == '['){
        pos++;
        lhs = rec(pos);
    }
    if(s[pos] == '-') pos++;
    rhs = rec(pos);
    pos++;
    if(v[lhs-'a'] > cnt[lhs-'a']){
        cnt[lhs-'a']++;
        winner = lhs;
    }
    else{
        cnt[rhs-'a']++;
        winner = rhs;
    }
    return winner;
}

int main() {
    cin >> s;
    char a;
    while(cin >> a) cin >> v[a-'a'];
    int pos = 0;
    rec(pos);
    bool ok = true;
    for(int i=0;i<26;i++){
        ok &= cnt[i] == v[i];
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 3200
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int ans = 0;
        
        if(a >= b){
            ans = a-(b+w);
        }else{
            ans = b-(a+w);
        }
        
        if(ans < 0){
            ans = 0;
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<double> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    
    double under = 0;
    for(int i = 0; i < n; i++){
        under +=  1/ a[i];
    }
    
    double ans = 1 / under;
    
    cout << ans;
}


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

using namespace std;

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

	string* name = new string[N];
	int* p = new int[N];
	bool* flag = new bool[N];

	for (int i = 0; i < N; i++) {
		cin >> name[i];
		cin >> p[i];
		flag[i] = false;
	}

	for (int k = 0; k < N; k++) {
		string s; s.clear();
		int point = 0;

		int c = -1;
		for (int i = 0; i < N; i++) {
			if (flag[i] == false) {
				if (s.length() == 0 || strcmp(s.c_str(), name[i].c_str()) > 0 || (strcmp(s.c_str(), name[i].c_str())==0 && point < p[i])) {
					c = i;
					point = p[i];
					s = name[i];
				}
			}
		}

		flag[c] = true;
		cout << c + 1 << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion

typedef struct tuple<int, bool, int> ibituple;

typedef struct Node {
  vector<Node *> parents;
  double time;
} node;

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

  string S;
  int N;
  cin >> N >> S;
  REP(i, S.size()) {
    S[i] = S[i] + N > 'Z' ? S[i] + N - 26 : S[i] + N;
  }
  cout << S << "\n";
}


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

int main(){
    int n;
    cin >> n;
    int ans = 0; 
    rep(i, n) ans += i + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        String a = sc.next();
		String b = "YES";
		String c = "NO";
        String d = sc.next();
		String [] ksb = String.valueOf(a).split("");
		String [] ksc = String.valueOf(d).split("");
		
       	if((ksb[0].equals(ksc[2])) && (ksb[1].equals(ksc[1])) && (ksb[2].equals(ksc[0]))) {
       		System.out.println(b); 
       	}else { 
       		System.out.println(c);
       	}
    }
}




Measured memory_bytes: 21972
import sys,math,copy,queue,itertools,bisect
NI = lambda : int(sys.stdin.readline())
INF = 10**18

N = NI()
if N == 2:
    print (1)
    exit (0)
ans = 0
max_b = int(math.log(N,2))
for x in range(2,int(math.sqrt(N-1))+1):
    if (N-1) % x == 0:
        if (N-1) == x**2:
            ans += 1
        else:
            ans += 2
for x in range(1, int(math.sqrt(N)) + 1):
    if N % x == 0:
        for b in range(1,max_b+1):
            k = round(x**(1/b))
            if k**b == x and k > 1:
                if (N//x-1) % k == 0:
                    ans += 1
            if x**2 != N:
                x = N // x
                k = round(x ** (1 / b))
                if k ** b == x and k > 1:
                    if (N // x - 1) % k == 0:
                        ans += 1

print(ans+1)



Measured memory_bytes: 47960
# !/usr/bin/python3

"""
https://atcoder.jp/contests/abc152/tasks/abc152_d
Low Elements.
"""

def solve(n):
    res = 0

    for num in range(n+1):
        start = int(str(num)[0])
        end = int(str(num)[-1])

        for i in range(10):
            for j in range(10):
                if i == start and j == end: dp[i][j] += 1

    for i in range(1, 10):
        for j in range(1, 10):
            res += dp[i][j]*dp[j][i]
    # for each in dp: print(each)

    return res


if __name__ == "__main__":
    n = int(input())
    dp = [[0 for _ in range(10)] for _ in range(10)]

    print(solve(n))


Measured memory_bytes: 9244
// https://atcoder.jp/contests/abc135/tasks/abc135_a

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

struct C {
    ll A_{};
    ll B_{};

    explicit C(ll A, ll B) : A_(A), B_(B){}
    ll resolve() {
        ll K = (A_ + B_ )/2;
        if (abs(K-A_) == abs(K-B_)) {
            return K;
        }
        return INT64_MAX;
    }
};

int main() {
    ll A, B;
    cin >> A >> B ;
    C c{A, B};
    auto a = c.resolve();
    if (a == INT64_MAX) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int n=0;
    cin >> n;
    int x[n],y[n];
    rep(i,n)cin >> x[i] >> y[i];
    int cur[n];
    rep(i,n)cur[i]=i;
    long double dict=0.0,sum=0.0;
    do{
        rep(i,n-1){
            long double a = pow((double)x[cur[i]]-(double)x[cur[i+1]],2);
            long double b = pow((double)y[cur[i]]-(double)y[cur[i+1]],2);
            dict += pow(a+b,0.5);
        }
        sum+=dict;
        dict = 0;
    }while(next_permutation(cur,cur+n));

    int factorial = 1;
    rep2(i,2,n+1)factorial*=i;
    cout << fixed << setprecision(10) << sum / factorial << endl;

    return 0;
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[55][55];
int cnt(int x,int y){
    int v=0;
    REPP(i,-1,2)REPP(j,-1,2){
        v+=(s[x+i][y+j]=='#');
    }
    return v;
}
int main(){
    DRII(N,M);
    REP(i,N)RS(s[i+1]+1);
    REPP(i,1,N+1)REPP(j,1,M+1){
        if(s[i][j]=='.')s[i][j]=cnt(i,j)+'0';
    }
    REPP(i,1,N+1)puts(s[i]+1);
    return 0;
}


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

using namespace std;

int main(){
        
    int i, n;
    double ave, sd, sum;
    double * S;
    
    while(1){
        cin >> n;
        if(n == 0){break;}
  
        S = new double [n];
        
        sum = 0;
        for(i = 0; i < n; i++){
            cin >> S[i];
            sum += S[i];
        }
            
        ave = (double) sum / (n);
        sum = 0;
        
        for(i = 0; i < n; i++){
            sum += pow(S[i] - ave, 2);
        }
        
        sd = sqrt(sum / n);
        cout << fixed << sd << endl;
        delete[] S;
    }
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int ans[100000];
vector<vector<pi>> e;
void rec(int c, int p, int col){
	int nxt = 1;
	for(pi i : e[c]) if(i.first != p){
		while(nxt == col) nxt++;
		rec(i.first, c, nxt);
		ans[i.second] = nxt++;
	}
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	e.resize(n);
	rep(i, n - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].emplace_back(b, i);
		e[b].emplace_back(a, i);
	}
	rec(0, 0, 0);
	cout << *max_element(ans, ans + n - 1) << endl;
	rep(i, n - 1) cout << ans[i] << endl;
	
	return 0;
}

Measured memory_bytes: 8320
def main():
  n = int(input())
  
  mod = 10**9 + 7

  a = n // 3
  
  if a == 0: return 0
  if a == 1: return 1
  
  dp = [0]*(n+1)
  dp[3] = 1
  dp[4] = 1
  dp[5] = 1

  def recursion(a):
    if dp[a] != 0:
      return dp[a]
    cnt = 0
    for i in range(3, a-2):
      cnt += 1
      if i >= 6:
      	cnt = cnt + recursion(i) % mod
    
    cnt = cnt % mod
    dp[a] = cnt
    return cnt
  
  ans = recursion(n)
  
  return ans + 1    
  
cnt = main()
print(cnt)

Measured memory_bytes: 9152
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    string s = readln.chomp;

    writeln(s[0 .. min($, 4)] == "YAKI" ? "Yes" : "No");
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int N,T;
	scanf("%d %d",&N,&T);
	int c[N];
	int t[N];
	int min =1001;
	int i;
	int ans =1001;
	for(i=0;i<N;i++){
		scanf("%d %d",&c[i],&t[i]);
		if( t[i]<=T){
			if(c[i]<ans){
				ans = c[i];
			}
		}
	}
	if( ans ==1001){
		printf("TLE");
	}else{
		printf("%d",ans);
	}
	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

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

int mp[100];
int seica;

int main(){
	
	ll n;cin >> n;
	if(n < 0){
		n = -n;
		seica = 1;
	}
	
	REP(i,60){
		if(n & (1LL << i))mp[i]++;
	}
		
	REP(i,99){
		mp[i+1] += (mp[i]/2);
		mp[i] %= 2;
		if(mp[i] && (i+seica) % 2 == 1)mp[i+1]++;
	}
	
	bool flag = false;
	for(int i = 99;i >= 0;i--)
	{
		if(i == 0 || mp[i])flag = true;
		if(flag)cout << mp[i];
	}
	cout << endl;

	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int n;
	String str;
	boolean[] visited;
	void run() {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			str = sc.next();
			if(str.equals("0")) break;
			n = str.length();
			int max = 1;
			for(int i=0;i<n;i++) max *= 3;
			visited = new boolean[max];
			int ans = bfs(new Worm(str));
			if( ans < 0 ) System.out.println("NA");
			else System.out.println(ans);
		}
	}
	
	int bfs(Worm worm) {
		LinkedList<Worm> que = new LinkedList<Worm>();
		que.add(worm);
		visited[worm.w] = true;
		Worm w = new Worm("");
		while(true) {
			if(que.isEmpty()) return -1;
			w = que.removeFirst();
//			System.out.println(w.w);
			int col = w.w;
			int a = col%3;
			int b = col%3;
			int tmp = 1;
			boolean f = true;
			for(int i=0;i<n-1;i++) {
				a = b;
				tmp *= 3;
				b = (col/tmp)%3;
				if(a != b) {
					Worm next = new Worm(col - a*tmp/3-b*tmp + (tmp+tmp/3) * (3-a-b), w.cnt+1);
					if(!visited[next.w]) {
						que.addLast(next);
						visited[next.w] = true;
					}
					f = false;
				}
			}
			if(f) return w.cnt;
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	class Worm {
		int w, cnt;
		Worm(String str) {
			int tmp = 1;
			for(int i=0;i<str.length();i++) {
				switch (str.charAt(i)) {
				case 'r': w += tmp * 0; break;
				case 'g': w += tmp * 1; break;
				case 'b': w += tmp * 2; break;
				}
				tmp *= 3;
			}
			cnt = 0;
		}
		
		Worm(int w, int cnt) {
			this.w = w;
			this.cnt = cnt;
		}
	}
	
}

Measured memory_bytes: 14000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;++i)
#define MOD (int) 1e9+7

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    rep(i, n){
        int tmp;
        cin >> tmp;
        mp[tmp]++;
    }

    map<int, int> mmp;
    if(n%2==0){
        for(int i=1;i<n;i+=2){
            mmp[i]+=2;
        }
    }else{
        mmp[0]=1;
        for(int i=2;i<n;i+=2){
            mmp[i]+=2;
        }
    }

    if(mp.size()!=mmp.size()){
        cout << 0 << endl;
        return 0;
    }
    for(auto q:mp){
        if(q.second != mmp[q.first]){
            cout << 0 << endl;
            return 0;
        }
    }

    ll ans = 1;
    rep(i, n/2){
        ans *= 2;
        ans %= MOD;
    }

    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 5888
#include <stdio.h>
#include <math.h>
int abs(int n){
    if(n > 0){
        return n;
    } else {
        return -n;
    }
}


int main(){
  int r, d, x;
  scanf("%d %d %d", &r, &d, &x);
  int Xs[10];
  for(int i =0; i < 10; i++){
    if(i==0){
        Xs[i]=r*x-d;
    } else {
        Xs[i]=r*Xs[i-1]-d;
    }
    printf("%d\n", Xs[i]);
  }
 
  return 0;
}


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

long N, A, B;
vector<long> H;

bool f(int mid) {
  vector<long> V = H;
  for (auto &v : V) v -= B * mid;
  long cnt = 0, tmp = A - B;
  for (auto v : V) if (v > 0) cnt += (v + tmp - 1) / tmp;
  return (cnt <= mid) ? true : false;
}

int main() {
  cin >> N >> A >> B;
  H.resize(N);
  for (auto &h : H) cin >> h;
  int ok = 1e9, ng = -1;
    while (ok - ng > 1) {
      int mid = (ok + ng) / 2;
      (f(mid)) ? ok = mid : ng = mid;
    }
  cout << ok << "\n";
}

Measured memory_bytes: 4796
i, j = map(int,input().split())
ans = 100000000

for m in range(i, min(j, i+2019)): #高々O(2019**2)
  for n in range(m+1, min(j+1, i+2020)):
    x = m * n % 2019
    if x < ans:
      ans = x

print(ans)

Measured memory_bytes: 40684
import sys
from collections import deque


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W, M = map(int, input().split())
    lh = [0] * H
    lw = [0] * W
    ll = []
    for _ in range(M):
        h, w = map(int, input().split())
        lh[h - 1] += 1
        lw[w - 1] += 1
        ll.append((h - 1, w - 1))

    maxh = max(lh)
    maxw = max(lw)
    wlist = []


    # for i in range(H):
    #     if lh[i] != maxh:
    #         continue
    #     for j in wlist:
    #         if (i, j) not in s:
    #             print(maxh + maxw)
    #             exit()
    count = lh.count(maxh) * lw.count(maxw)
    for h, w in ll:
        if lh[h] == maxh and lw[w] == maxw:
            count -= 1

    if count:
        print(maxh + maxw)
    else:
        print(maxh + maxw - 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 104492
n = int(input())
k = int(input())
X = list(map(int, input().split()))
ans = 0

for i in range(n):
    if k - X[i] >= X[i]:
        ans = ans + X[i] * 2
    else:
        ans = ans + (k - X[i] ) * 2

print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>

/*
for(int i=0;i<n;i++)
printf("%d\n",n)
scanf("%d",&n)
*/

using namespace std;
int n,b=1,q[120],g,r=0;
int q3=0,q5=0,q15=0,q25=0;
//int pz[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
vector<int> sc;

int ep(int a,int z){
    int ma=1,mb=1;
    for(int i=2;i<=z;i++)ma*=i;
    for(int i=0;i<z;i++)mb*=(a-i);
    return mb/ma;
}

int main(){
    cin>>n;
    for(int j=0;j<100;j++)q[j]=0;
    for(int i=1;i<=n;i++){
        g=i;
        for(int j=2;j<100;j++){
            
            while(g%j==0){
                g/=j;
                q[j]++;
            }
        }
    }
    
    for(int j=0;j<100;j++){
        //printf(" %d ",q[j]);
        if(q[j]>=74)r++;
        if(q[j]>=24)q25++;
        if(q[j]>=14)q15++;
        if(q[j]>=4)q5++;
        if(q[j]>=2)q3++;
        
    }
    
    r+=q25*(q3-1);
    r+=q15*(q5-1);
    r+=q5*(q5-1)*(q3-2)/2;
    //else r=0;
    
    printf("%d\n",r);
}
/*
32400
63504
90000
156816
202500
219024

 */


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <cassert>

using namespace std;

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

int main() {
  ll N, M;

  cin >> N >> M;

  vector<vector<ll> > inlst(N + 1);
  vector<vector<ll> > outlst(N + 1);
  vector<ll> cnt(N + 1, 0);
  vector<ll> val(N + 1, 0);
  queue<ll> q;
  ll rest = N;

  for (int i = 0; i < M; i++) {
    ll a, b;
    cin >> a >> b;
    inlst[b].push_back(a);
    outlst[a].push_back(b);
    cnt[b]++;
  }

  for (int i = 1; i <= N; i++) {
    if (cnt[i] == 0) q.push(i);
  }

  ll ans = 0;
  while (rest > 0) {
    assert(!(q.empty() && rest > 0));

    ll cur = q.front();
    q.pop();
    ll curmax = 0;
    for (auto& n : inlst[cur]) {
      curmax = max(curmax, val[n]);
    }  // n
    val[cur] = curmax;
    if (inlst[cur].size() > 0) val[cur]++;
    for (auto& n : outlst[cur]) {
      cnt[n]--;
      if (cnt[n] == 0) q.push(n);
    } // n
    rest--;
    ans = max(val[cur], ans);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12800
(n, k)=input().split()

hmax=0
hmin=99999999999999

n = int(n)
k = int(k)

n_list=[]
while True:
    try:
        n_list.append(int(input()))
    except EOFError:
        break

n_list.sort()

for i in range(0, n-k+1):
    diff = n_list[i+k-1] - n_list[ i ]
    if hmin > diff:
        hmin = diff

print( hmin )


Measured memory_bytes: 7508
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String tmp = String.valueOf(N);
        boolean flg = false;

        for(int i = 0; i < 3; i++) {
            if(tmp.charAt(i) == '7') {
                flg = true;
            }
        }
        if(flg == true)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 26912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int k = sc.nextInt();
		int gu = 0;
		int ki = 0;

		for (int i = 1; i <= k; i++) {
			if (i % 2 == 0) {
				gu++;
			} else {
				ki++;
			}
		}

		out.println(gu*ki);
		out.flush();

	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


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

using namespace std;

const int N = 2e5 + 5;
const int M = 1e6 + 9;
const long long INF = 1e9 + 7;
const int SM = 1e3 + 4;
const double EPS = 3e-16;
const int K = 25;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    
    int n, k; cin >> n >> k;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int x; cin >> x;
        if(x >= k) cnt++;
    }
    
    cout << cnt;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

const int NONE = 0, WHITE = 1, BLACK = 2;
struct Node{
    vector<Node*> dests;
    int color = NONE;
    void add(Node* n){
        dests.push_back(n);
    }
    void add2(Node* n){
        add(n);
        n->add(this);
    }
    int dfs(Node* dest, Node* from = nullptr, int len = 0){
        if(this == dest){
            color = WHITE;
            return (len + 1) / 2 - 1;
        }
        for(Node* d : dests){
            if(d == from){ continue; }
            int ret = d -> dfs(dest, this, len + 1);
            printd(ret);
            if(ret > 0){
                color = WHITE;
                return ret - 1;
            }else if(ret == 0){
                color = BLACK;
                return 0;
            }
        }
        return -1;
    }
    void dfs2(Node* from = nullptr, int c = 0){
        if(c){
            color = c;
        }
        for(Node* d : dests){
            if(d == from || (d->color && d->color != color)){ continue; }
            d->dfs2(this, color);
        }
    }
};

int main(){
    int n; cin >> n;
    vector<Node> nodes(n);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        nodes[a].add2(&nodes[b]);
    }
    nodes[0].dfs(&nodes[n - 1]);
    for(int i = 0; i < n; i++){
        prints(i, nodes[i].color == BLACK ? "BLACK" : nodes[i].color == WHITE ? "WHITE" : "NONE");
    }
    nodes[0].dfs2();
    nodes[n - 1].dfs2();
    int f = 0;
    for(int i = 0; i < n; i++){
        f += nodes[i].color == BLACK ? 1 : -1;
        prints(i, nodes[i].color == BLACK ? "BLACK" : nodes[i].color == WHITE ? "WHITE" : "NONE");
    }
    cout << (f > 0 ? "Fennec" : "Snuke") << '\n';
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  string s;
  cin >> s;
  cout << (s == "ABC" ? "ARC\n" : "ABC\n");
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
int main()
{
  int i, j, k ;
  int n, b, f, r, v ;
  int m[100][100][100];

  scanf("%d",&n) ;

  for( i = 0 ; i < n ; i++ ){
    scanf("%d %d %d %d",&b,&f,&r,&v) ;
    m[b-1][f-1][r-1] += v ;
  }

  for( i = 0 ; i < 4 ; i++ ){
    if( i < 3 ){
      for( j = 0 ; j < 3 ; j++ ){
        for( k = 0 ; k < 10 ; k++){
          printf(" %d",m[i][j][k]) ;
        }
        printf("\n") ;
      }
      printf("####################\n") ;
    }
    else if( i == 3 ){
      for( j = 0 ; j < 3 ; j++ ){
        for( k = 0 ; k < 10 ; k++){
          printf(" %d",m[3][j][k]) ;
        }
        printf("\n") ;
      }
    }
  }

  return 0 ;
}


Measured memory_bytes: 2028
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;i++)
using ll = long long;
using ull = unsigned long long;
using llv = vector<long long>;


int main(void){
    ll n;
    cin >> n;
    llv v (n);
    rep(i,n) cin >> v[i];
    sort(v.begin(),v.end());
    rep(i,n-1) {
        if (v[i] == v[i+1]) {
            cout << "NO" << endl; return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

int main(void){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll res = 0;
    res += min(a,k);
    k -= min(a,k);
    k -= min(b,k);
    res -= min(k,c);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(){
	int n,i,j,k=0,temp;
	int a[100]; 
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int flag=1;
	for(i=0;flag==1;i++){
		flag=0;
		for(j=n-1;j>=i+1;j--){
			if(a[j]<a[j-1]){
				flag=1;
				temp=a[j];
				a[j]=a[j-1];
				a[j-1]=temp;
				k++;
			}
		}
	}
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[i]);

	 printf("%d\n",k);

} 


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cout<<"ACL";
    }
    cout<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


Measured memory_bytes: 3612
#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

const int MAX_M = 7, MAX_B = 10, MAX_N = 1000;
int m,g,n;
int a[MAX_M], b[MAX_M];
int dp[MAX_M + 1][MAX_N + 1];

int main()
{
    while(cin >> m && m) {
        for(int i = 0; i < m; i++)
            cin >> a[i] >> b[i];

        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;

        for(int i = 0; i < m; i++) {
            for(int j = 0; j <= MAX_N; j++) {
                for(int k = 0; k <= b[i]; k++) {
                    if(j + a[i] * k > 1000) continue;
                    dp[i+1][j+a[i]*k] += dp[i][j];
                }
            }
        }
        
        cin >> g;
        for(int k = 0; k < g; k++) {
            cin >> n;
            cout << dp[m][n] << endl;
        }

        
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define yoi cout<<"yo"<<endl;
#define debug(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
const lli inf=1e18;
const int mod=1e9+7;
int main(){
IOS;
int n,i,j;
cin>>n;
vector<int> v;
int x;
for(i=0;i<n;i++){
    cin>>x;
    v.pb(x);
}
sort(all(v));
lli ans=0;
for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
        int y=lower_bound(all(v),v[j]+v[i])-v.begin();
        int x=upper_bound(all(v),v[j]-v[i])-v.begin();
        ans+=(lli)y-(lli)x;
        if(j<y&&j>=x)
            ans--;
        if(i<y&&i>=x)
            ans--;
        //cout<<v[i]<<" "<<v[j]<<" "<<x<<" "<<y<<" "<<ans<<endl;
    }
}
cout<<ans/3<<endl;
}


Measured memory_bytes: 256