akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;

//奇数同士でマッチングを取るために最短経路を求めて...とか考えていたがそんな必要なかったんやが
//縦と横に順番に奇数を運んでマッチングとっていくだけ
//偶数個奇数があれば全部偶数にできるし奇数個だと1つ余る
int main(){

    ll H, W; cin >> H >> W;

    vector<vector<ll > > vec(H, vector<ll >(W, 0));

    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            ll t; cin >> t;
            if(t % 2 == 0){
                vec[i][j] = 0;
            }else{
                vec[i][j] = 1;
            }
        }
    }

    //右端へ奇数をまとめる
    ll N = 0;
    vector<vector<ll > > ans(191919, vector<ll >(4, 0));

    ll sx, sy;
    for(ll i = 0; i < H; i++){
        bool f = false;
        for(ll j = 0; j < W; j++){ 
            if(f == false){
                if(vec[i][j] == 1){
                    sy = i + 1;
                    sx = j + 1;
                    //vec[i][j] = 0;
                    f = true;
                }
            }else if(f == true){
                ans[N][0] = sy;
                ans[N][1] = sx;
                ans[N][2] = i+1;
                ans[N][3] = j+1;
                N++;
                //cout << sy << " " << sx << " " << i + 1 << " " << j + 1 << endl;
                vec[i][j] += 1;
                sy = i + 1;
                sx = j + 1;
                if(vec[i][j] % 2 == 0){
                    vec[i][j] = 0;
                    f = false;
                }
            }
        }
    }

    //右端の奇数を縦にまとめる
    bool f = false;
    for(ll i = 0; i < H; i++){
            if(f == false){
                if(vec[i][W-1] == 1){
                    sy = i + 1;
                    sx = W;
                    //vec[i][W-1] = 0;
                    f = true;
                }
            }else if(f == true){
                ans[N][0] = sy;
                ans[N][1] = sx;
                ans[N][2] = i+1;
                ans[N][3] = W;
                N++;
                //cout << sy << " " << sx << " " << i + 1 << " " << W << endl;
                vec[i][W-1] += 1;
                sy = i + 1;
                sx = W;
                if(vec[i][W-1] % 2 == 0){
                    //vec[i][W-1] = 0;
                    f = false;
                }
            }        
    }


    /*
    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cout << vec[i][j];
        }
        cout << endl;
    }
    */

    //表示
    cout << N << endl;
    for(ll i = 0; i < N; i++){
        cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " " << ans[i][3] << endl;       
    }


}

Measured memory_bytes: 17536
#include <iostream>

using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(19);
  
  int n; string s;
  cin >> n >> s;
  int w[n+5] = {0};
  int e[n+5] = {0};
  for(int i = 0; i < n; i++){
    if(s[i] == 'W'){
      w[i+1] = w[i] + 1;
      e[i+1] = e[i];
    }
    else{
      e[i+1] = e[i] + 1;
      w[i+1] = w[i];
    }
  }
  int ans = (int)1e6;
  for(int i = 1; i <= n; i++){
    int left = (i - 1) - (e[i-1] - e[0]);
    int right = (n - i) - (w[n] - w[i]);
    ans = min(ans, left + right);     
  }
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 2964
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	while(cin>>n,n){
		vector<int>in(n+1);
		rep(i,n+1)cin>>in[i];
		rep(i,n+1){
			vector<int>tmp=in;
			tmp.erase(tmp.begin()+i);
			bool h=true;
			int sa=tmp[1]-tmp[0];
			rep(j,n-1)if(tmp[j+1]-tmp[j]!=sa){
				h=false;
				break;
			}
			if(h){
				cout<<in[i]<<endl;
				break;
			}
		}
	}	
}

Measured memory_bytes: 1220
#1
N=int(input())
H=[int(x) for x in input().split()]

dp=[0]*N
dp[1]=abs(H[1]-H[0])
for i in range(2,N):
    diff_1=abs(H[i]-H[i-1])
    diff_2=abs(H[i]-H[i-2])
    
    if dp[i-1]+diff_1<dp[i-2]+diff_2:
        dp[i]=dp[i-1]+diff_1
    else:
        dp[i]=dp[i-2]+diff_2
