akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    long long N,K;
    cin >> N >> K;
    int R,S,P;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    long long ans = 0;
    vector<char> risou(N);
    for(int i = 0;i<N;i++){
        if(T.at(i) == 'r'){
            risou.at(i) = 'p';
        }
        else if(T.at(i) == 's'){
            risou.at(i) = 'r';
        }
        else{
            risou.at(i) = 's';
        }
    }

    for(int l = 0;l<K;l++){
        if(T.at(l)== 'r'){
            ans = ans + P;
          	//cout << ans << endl;
        }
        else if(T.at(l) == 's'){
            ans = ans + R;
          	//cout << ans << endl;
        }
        else{
            ans = ans + S;
          	//cout << ans << endl;
        }
    }

    for(int j = K;j < N;j++){
        if(risou.at(j) == risou.at(j-K)){
            risou.at(j) = 'a';
            //cout << ans << endl;
            //cout << "aaa" << endl;
            continue;
        }
        if(risou.at(j) == 'r' && risou.at(j) != risou.at(j-K)){
            ans = ans + R;
          	//cout << ans << endl;
        }
        else if(risou.at(j) == 's' && risou.at(j) != risou.at(j-K)){
            ans = ans + S;
          	//cout << ans << endl;
        }
        else if(risou.at(j) == 'p' && risou.at(j) != risou.at(j-K)){
            ans = ans + P;
            //cout << ans << endl;
        }
    }
  	//for(int m = 0;m<N;m++){
    	//cout << risou.at(m);
    //}

    cout << ans << endl;
    
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n,k; cin >>n >>k;
  int a[n];
  for(int i=0; i<n; i++) cin >>a[i];
  for(int i=0; i<n-k; i++){
    if(a[i+k]>a[i]) cout <<"Yes\n";
    else cout <<"No\n";
  }
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 4420
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n=N()
l=[(j,i) for i,j in enumerate(L(),1)]
l.sort()
ans=[0]*(n*n+1)
k=1
def No():
    print("No")
    quit()
for j,i in l:
    if ans[j]!=0:
        No()
    ans[j]=i
    x=0
    while x<i-1:
        if ans[k]==0:
            ans[k]=i
            x+=1
        k+=1
    if k>j:
        No()
l.sort(reverse=True)
k=n*n
for j,i in l:
    if i==n:
        continue
    x=0
    while x<n-i:
        if ans[k]==0:
            ans[k]=i
            x+=1
        k-=1
    if k<j:
        No()
print("Yes")
print(" ".join(map(str,ans[1:])))

Measured memory_bytes: 22948
n = int(input())

if(n%100==0):
    print(1)
elif(n%101==0):
    print(1)
elif(n%102==0):
    print(1)
elif(n%103==0):
    print(1)
elif(n%104==0):
    print(1)
elif(n%105==0):
    print(1)
else:
    tmp=n//100
    mod=n%100/5
    if(mod<tmp):
        print(1)
    else:
        print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define Sort(a)   sort(a.begin(), a.end())
const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
    ll n, a, b; cin >> n >> a >> b;

    ll ans = ((n / (a + b)) * a);

    if((n % (a + b)) >= a) ans += a;
    else                   ans += (n % (a + b));

    cout << ans;
}

Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]

    current = 0
    crush = 0
    for i in range(N):
        if A[i] == current + 1:
            current += 1
        else: crush += 1
    
    if current == 0: print(-1)
    else: print(crush)
    
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 25748
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
int main()
{
	//ifstream cin("testcase.txt");
	//ofstream cout("output.txt");	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		lli n;
		cin>>n;
		lli a[n];
		for(i=0;i<n;i++)
			cin>>a[i];
		lli ans=0;
		for(i=0;i<n;i++)
			ans+=a[i];
		lli min1=100000000000001;
		lli sum1=0;
		for(i=0;i<n-1;i++)
		{
			sum1+=a[i];
			min1=min(min1,abs(ans-2*sum1));
		}
		cout<<min1<<endl;
		
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


Measured memory_bytes: 1792
#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        tank = []
        while par[x] >= 0:
            tank.append(x)
            x = par[x]
        for elt in tank:
            par[elt] = x
        return x
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


import sys
input = sys.stdin.readline

n,q = map(int,input().split())

#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

for i in range(q):
    t,u,v = map(int,input().split())
    if t == 0:
        unite(u,v)
    elif same(u,v):
        print(1)
    else:
        print(0)

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

string s,t,u; int a,b; 
void input()
{
    cin>>s>>t>>a>>b>>u;
    return;
}

void solve()
{
    if(s==u) cout<<a-1<<" "<<b<<endl;
    else if(t==u) cout<<a<<" "<<b-1<<endl;
    return;
}

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;int main(){int d,r,g,c,s,t;while(true){cin>>d>>r>>g>>c>>s>>t;if(d+r+g+c+s+t==0)break;cout<<100+95*d+63*r+7*g+2*c+3*s-3*t<<endl;}return 0;}

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

int main(){
    int x, y, ans=0;
    cin >> x >> y;

    if(y==0){
	if(x>0)
	    ans = x+1;
	else
	    ans = -x;
	
    }
    else if(x==0){
	if(y>=0)
	    ans = y;
	else
	    ans = -y+1;
    }
    else if(x>=0 && y>=0){
	if(x<=y)
	    ans = y-x;
	else
	    ans = x-y+2;
    }
    else if(x<0 && y>=0){
	ans = min(y-x, abs(y-abs(x))+1);
    }
    else if(x>=0 && y<0){
	ans = abs(abs(x)-abs(y)) + 1;
    }
    else{
	if(x <= y){
	    ans = y-x;
	}
	else
	    ans = x-y+2;
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int c[n - 1], s[n - 1], f[n - 1];
    rep(i, 0, n - 1) {
        cin >> c[i] >> s[i] >> f[i];
    }

    rep(i, 0, n - 1) {
        int time = 0;
        rep(j, i, n - 1) {
            if (time <= s[j]) {
                time = s[j] + c[j];
            } else {
                if (time % f[j] == 0) {
                    time = time + c[j];
                } else {
                    time = time + f[j] - (time % f[j]) + c[j];
                }
            }
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define debug(elem) foreach(e, elem){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
#define INF 1e+8
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;
ll MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n){
        cin >> v[i];
    }

    int cnt = 0;
    while (true){
        // 左から高さ１以上の値を見つけてくる
        int l = -1;
        for(int i = 0; i < n; ++i){
            if(v[i] != 0){
                l = i;
                break;
            }
        }

        // 全ての値が０となる
        if(l == -1){
            break;
        }

        // Leftから高さ１以上の値を見つけてくる
        int r = -1;
        for(int i = l; i < n; ++i){
            if(v[i] == 0){
                r = i - 1;
                break;
            }

            // すでにiがn-1の地点のとき、
            // 配列外の参照になるのを防ぐ
            if(i == n - 1){
                r = n- 1;
            }
        }

        // 全ての値が０となる
        if(r == -1){
            break;
        }

        // [left, right]から最小の高さを見つけてくる
        int hmin = 10000;
        for(int i = l; i <= r; ++i){
            hmin = min(hmin, v[i]);
        }

        // 最小の高さ分高さを引く
        for(int i = l; i <= r; ++i){
            v[i] -= hmin;
        }

        // 最小の値を引けたので、その分の回数を加える
        cnt += hmin;
    }

    println(cnt);
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());
            var ans = r * r * 3;

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;

int main() {
	// your code goes here
	
	int n;
	cin>>n; 
	int a[n];
	
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	auto it = max_element(a,a+n);
	int ind = it - a;
	
	int s_max=INT_MIN;
	
	for(int i=0;i<n;i++){
		if(i==ind)
			continue;
		s_max= max(s_max,a[i]);	
	}
	
	for(int i=0; i<n;i++){
		if(a[i]==a[ind])
			cout<<s_max<<endl;
		else
			cout<<a[ind]<<endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
string a, b, c;
bool ab[10000], bc[10000], ca[10000];

bool isSame(char c1, char c2){
    if(c1 == '?' || c2 == '?'){
        return true;
    }
    return c1 == c2;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> a >> b >> c;
    for(int i = -4000; i <= 4000; i++){
        ab[i+4000] = true;
        for(int j = 0; j < b.size(); j++){
            if(i+j < 0 || i+j >= a.size()) continue;
            if(!isSame(a[i+j], b[j])){
                ab[i+4000] = false;
            }
        }
    }
    for(int i = -4000; i <= 4000; i++){
        bc[i+4000] = true;
        for(int j = 0; j < c.size(); j++){
            if(i+j < 0 || i+j >= b.size()) continue;
            if(!isSame(b[i+j], c[j])){
                bc[i+4000] = false;
            }
        }
    }
    for(int i = -4000; i <= 4000; i++){
        ca[i+4000] = true;
        for(int j = 0; j < a.size(); j++){
            if(i+j < 0 || i+j >= c.size()) continue;
            if(!isSame(c[i+j], a[j])){
                ca[i+4000] = false;
            }
        }
    }
    int ans = 10000;
    // b
    for(int i = -4000; i <= 4000; i++){
        // c
        for(int j = -4000; j <= 4000; j++){
            // c-b
            int d = j-i;
            if(abs(d) > 4000) continue;
            if(ab[i+4000] && bc[d+4000] && ca[-j+4000]) {
                int r = max({(int)a.size(), i+(int)b.size(), j+(int)c.size()});
                int l = min({0, i, j});
                // if(abs(r-l) <= 10){
                //     cout << i << ' ' << j << ' ' << r-l << endl;
                // }
                ans = min(ans, r-l); 
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
    int x,n,m,l,k,o;
    l=100 , o=100;
    cin >> x >> n;
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin >> A.at(i);
    }
    if(n==0){
        cout << x << endl;
    }
    else{
    for(int i=0;i<102;i++){
        int t=1;
        for(int j=0;j<n;j++){
            if(x+i==A.at(j)){
                t=0;
                break;
            }
            else{
                t=1;
            }
        }
        if(t==0){
            continue;
        }
        else{
            m=x+i;
            l=i;
            break;
        }

    }
    for(int i=0;i<102;i++){
        int t=1;
        for(int j=0;j<n;j++){
            if(x-i==A.at(j)){
                t=0;
                break;
            }
            else{
                t=1;
            }
        }
        if(t==0){
            continue;
        }
        else{
            k=x-i;
            o=i;
            break;
        }

    }
    if(o<l){
        cout << k << endl;
    }
    else if(o>l){
        cout << m << endl;
    }
    else if(o==l){
        cout << k << endl;
    }
    }
}

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	ll tmp;
	ll a[2];
	cin >> a[0] >> a[1];
	a[1]++;
	ll x[2];
	REP(i,40){
		REP(j, 2){
			ll sh = a[j] / ((ll)1 << (i+1));
			ll mo = a[j] % ((ll)1 << (i+1));
			x[j] = sh * ((ll)1 << (i));
			x[j] %= 2;
			tmp = max((ll)0, mo - ((ll)1 << (i)));
			x[j] += tmp;
			x[j] %= 2;
			//cout << a[j] << " " << x[j] << " " << sh << " " << mo << endl;
		}
		ans += (x[0] ^ x[1]) * ((ll)1 << (i)); 
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

const int MAX = 100001;

int main() {
	init();

	int N; cin >> N;
	vector<pair<int, int>>lr(N);
	rep(i, N) {
		int a, b; cin >> a >> b;
		lr[i] = make_pair(a, b);
	}
	int ans = 0;
	int is[MAX];
	fill(is, is + MAX, 1);
	is[0] = 0;
	is[1] = 0;
	vector<int>prime;
	REP(i, 2, MAX) {
		if (is[i]) {
			if (i != 2)prime.push_back(i);
			int n = i + i;
			while (n < MAX ) {
				is[n] = 0;
				n += i;
			}
		}
	}
	rep(i, N) {
		int l = lr[i].first, r = lr[i].second;
		int cnt = 0;
		for (int j = 0;j < prime.size();++j) {
			if (l <= prime[j] && prime[j] <= r) {
				if (is[(prime[j] + 1) / 2])++cnt;
			}
		}
		cout << cnt << "\n";
	}

	return 0;
}

Measured memory_bytes: 1920
module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  n1 <- readLn
  bs <- group . sort <$> replicateM n1 getLine
  n2 <- readLn
  as <- replicateM n2 getLine

  print $ max 0 $ (maximum . map (f as)) bs
  where
    f as bs = let b = head bs in length bs - (length . filter (== b)) as

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
int n;long W;
long w[100];
long long v[100];
long long dp[100][100000];
long long call(int i,long s)
{
	if(i==n||s==0)
	return 0;
	
	if(dp[i][s]!=-1)
	return dp[i][s];
	if(w[i]<=s)
	return dp[i][s]=max(call(i+1,s),call(i+1,s-w[i])+v[i]);
	else
	return dp[i][s]=call(i+1,s);
}
int main() {
	// your code goes here
	cin>>n>>W;
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++)
	cin>>w[i]>>v[i];
	cout<<call(0,W)<<endl;
	return 0;
}

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

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

    int n, k;
    cin >> n >> k;
    
    int cost = 0;
    REP(i, n){
        int x;
        cin >> x;
        cost += min(x, k - x) * 2;
    }

    cout << cost << endl;

    return 0;
}

Measured memory_bytes: 256
import math

n, d = list(map(int, input().split(' ')))
x = []
ans = 0

for _ in range(n):
    vec = list(map(int, input().split(' ')))
    x.append(vec)
    for i in range(len(x) - 1):
        s = 0
        for j in range(d):
            s += (x[i][j] - x[len(x) - 1][j]) * (x[i][j] - x[len(x) - 1][j])
        if math.sqrt(s).is_integer():
            ans += 1

print(ans)

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

int n,h;
int v[105],w[105];
int d[105][10005];

int main(){
	
	cin >> n >> h;
	for(int i = 0; i < n; i++) cin >> v[i] >> w[i];
	
	for(int i = 0; i < n; i++){
		for (int j = 0; j <= h; j++){
			if		(j <  w[i]) d[i+1][j] = d[i][j];
			else if (j >= w[i]) d[i+1][j] = max(d[i+1][j - w[i]] + v[i],d[i][j]); 
		}
	}
	
	int ans = d[n][h];
	cout << ans << endl;
}


Measured memory_bytes: 6984
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
cap = [read_int()[0] for _ in range(5)]

def solve():
    b_neck = cap[0]
    for i in range(5):
        if b_neck > cap[i]:
            b_neck = cap[i]
    in_neck = -(- N // b_neck)
    ans = 4 + in_neck
    return ans

if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 3816
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    double l;
    cin>>l;
    floatOutPutSetup();
    cout<<pow(l/3,3);

    return 0;
}

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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.141592653589793238462643383279;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    double R; cin >> R;
    cout << fixed << setprecision(10) <<  2*PI*R << endl;
    return 0;
}

Measured memory_bytes: 3784
#include<stdio.h>

int main(){
    int i,j,k;
    
    scanf("%d%d",&i,&j);
    while(1){
        k = i%j;
        i = j;
        j = k;
        if(j == 0) break;
    }
    printf("%d\n",i);
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;

		double x = 0;
		double y = 0;
		double ang = 90;
		while (true) {
			String line = reader.readLine();
			if (line.equals("0,0"))
				break;
			tokenizer = new StringTokenizer(line, ",");
			double d = Double.parseDouble(tokenizer.nextToken());
			double red = Math.toRadians(ang);
			x += d * Math.cos(red);
			y += d * Math.sin(red);
			ang -= Double.parseDouble(tokenizer.nextToken()) ;

		}
		System.out.println((int) x);
		System.out.println((int) y);
	}

}

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

int main() {
  int current_rate, target_rate, necessary_rate;
  
  // 標準入力から、現在のレーティングと目標とするレーティングを取得する
  cin >> current_rate >> target_rate;
  
  if ( 0 <= current_rate && current_rate <= 4500) {
    if ( 0 <= target_rate && target_rate <= 4500 ) {
      // 取得すべきレーティングを求める
      necessary_rate = 2 * target_rate - current_rate;
      cout << necessary_rate << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N; cin >> N;
    string c; cin >> c;
    
    int cnt = 0;
    REP(i, N) if(c[i] == 'R') cnt++;
    int ans = 0;
    REP(i, cnt) if(c[i] == 'W') ans++;
    Out(ans);

    return 0;
}


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

int main() {
  int i,j,N;
  int judge = 1;
  cin >> N;
  vector<int> vec(N);
    for (i = 0; i < N; i++) {
  	cin >> vec.at(i);
  }
	sort(vec.begin(),vec.end());      
  for(j=0; j<N-1; j++){
  	if(vec.at(j) == vec.at(j+1)){
      judge--;
      break;
    }
  }
  if(judge){
  	cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int x,n,p[110];
int main(){
	scanf("%d%d",&x,&n);memset(p,1,sizeof p);
	for(int i=1,x;i<=n;i++)scanf("%d",&x),p[x]=0;
	int mn=1e9,mp=0;
	for(int i=0;i<=101;i++)if(p[i]&& abs(i-x)<mn)mn=abs(i-x),mp=i;
	printf("%d\n",mp);
	return 0;
}

Measured memory_bytes: 3828
#include<iostream>
#include<cmath>
#include<string>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int x[n];
    for(int i=0; i<n; i++)
        cin>>x[i];
    int mini = 3*100000000;
    int cur;
    for(int i=0; i<n-k+1; i++)
    {
        cur=abs(x[i+k-1]- x[i])+ min(abs(x[i+k-1]), abs(x[i]));
        if(cur<mini) mini=cur;
    }
    cout<<mini<<endl;
	return 0;
}


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

int n;

int main() {
	scanf("%d", &n);
	int QAQ = 1;
	for (; QAQ < n; QAQ <<= 1);
	if (QAQ == n) return puts("No"), 0;
	printf("Yes\n%d %d\n", n + 1, n + 3);
	for (int i = 2; i < n; i += 2) printf("%d %d\n%d %d\n%d %d\n%d %d\n", 1, i, 1, i + 1, i, n + i + 1, n + i, i + 1);
	if (n % 2 == 0) {
		for (int i = 2; i <= n; ++i) {
			int j = n ^ i ^ 1;
			if (j < n && j > 1) return printf("%d %d\n%d %d\n", i, n, j, n + n), 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3848
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			if 500*i+100*j+50*k==x:
				cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int cntg = 0, cntp = 0;
    rep (i, 0, n) {
        if (s[i] == 'g') cntg++;
        else
            cntp++;
    }
    cout << max (0, (cntg - cntp) / 2) << "\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll k, x;
  cin >> k >> x;
  for (ll i = x - k + 1; i <= x + k - 1;i++){
    cout << i << " ";
  }
  cout << endl;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll A, B; cin >> A >> B;
if(A*500>=B) cout << "Yes";
else cout << "No";
}

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

using P = pair<int, int>;
const int M = 1000000007;
int dd[5] = { 0, 1, 0, -1, 0 };

int main() {
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }
    int q;
    cin >> q;
    vector<int> a(n);
    for (int i = 0; i < q; ++i) {
        int t, x, d;
        cin >> t >> x >> d;
        --x;
        if (t == 1) {
            a[x] += d;
            if (a[x] > c[x]) {
                cout << x + 1 << "\n";
                return 0;
            }
        }
        if (t == 2) {
            a[x] -= d;
            if (a[x] < 0) {
                cout << x + 1 << "\n";
                return 0;
            }
        }
    }
    cout << "0\n";
    return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define ll long long int
#define fl(i,x,y) for( int i=x;i<y;i++)
#define w(t) while(t--)
#define vi vector<ll>
#define vvi vector< vi >
#define si set<ll>
#define msi multiset<ll>
#define si_d set<ll, greater<ll> >
#define mii map<ll,ll>
#define pb push_back
#define msi_it  multiset<ll> :: iterator
#define si_it set<ll> :: iterator
#define sort1(v) sort(v.begin(),v.end());
#define F first
#define S second
using namespace std;
#define N 1000000007
#define mod 15000000000031
int isPalindrome(string str) 
{ 
    int l = 0; 
    int h = str.length() - 1; 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return 0; 
        } 
    } 
    return 1;
} 
int main()
{
	string s;
	cin>>s;
	int l=s.length();
	int y=l/2;
	string ss="",st="";
	fl(i,0,y) ss+=s[i];
	fl(i,y+1,l) st+=s[i];
//	cout<<ss<<" "<<st<<endl;
	int k=isPalindrome(ss);
	int z=isPalindrome(st);
	int g=isPalindrome(s);
	if(k==1 && z==1 && g==1) cout<<"Yes";
	else cout<<"No";
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    ll n, m; cin >> n >> m;

    vector<ll> a(n);
    vector<ll> b(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }

    vector<ll> c(m);
    vector<ll> d(m);
    for (ll i = 0; i < m; ++i) {
        cin >> c[i] >> d[i];
    }

    for (ll i = 0; i < n; ++i) {
        pair<ll, ll> point = make_pair(0, 1LL<< 60);

        for (ll j = 0; j < m; ++j) {
            ll m = abs(c[j] - a[i]) + abs(d[j] - b[i]);

            if (m < point.second) {
                point.first = j;
                point.second = m;
            }
        }

        cout << point.first + 1 << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll a[100010];
ll b[100010];
ll n;

ll bs(ll x){
	ll l=0,r=n;
	while(r-l>1){
		ll m=(l+r)/2;
		if(b[m]<=x)l=m;
		else r=m;
	}
	return l;
}

int main(){
	scanf("%d",&n);
	rep(i,0,n)scanf("%lld",a+i);
	rep(i,0,n)b[i]=a[i];
	sortup(b,n);
	
	ll ans=0;
	rep(i,0,n)if(i%2!=bs(a[i])%2)ans++;
	printf("%lld\n",ans/2);
	return 0;
}

Measured memory_bytes: 2556
n=int(input())
a=list(map(int,input().split()))
for aa in a:
  if aa==0:
    print(0)
    exit(0)

t=1
for i in range(n):
  if i==0:
    t=a[0]
    if t>10**18:
      print(-1)
      exit(0)
    continue
  t*=a[i]
  if t>10**18:
    print(-1)
    exit(0)
print(t)


Measured memory_bytes: 21652
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <map>
#include <numeric>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs ( llong n ) { return ( n < 0 ) ? -n : n; }
    boolean isMovable ( int x, int y, int w, int h ) { 
        return ( x >= 0 && y >= 0 && x < w && y < h ); }
}

#define int long long

namespace Rlyeh {

    int N, W;
    int w[110], v[110];
    int dp[110][100100];

    signed call_of_Cthulhu( signed datum ) {
        
        read N >> W;
        for ( int i = 0; i < N; i++ ) {
            read w[i] >> v[i];
        }
        for ( int i = 0; i < 110; i++ ) {
            for ( int j = 0; j < 100100; j++ ) {
                dp[i][j] = INF;
            }
        }
        dp[0][0] = 0;
        for ( int i = 0; i < N; i++ ) {
            for ( int j = 0; j < 100100; j++ ) {
                if ( j < v[i] ) {
                    dp[i+1][j] = dp[i][j];
                }
                else {
                    dp[i+1][j] = std::min(dp[i][j],
                            dp[i][j-v[i]] + w[i]);
                }
            }
        }
        int res = 0;
        for ( int i = 0; i < 100100; i++ ) {
            if ( dp[N][i] <= W ) res = i;
        }

        echo res fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    vec<ll> P(N);
    bool allminus = true;
    for(int i=0;i<N;i++){
        cin >> P[i];
        allminus &= P[i]<0;
    }
    if(K==N){
        mint ans = 1;
        for(int i=0;i<K;i++) ans *= P[i];
        cout << ans << "\n";
        return 0;
    }
    if(allminus && K%2==1){
        sort(P.begin(),P.end(),[](ll a,ll b){return abs(a)<abs(b);});
        mint ans = 1;
        for(int i=0;i<K;i++) ans *= P[i];
        cout << ans << "\n";
        return 0;
    }

    sort(P.begin(),P.end(),[](ll a,ll b){return abs(a)>abs(b);});
    mint ans = 1;
    if(P[K-1]==0){
        cout << 0 << "\n";
        return 0;
    }
    vec<ll> plus,minus;
    for(int i=0;i<K;i++){
        ans *= P[i];
        if(P[i]>0) plus.push_back(P[i]);
        else if(P[i]<0) minus.push_back(P[i]);
    }
    if(minus.size()%2==0){
        cout << ans << "\n";
        return 0;
    }
    ll p = -1,m = 1;
    for(int i=K;i<N;i++){
        if(p<0 && P[i]>=0) p = P[i];
        if(m>0 && P[i]<0) m = P[i];
    }
    if(m>0 || plus.empty()){
        ans /= minus.back();
        ans *= p;
        cout << ans << "\n";
    }else if(p<0 || minus.empty()){
        ans /= plus.back();
        ans *= m;
        cout << ans << "\n";
    }else{
        if(abs(p*plus.back())<abs(m*minus.back())){
            ans /= plus.back();
            ans *= m;
        }else{
            ans /= minus.back();
            ans *= p;
        }
        cout << ans << "\n";
    }
}


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

#ifdef DEBUG
#define NDEBUG
#endif
#undef NDEBUG
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))


inline int gcd(int m, int n){
  while(m) swap(m, n%=m);
  return n;
}

void solve(ll N){
  vector<pair<ii,ii>> m;
  // ii -> ii
  rep1(a, 3500) rep1(b, 3500) {
    int x=a+b, y=a*b, g=gcd(x,y);
    x /= g; y /= g;

    // 4/N - x/y = (4y - Nx) / Ny
    ll c = y*4 - N*x;
    if (c <= 0) continue;
    ll d = N*y;
    if (d % c) continue;
    d /= c;
    printf("%d %d %lld\n", a, b, d);
    return;
  }
}

int main(){
  ll N; cin >> N;
  solve(N);
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
using namespace std;
int a[5010];
int main(){
	int i,n,max_so_far,max_ending_here,amax;//maximum subarray problem
	cin>>n;
	while(n!=0){

		for(i=0;i<n;i++){
			cin>>a[i];
		}

		max_ending_here=0;
		max_so_far=0;
		amax=-100000;

		for(i=0;i<n;i++){
			max_ending_here = max(0,max_ending_here + a[i]);
			max_so_far = max(max_so_far,max_ending_here);
			amax = max(amax,a[i]);
		}

	if(amax < 0){cout << amax <<endl;}
	else{cout << max_so_far << endl;}
	cin>>n;//kousinn
	}
}

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

void erase(string &S, char &ans, char &next) {
    if (S.empty()) {
        ans = toupper(next);
    } else {
        next = S.at(0);
        S.erase(0, 1);
    }
}

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    char ans;
    char next = 'a'; 
    rep(i,300) {
        if (next == 'a') erase(A, ans, next);
        else if (next == 'b') erase(B, ans, next);
        else if (next == 'c') erase(C, ans, next);
    }
    cout << ans << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, char>> sc(m);
    for(auto& e : sc){
        cin >> e.first >> e.second;
        e.first--;
    }
    int res = -1;
    string current;
    for(int i = 0; i < 1000; i++){
        current = to_string(i);
        if(current.size() != n) continue;
        int j = 0;
        res = i;
        for(j = 0; j < m; j++){
            if(current[sc[j].first] != sc[j].second){
                res = -1;
                break;
            }
        }
        if(res != -1){
            break;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL; 
int N;
int main(){
	scanf("%d",&N);
	for(LL i = 1;i;i++){
		LL x = (i+1)*i>>1;
		if(x >= N){
			printf("%lld\n",i);
			break;
		}
	}
	return 0;
} 

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// input
		String s = sc.next();
		String t = sc.next();
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		String u = sc.next();
		// output
		if(s.equals(u)) {
			System.out.println((a-1) + " " + b);
		}else {
			System.out.println(a + " " + (b-1));
		}	
	}
}

Measured memory_bytes: 21844
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
s = [0 for _ in range(N+1)]

for i in range(N):
    s[i+1] += s[i] + A[i]

dic = defaultdict(int)

for i in range(N+1):
    dic[s[i]] += 1

ans = 0
for k in dic.keys():
    ans += dic[k]*(dic[k]-1)//2

print(ans)

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

typedef pair<int, int> P;

int V; // the number of node

int prim (vector<vector<P> > G) {
    set<int> used;
    priority_queue<P, vector<P>, greater<P> > que;
    for (int i = 0; i < V; i++) {
        used.insert(i);
    }
    int res = 0;
    int v = 0;
    while (!used.empty()) {
        for (auto i : G[v])   que.push(i);
        P p;
        while (used.find(que.top().second) == used.end() || que.top().second == v) {
            que.pop();
            if (que.empty()) break;
        }
        if (que.empty()) break;
        used.erase(used.find(v));
        p = que.top(); que.pop();
        v = p.second;
        res += p.first;
    }
 
    return res;
}

int main(void){
    for(; cin >> V, V;){
        int m; cin >> m;
        vector<vector<P>> p(V);
        rep(loop, m){
            int a, b, d; char c;
            cin >> a >> c >> b >> c >> d;

            p[a].push_back(P(d, b));
            p[b].push_back(P(d, a));
        }

        cout << prim(p) / 100 - (V - 1) << endl;
    }

    return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; i++) {
        for(int j = i; j <= N; j+=i) {
            ans+=j;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,x;
  cin>>a>>b>>x;
  if(a==0)
    cout<<b/x+1;
  else
     cout<<b/x+1-(a-1)/x-1<<endl;
}




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

int main(){
  int N,M,i,j,ans=-1,num1,num2;
  cin >> N >> M;
  vector<pair<int,char>> sc(M);
  for(i=0;i<M;++i){
    cin >> sc.at(i).first >> sc.at(i).second;
  }
  if(N==1){
    num1 = 0;
    num2 = 10;
  }else if(N==2){
    num1 = 10;
    num2 = 100;
  }else{
    num1 = 100;
    num2 = 1000;
  }
  for(i=num1;i<num2;++i){
    string s = to_string(i);
    bool b = true;
    for(j=0;j<M;++j){
      if(s.at(sc.at(j).first-1)!=sc.at(j).second){
        b = false;
        break;
      }
    }
    if(b){
      ans = i;
      break;
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
console.log((args=>{
  const [N,...s] = args.trim().split`\n`.map(v=>v|0);
  const dp = Array.from({length:N+1},_=>Array(10).fill(-Infinity));
  dp[0][0] = 0;
  for ( let i = 0; i < N; i++ ) {
    for ( let j = 0; j < 10; j++ ) {
      const d = (j+s[i]) % 10;
      dp[i+1][d] = Math.max( dp[i][d], dp[i][j] + s[i] );
    }
  }
  dp[N][0] = 0;
  return `${Math.max(...dp[N])}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 29696
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long sum = 0;
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      sum += a - 1;
    }
    System.out.println(sum);
  }
}


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

int main(){
    string s;
    cin >> s;
    int res = 0;
    rep(i, s.size()){
        int l = 0;
        rep(j, s.size() - i){
            if(s[i+j] == 'A' || s[i+j] == 'T' || s[i+j] == 'C' || s[i+j] == 'G'){
                ++l;
            }else{
                break;
            }
        }
        res = max(res, l);
    }
    cout << res << endl;
}


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

int main() {
  long long a, b, n; cin >> a >> b >> n;
  if(n < b){
    cout << (a*n)/b - a*(n/b);
    return 0;
  }
  cout << (a*(b-1))/b - a*((b-1)/b) << endl;
}

Measured memory_bytes: 3632