print(dp[-1])    

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

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

	int N; cin >> N;
	vi arr (4);
	F0R(i, N) {
		int x; cin >> x;
		arr[x % 4]++;
	}

	bool ans;
	if (arr[0] == 0) {
		ans = (arr[1] == 0) && (arr[3] == 0);
	} else {
		ans = arr[0] >= (arr[1] + arr[3] + (arr[2] > 0) - 1);
	}

	print(ans ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
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;
}
#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> As(N);
    map<ll, ll> counter;
    REP(n, N) {
        ll a;
        cin >> a;
        As[n] = a;
        counter[a]++;
    }
    ll ans = 0;
    for (auto kv: counter) {
        auto v = kv.second;
        if (v >= 2) ans += v * (v - 1) / 2;
    }
    // cout << "ans = " << ans << endl;

    for(auto a: As) {
        ll ans2 = ans;
        ll v = counter[a];
        if (v >= 2) {
            ans2 -= v * (v - 1) / 2;
            ll b = v - 1;
            if (b >= 2) {
                ans2 += b * (b - 1) / 2;
            }
        }
        cout << ans2 << endl;
    }

    return 0;
}


Measured memory_bytes: 11136
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    if(abs(n-m)>1){
        cout << "0\n";
        return 0;
    }
    ll ans = 1;
    if(n==m){
        for(ll i=1;i<=n;i++){
            ans*=i;
            ans%=mod;
            ans*=i;
            ans%=mod;
        }
        ans*=2;
        ans%=mod;
    }else{
        if(n>m){
            swap(n,m);
        }
        for(ll i=1;i<=n;i++){
            ans*=i;
            ans%=mod;
            ans*=i;
            ans%=mod;
        }
        ans*=m;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <limits>
#include <algorithm>
#include <memory>
#include <climits>
#include <iomanip>

constexpr long long MOD = 1000000007;

int main()
{
  long long r, D, x;
  std::cin >> r >> D >> x;
  for (int i = 1; i <= 10; ++i)
  {
    x = r * x - D;
    std::cout << x << "\n";
  }
  std::cout << std::flush;
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int R = C - (A - B);

		if(R >= 0) {
			System.out.println(R);
		}else {
			System.out.println("0");
		}
	}
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		// 2とこれで割り切れる最小
		int a = 2;
		if (n % a ==0) {
			// 割り切れたらそのまま
			System.out.println(n);
		} else {
			System.out.println(n*a);
		}
		sc.close();

	}

}

Measured memory_bytes: 23636
#include <iostream>
#include <string>

int main()
{
	std::string S;

	std::cin >> S;

	bool ans = true;
	bool checkC = false;

	if (S[0] != 'A')
		ans = false;

	if (ans)
		for (size_t i = 0; i < S.size(); i++) {
			if (i != 0 && S[i] != 'C' && !('a' <= S[i] && S[i] <= 'z')) {
				ans = false;
				break;
			}
			if (i >= 2 && i <= S.size() - 2 && S[i] == 'C') {
				if (!checkC)
					checkC = true;
				else {
					checkC = false;
					break;
				}
			}
		}

	if (ans&&checkC)
		std::cout << "AC\n";
	else
		std::cout << "WA\n";

	return 0;
}

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

int main(){
    ll n,b,a,minT,maxT,maxh=0,mid;
    cin >> n >> a >> b;
    vector<ll> h(n);
    for(int i = 0;i < n;i ++){
        cin >> h[i];
        maxh = max(maxh,h[i]);
    }
    minT = 0;
    maxT = maxh/b+1;
    while(maxT-minT>1){
        mid = (minT+maxT)/2;
        ll cnt=0;
        for(int i = 0;i < n;i ++){
            if(h[i]-mid*b>0)cnt += (h[i]-mid*b-1)/(a-b)+1;
        }
        if(cnt<=mid) maxT = mid;
        else minT = mid;
    }
    cout << maxT << endl;
    return 0;
}

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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; i++)
#define repn(i, st, ed) for(ll i=st; i<=ed; i++)
#define repb(i, ed, st) for(ll i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

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



// Main Code

vector<int> g[N*2];
bool vis[N*2];

void dfs(int curr, set<int> &xx, set<int> &yy)
{
	if(curr > N) yy.insert(curr);
	else xx.insert(curr);
	vis[curr] = 1;
	for(int x: g[curr])
	{
		if(vis[x] == 0)
			dfs(x, xx, yy);
	}
}

int main()
{
	int n;
	cin>>n;
	rep(i,0 ,n)
	{
		int x, y;
		cin>>x>>y;
		y = N + y;
		g[x].pb(y);
		g[y].pb(x);
	}
	ll ans = 0;
	rep(i ,0 ,1e5+1)
	{
		set<int> xx, yy;
		if(vis[i] == 0)
			dfs(i, xx, yy);
		ans += xx.size()*yy.size();
	}
	ans -= n;
	cout<<ans<<endl;
}


Measured memory_bytes: 16896
#include<iostream>
#include<math.h>
#include<string.h>
#define N 1000000
#define rep(i,a,b,c) for(int i=a;i<=b;i+=c)
using namespace std;
int a[1000000];
void seive (){
    int n=sqrt(N);
    int i,j;
    memset(a,0,sizeof(a));
    a[0]=a[1]=1;
    rep(i,2,n,1){
        if(!a[i]){
            rep(j,i+i,N,i){
                a[j]=1;
            }
        }
    }
}

int main(){
    seive();
    int m;
    while(cin>>m){
        int cnt = 0;
        rep(i,0,m,1){
            if(!a[i])cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 5072
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int main()
{
  long long int N,res=1,MOD = 1000000007,n=0,jotai;
  char S[2][100];
  cin >> N;
  N--;
  cin >> S[0];
  cin >> S[1];
  if(S[0][0] == S[1][0]){
    res = 3;
    n += 1;
    jotai = 0;
  }else{
    res = 6;
    n += 2;
    jotai = 1;
  }
    while(N >= n){
      switch(jotai){
      case 0:
        if(S[0][n] == S[1][n]){
          res = res*2 % MOD;
          jotai = 0;
          n += 1;
        }else{
          res = res*2 % MOD;
          jotai = 1;
          n += 2;
        } 
        break;
      case 1:
        if(S[0][n] == S[1][n]){
          res = res % MOD;
          jotai = 0;
          n += 1;
        }else{
          res = res*3 % MOD;
          jotai = 1;
          n += 2;
        }
        break; 
      }
    }
    cout << res << endl;
    
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> t(N + 1), x(N + 1), y(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> t.at(i) >> x.at(i) >> y.at(i);
	}

	//for (int i = 0; i <= N; i++) {
	//	cout << t.at(i) << ' ';
	//	cout << x.at(i) << ' ';
	//	cout << y.at(i) << endl;
	//}

	bool f = true;

	for (int i = 1; i <= N; i++) {
		int n, a, b;
		n = t.at(i) - t.at(i - 1);
		a = abs(x.at(i) - x.at(i - 1));
		b = abs(y.at(i) - y.at(i - 1));

		if (n < a + b) {
			f = false;
			break;
		}
		else if (n > a + b) {
			if ((n - a - b) % 2) {
				f = false;
				break;
			}
		}
	}

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

Measured memory_bytes: 4576
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define loop(i,a,b) for(int i=int(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
typedef vector<int> vi;

int main(){
    int n;
    while(cin>>n && n){
        int mi = 1e9;
        int ma = -1;
        rep(i,n){
            int c = 0;
            rep(i,5){
                int d; cin >> d; c+=d;
            }
            mi = min(mi,c);
            ma = max(ma,c);
        }
        cout << ma << " " << mi << endl;
    }
}

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

using namespace std;

int main() {
	int n, a, b, c, d, totalX, totalY;

	cin >> n >> a >> b >> c >> d;
	totalX = (n / a + (n%a == 0 ? 0 : 1)) * b;
	totalY = (n / c + (n%c == 0 ? 0 : 1)) * d;
	cout << min(totalX, totalY) << endl;

	return 0;
}


Measured memory_bytes: 3128
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False

while True:
    try:
        n=int(input())
    except:
        break
    print(sum(prime[2:n+1]))

Measured memory_bytes: 31912
class Array
  def lcm
    self.inject{|a,b| a.lcm(b)}
  end

  def gcd
    self.inject{|a,b| a.gcd(b)}
  end
end

n = gets.chomp.to_i
a = []
a = gets.chomp.split.map(&:to_i)

#p n 
#p a 
#p a.lcm
cnt = 0
t = a.lcm
#p t
for i in 0..a.length-1
    cnt += (t-1) % a[i]
    #p cnt
end
puts cnt

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

int main(){
    string S , T;
    cin >> S >> T;
    bool ans = false;
    rep(i,S.size()){
        bool ok = true;
        rep(jj,S.size()){
            if(S.at(jj) != T.at((jj+i) %S.size()) ) {
                ok = false;
                break;
            }
        }
        if(ok){
            ans = ok;
            break;
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}   

Measured memory_bytes: 256
N = input()
a = int(N[-1])

pon_list = [0, 1, 6, 8]
hon_list = [2,4,5,7,9]
bon_list = [3]

if a in pon_list:
    print("pon")
elif a in hon_list:
    print("hon")
else:
    print("bon")



Measured memory_bytes: 9168
//Problem C
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=500005;

int n,t;
ll a[N],b,neg,x[N];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)scanf("%lld",&b),a[i]-=b;
	for(int i=1;i<=n;i++){if(a[i]<0)neg+=a[i],++t;else x[++x[0]]=a[i];}
	sort(x+1,x+x[0]+1);
	if(neg>=0){printf("%d",t);return 0;}
	for(int i=x[0];i;i--){
		neg+=x[i];++t;
		if(neg>=0){printf("%d",t);return 0;}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 5120
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
dish = -1

for i in range(N):
    predish = dish
    dish = A[i]
    if dish == predish + 1:
        ans += B[dish-1] + C[predish-1]
    else:
        ans += B[dish-1]

print(ans)


Measured memory_bytes: 3064
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, ans = 0;
  cin >> n;
  REP(i,n+1) ans += i;
  cout << ans << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;
        
        map<int, int> mp;
        for(int x = 1; x <= 100; x++) {
            for(int y = 1; y <= 100; y++) {
                for(int z = 1; z <= 100; z++) {
                    int val = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
                    mp[val]++;
                }
            }
        }

        for(int i = 1; i <= n; i++)
            cout << mp[i] << '\n';
        
    }
    
    return 0;
}



Measured memory_bytes: 6012
#   2???????????????????????????????????????????????????????????°??????

#   ??????????????¢????????????????????????
#   top = 1 front = 2 right = 3 left = 4 back = 5 bottom = 6
class Dice:
    def __init__(self, nums):
        self.face = nums
    #   2->1->5->6
    def turnSouth(self):
        temp = self.face[0]
        self.face[0] = self.face[4]
        self.face[4] = self.face[5]
        self.face[5] = self.face[1]
        self.face[1] = temp
        return self
    #   4->1->3->6
    def turnEast(self):
        temp = self.face[0]
        self.face[0] = self.face[2]
        self.face[2] = self.face[5]
        self.face[5] = self.face[3]
        self.face[3] = temp
        return self
    #   3->1->4->6
    def turnWest(self):
        temp = self.face[0]
        self.face[0] = self.face[3]
        self.face[3] = self.face[5]
        self.face[5] = self.face[2]
        self.face[2] = temp
        return self
    #   5->1->2->6
    def turnNorth(self):
        temp = self.face[0]
        self.face[0] = self.face[1]
        self.face[1] = self.face[5]
        self.face[5] = self.face[4]
        self.face[4] = temp
    #   2->3->5->4
    def turnRight(self):
        temp = self.face[1]
        self.face[1] = self.face[2]
        self.face[2] = self.face[4]
        self.face[4] = self.face[3]
        self.face[3] = temp
        return self
    #   2->4->5->3
    def turnLeft(self):
        temp = self.face[1]
        self.face[1] = self.face[3]
        self.face[3] = self.face[4]
        self.face[4] = self.face[2]
        self.face[2] = temp
        return self
    def equals(self, Dice):
        #   ?????¢??????????????????????????????
        for i in range(0, 4):
            if self.face[0] == Dice.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 4):
                    if self.face[1] == Dice.face[1]:
                        if self.face == Dice.face:
                            return True
                    Dice.turnRight()
            Dice.turnNorth()
        #   ?????¢??????????????????????????????
        for i in range(0, 4):
            if self.face[0] == Dice.face[0]:
                #   ??£??¢???????????????????????¢????????????????????¢
                for j in range(0, 4):
                    if self.face[1] == Dice.face[1]:
                        if self.face == Dice.face:
                            return True
                    Dice.turnRight()
            Dice.turnEast()
        return False

#   Dice?????????
Dice1 = Dice(input().split())
Dice2 = Dice(input().split())

if Dice1.equals(Dice2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 7708
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

ll solve(int N, string &S){
	ll ans = 0;
	vector<char> X;
	char pre = '-';
	rp(i,0,N){
		char s = S[i];
		if(pre != s){
			X.push_back(s);
			pre = s;
		}
	}

	// for(auto s:X){printf("%c,",s);}puts("");//

	ans = X.size();

	return ans;
}

int main(){
	int N; string S; cin>>N>>S;
	ote(solve(N, S));
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iomanip>
#include<map>
#include<cstring>

using namespace std;

typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
int arrayMax(int a[], const int N){
    int maxv = 0;
    rep(i, N)maxv = max(a[i], maxv);
    return maxv;
}
/* -- template -- */

int main(){
    ll N, K;cin >> N >> K;
    cout << min<ll>(N % K, abs(N % K - K));
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int INF=100000000;
const int MOD=1000000007;

int main()
{
 string s;
 cin >> s;
 if(s=="Sunny") cout<< "Cloudy";
 else if(s=="Cloudy") cout<< "Rainy";
 else if(s=="Rainy") cout<< "Sunny";
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	set<int> st;
	for(int i=0; i<k; ++i){
		int t;
		cin >> t;
		while(t--){
			int x;
			cin >> x; st.insert(x);
		}
	}
	int ans = n-len(st);
	cout << ans << endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mp make_pair
ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll mon(ll n){
  //ll sum=0;
  if(n==1) return 1 ;
  else return mon(n/2) + mon(n/2) + 1 ;
}
int main(){
  ll n,sum=0;
  cin >> n;
  ll j=0;
  while(1){
    if(n==0) break;
    else{
      n=n/2 ;
      sum = sum + pow(2,j) ;
      j++;
    }

  }
  cout << sum << endl;

}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc133/tasks/abc133_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(N * A, B) << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3640
#include <stdio.h>

int gcd(int p,int q){
  int r=p%q;
  while(r>0){
    p=q;
    q=r;
    r=p%q;
  }
  return q;
}

int main(){
  int K,S=0;
  scanf("%d",&K);
  for(int a=1;a<=K;a++){
    for(int b=1;b<=a;b++){
      for(int c=1;c<=b;c++){
        if(a==b && b==c) S+=gcd(gcd(a,b),c);
        else if(a==b || b==c) S+=3*gcd(gcd(a,b),c);
        else S+=6*gcd(gcd(a,b),c);
        S%=1000000007;
      }
    }
  }
  printf("%d\n",S);
  return 0;
}

Measured memory_bytes: 1728
//TEST
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;


public class Main
{
    String a, b;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	if(a.length() == b.length()) {
	    int diff = (int)a.compareTo(b);
	    
	    if(diff == 0) {
		out("EQUAL");
	    } else if(diff > 0) {
		out("GREATER");
	    } else {
		out("LESS");
	    }
	} else {
	    if(a.length() > b.length()) out("GREATER");
	    else out("LESS");
	}
	    
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	a = sc.next();
	b = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int ans)
    {
	System.out.println(ans);
    }
    
    void out(String ans)
    {
	System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    long n, max, min, sum, val;
    cin >> n >> val;
    sum = val;
    max = val;
    min = val;
    for(int i=1; i<n; i++){
        cin >> val;
        sum += val;
        if(max < val) max = val;
        if(min > val) min = val;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3116
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	int n;
	int total = 0;

	cin >> n;

	FOR(i, 1, n) {
		total += i;
	}

	cout << total << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}





int ans = 0, N;

int n,s[9],cnt;

void make753(int a,int b){
    //s[o]s[1]...s[b] a=bの時に完成&審査
    int f7=false,f5=false,f3=false;
    int m=0;
    if(a>b){
        for(int i=0;i<=b;i++){
            m*=10;
            m+=s[i];
            if(s[i]==7)
                f7=true;
            if(s[i]==5)
                f5=true;
            if(s[i]==3)
                f3=true;
        }
    if(f7&&f5&&f3&&m<=n)
        cnt++;
        return;
    }
    //準備
    s[a]=7;
    make753(a+1,b);
    s[a]=5;
    make753(a+1,b);
    s[a]=3;
    make753(a+1,b);
}

signed main(){
    cin>>n;
    cnt=0;
    for(int i=0;i<9;i++){
        make753(0,i);//aがｓ数列の進行度　ｂがｂ＋1桁の753
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll C[100007];

map<pair<ll,ll>,pair<ll,ll>> M;

int main(){
  ll N,ma=0;
  vector<vector<ll>> Edge(100007);
  cin >> N;
  rep(i,N-1){
    ll a,b;
    cin >> a >> b;
    M[mp(a,b)]=mp(i,0);
    Edge[a].pb(b);
    Edge[b].pb(a);
  }
  queue<pair<ll,ll>> Q;
  Q.push(mp(1,0));
  C[1]=1;
  while(!Q.empty()){
    ll T=1;
    auto X = Q.front();
    Q.pop();
    rep(j,Edge[X.fr].size()){
      if(C[Edge[X.fr][j]]==0){
        if(T==X.sc){
          T++;
        }
        M[mp(X.fr,Edge[X.fr][j])].sc=T;
        C[Edge[X.fr][j]]=1;
        Q.push(mp(Edge[X.fr][j],T));
        ma = max(ma,T);
        T++;
      }
    }
  }
  cout << ma << endl;
  for(auto P : M){
    C[P.sc.fr]=P.sc.sc;
  }
  rep(i,N-1){
    cout << C[i] << endl;
  }
}


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

int main() {
    int N;
    cin >> N;
    if (N % 10 == 0) {
        cout << 10 << endl;
        return 0;
    }
    int ans = 0;
    while (N > 0) {
        ans += N % 10;
        N /= 10;
    }
    cout << ans << endl;
    return 0;
}

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

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

  if((int)floor(ceil(N/1.08)*1.08) == N) cout << (int)ceil(N/1.08)<<endl;
  else cout << ":("<<endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import static java.lang.System.out;

public class Main {
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws IOException {
        String[] s = in.readLine().split(" ");
        int N = Integer.parseInt(s[0]);
        int K = Integer.parseInt(s[1]);
        int ans = N;
        boolean[] b = new boolean[N];

        for (int i = 0; i < K; i++) {
            int d = Integer.parseInt(in.readLine());
            s = in.readLine().split(" ");
            for (int j = 0; j < d; j++) {
                int a = Integer.parseInt(s[j]) - 1;
                if (!b[a]) {
                    b[a] = true;
                    ans--;
                }
            }
        }
        
        out.println(ans);
    }
}


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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, H = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

max_a = max(A)
B.sort(reverse=True)

# is_OK(x) を x 回の攻撃で H ポイント与えられれば1, そうでなければ0を返す関数とする
# 二分探索


def is_OK(x):
    count = 0
    damage = 0
    for n in range(N):
        if B[n] > max_a and count < x:
            count += 1
            damage += B[n]
    damage += (x-count) * max_a
    if H - damage <= 0:
        return True
    else:
        return False


ng, ok = 0, 10**9+1
while ok - ng > 1:
    mid = ng + (ok - ng) // 2
    if is_OK(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 17160
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
 
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int n;cin >> n;
  string s; cin >> s;
  int ans = 1;
  int i = 1;
  while(i<s.size()){
    if(s.at(i-1) != s.at(i)) ans++;
    i++;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   long double a, b, c;
   cin >> a >> b >> c;
   if(a+b+2*pow(a*b, 0.5) -c < 0) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int A,B;
	cin >> A >> B;
	if (A == 1){
		A = 14;
	}
	if (B == 1){
		B = 14;
	}
	if (A > B){
		cout << "Alice" <<endl;
	}
	else if(A < B){
		cout << "Bob" << endl; 
	}
	else{
		cout << "Draw" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int stick[n];
    for(int i = 0;i < n;i++)
    {
        cin >> stick[i];
    }
    sort(stick,stick + n,greater<int>());
    int count = 0;
    for(int i = 0;i < n;i++)
    {
        for(int j = i + 1;j < n;j++)
        {
            for(int k = j + 1;k < n;k++)
            {
                if(stick[i] < (stick[j] + stick[k]))
                {
                    count++;
                }
                else
                {
                    break;
                }                
            }
        }
    }
    cout << count;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n;
    cin>>n;
    ll i,j;
    ll a[n];
    for(i=0;i<n;i++)cin>>a[i];
    ll sum=0;
    ll res=0;
    for(i=0;i<n;i++)
    {
        res+=(sum*a[i]%mod);
        res%=mod;
        sum+=a[i];
        sum%=mod;
    }
    cout<<res<<"\n";
}



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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 5196
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int a,b,q,w,e,r;
    scanf("%d %d", &a,&b);
    q=a*b;
    w=a+b;
    e=a-b;
    printf("%d ", max(max(e,w),q));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    char s[100];
    cin >> s;
    if(s[0] == 'Y'&&s[1] == 'A'&&s[2] == 'K'&&s[3] == 'I')cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll maxn = 1e6 + 7;
const ll mod = 1e9 + 7;
const int maxx = 1005;
ll q, t, n, m, k, ans, a[maxn], b[maxn], f[maxx][maxx];
priority_queue<ll> pr;
string s, str;
char ss[maxx][maxx];
map<ll, ll> mp;
void sol()
{
    cin >> n;
    ll mx = 1e16;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(int i = n - 1; i >= 0; i--)
    {
        for(int j = i; j >= 0; j --)
        {
            if(i == n - 1)f[i][j] = (j == 0 ? a[i] : 0);
            else
                f[i][j] = min(a[i] + f[i+1][a[i] > 100 ? j + 1 : j], j > 0 ? f[i+1][j-1] : mx);
        }
    }
    cout << f[0][0];
}
void test()
{
    long double r;
    cin >> r;
    r /= 3.0;
    cout <<fixed<<setprecision(20)<< r * r * r;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    test();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1000005;
int n,m,w[maxn],v[maxn],dp[maxn],ans;
signed main(){
	memset(dp,0x3f3f3f3f,sizeof(dp));
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	dp[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=100000;j>=v[i];j--){
			dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
			if(dp[j]<=m)ans=max(ans,j);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 11424
unittest
{
	assert( [ "15 40" ].parse.expand.solve == 10 );
	assert( [ "12 31" ].parse.expand.solve == 5 );
	assert( [ "1 1" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto md = input.front.split.to!( long[] );
	return tuple( md[ 0 ], md[ 1 ] );
}

auto solve( long m, long d )
{
	auto ans = 0L;
	for( auto mi = 1L; mi <= m; mi++ )
	{
		for( auto di = 1L; di <= d; di++ )
		{
			auto d1 = di % 10;
			auto d2 = di / 10;
			ans += ( 2 <= d1 && 2 <= d2 && d1 * d2 == mi );
		}
	}
	return ans;
}


Measured memory_bytes: 256
_,*s=$<.map{|s|s.split.map &:to_i}
101.times{|v|
  101.times{|w|
    e,f,g=s.find{|x,y,h|h>0}
    k=g+(e-v).abs+(f-w).abs
    s.all?{|x,y,h|
      h==[k-(x-v).abs-(w-y).abs,0].max
    }&&(
      $><<[v,w,k]*" "
      exit
    )
  }
}

Measured memory_bytes: 1788
#include <iostream>
#include <map>
#include <cmath>
typedef long long ll;
using namespace std;
int main() {
    int n;
    cin >> n;

    ll a[n];
    map<ll, ll> mp;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        if(mp.find(a[i])==mp.end()) mp[a[i]] = 1;
        else mp[a[i]]++;
    }

    ll cnt=0;
    for(int i=0; i<n; i++) {
        if(mp.find(a[i])!=mp.end() && mp[a[i]]!=a[i]) {
            if(mp[a[i]]>a[i]) cnt += mp[a[i]]-a[i];
            else cnt+=mp[a[i]];
            mp.erase(a[i]);
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 7040
n,k=map(int,input().split())
res=set()
ans=0
for i in range(k):
    m=int(input())
    s=list(map(int,input().split()))
    for j in range(m):
        res.add(s[j]-1)
for i in range(n):
    if i not in res:
        ans=ans+1
print(ans)

Measured memory_bytes: 9152
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  vector<int> a(3);
  cin >> a.at(0);
  cin >> a.at(1);
  cin >> a.at(2);
  sort(a.begin(),a.end());
  int n = a.at(2) - a.at(0);
  int m = a.at(2) - a.at(1);
  if(n%2 ==0 && m%2==0){//ryouhouguusuu
    cout << n/2 + m/2 << endl;
  }
  else if(n%2 ==1 && m%2==1){
    cout << (n+m)/2 << endl;
  }
  else{
    cout << n/2 + m/2 + 2 << endl;
  }
//  cout << n << endl;
//  cout << m << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modpow(ll x,ll y){
  ll ans = 1;
  while(y){
    if(y&1) ans = ans*x%mod;
    x = x*x%mod;
    y >>= 1;
  }
  return ans;
}
int main(){
  ll N,i;scanf("%lld",&N);
  ll ans = modpow(10,N)-modpow(9,N)*2+modpow(8,N);
  ans %= mod;
  if(ans < 0) ans += mod;
  printf("%lld\n",ans);
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k, s, x, y, z;
  cin >> k >> s;
  int count = 0;
  for (int x = 0; x <= k; x++){
    for (int y = 0; y <= k; y++){
     int z = s - x - y;
      if ( 0 <= z and z <= k){
          count++;
        }
      }
    }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
open Printf
open Scanf

type node = {p : int; cs : int list}

let id x = x

let rec remove e = function
    [] -> []
  | x::xs when x = e -> xs
  | x::xs -> x :: remove e xs
  
let spath tr n =
  let rec iter i ls =
    let p = tr.(i).p in
    if p = 0 then ls
    else iter p (p::ls)
  in iter n []

let count tr n =
  let rec iter i =
    let cs = tr.(i).cs in
    match cs with
      [] -> 1
    | xs -> List.fold_left (fun s j -> s + iter j) 1 xs
  in
  iter n
       
let () =
  let n = scanf "%d\n" id in
  let adj = Array.make n [] in
  let tree = Array.make n {p = -1; cs = []} in
  let rec read n =
    if n = 1 then ()
    else let i, j = scanf "%d %d\n" (fun x y -> (x-1, y-1)) in
         adj.(i) <- j :: adj.(i);
         adj.(j) <- i :: adj.(j);
         read (n-1)
  in
  let rec set_node p i =
    let cs = remove p adj.(i) in
    tree.(i) <- {p = p; cs = cs};
    List.iter (fun x -> set_node i x) cs
  in
  read n;
  set_node (-1) 0;
  let pt = spath tree (n-1) in
  let l = List.length pt in
  let w = (if l <= 1 then n-1 else List.nth pt ((l+1) / 2)) in
  let s = count tree w in
  printf "%s\n" (if s >= n - s then "Snuke" else "Fennec")


Measured memory_bytes: 22400
#include <stdio.h>

int main()
{
    int n,i=1,x;
    scanf("%d",&n);
    while(i<=n){
        if(i%3==0){
            printf(" %d",i);
        }
        else{
            if(i%10==3){
                printf(" %d",i);
            }
            else{
                x=i;
                while(x){
                    if(x%10!=3){
                    x/=10;
                    }
                    else{
                        printf(" %d",i);
                        break;
                    }
                }
            }
        }
        i++;
    }
    printf("\n");
    return 0;
}






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

int main() {
  double D,T,S;
  string ans="Yes";
  cin >> D >> T >> S;
  if(D*1.0/S>T) ans="No";
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3752
L = list(map(int, input().split()))
A = L[0]
B = L[1]
K = L[2]
count = 0
ass = 0

for i in range(100):
    i = 100 - i
    if A % i == 0 and B % i == 0:
        count += 1
    if count == K:
        ans = i
        break

print(ans)

Measured memory_bytes: 3064