akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
    
    int n;
    
    double sum=0,sum1=0;
    double ave,m;
    
    for(int i=0;;i++){
        sum=sum1=0;
        scanf("%d",&n);
        if(n==0){
            break;
        }else{
            int a[1000]={};
            for(int j=0;j<n;j++){
                scanf("%lf",&m);
                a[j]=m;
                sum+=m;
            }
            ave = sum/n;
            for(int j=0;j<n;j++){
                sum1+=(a[j]-ave)*(a[j]-ave);
            }
            printf("%.8lf\n",sqrtf(sum1/n));
            }
        
    }
    
    return 0;
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string NO = "IMPOSSIBLE";

int main(){
    int a, b;
    cin >> a >> b;
    int k = (a + b) / 2;
    if (abs(a - k) == abs(b - k)) cout << k << endl;
    else cout << NO << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    string ans="";
    if(a<b){
        for(int i=0;i<b;i++){
            ans+=a+'0';
        }
    }else{
        for(int i=0;i<a;i++){
            ans+=b+'0';
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s=input()
d=[0]*n
c=0
for i in range(n-1):
  if s[i:i+2]=="AC":
    c+=1
  d[i+1]=c
for i in range(q):
  l,r= map(int, input().split())
  print(d[r-1]-d[l-1])

Measured memory_bytes: 6060
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


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

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define REP(i,N) for(int i=0;i<N;i++)

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

int main(){
    int n; cin>>n;
    vector<unsigned int> a(n);
    REP(i,n){ cin>>a[i]; }
    vector<unsigned int> f(n);
    vector<unsigned int> l(n);
    f[0] = a[0];
    l[n-1] = a[n-1];
    for(int i=1;i<n;i++){
        f[i] = gcd(f[i-1],a[i]);
    }
    for(int i=n-2;i>=0;i--){
        l[i] = gcd(l[i+1],a[i]);
    }
    
    int ans = max(l[1],f[n-2]);
    for(int i=1;i<n-1;i++){
        int b = gcd(f[i-1],l[i+1]);
        if(ans<b){
            ans=b;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
import sys
def input():
    return sys.stdin.readline()[:-1]
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
from itertools import product
l=tuple(product([0,1], repeat=(H-1)))
a=2000
for i in l:
    t=sum(i)
    p=t
    w=[0]*(t+1)
    c=0
    x=[0]*W
    while c<W:
        it=0
        for k in range(H):
            if S[k][c]=="1":
                w[it]+=1
            if k!=H-1 and i[k]:
                it+=1
        for j in w:
            if j>K:
                w=[0]*(t+1)
                p+=1
                x[c]+=1
                break
        else:
            c+=1
            continue
        if x[c]==2:
            break
    else:
        if p<a:
            a=p
print(a)

Measured memory_bytes: 45404
N = int(input())
v = list(map(int, input().split(' ')))
v.sort()
item1 = v.pop(0)
while v:
  item2 = v.pop(0)
  v.append((item1 + item2) / 2)
  v.sort()
  item1 = v.pop(0)
print(item1)

Measured memory_bytes: 3060
n,m=map(int,input().split())
L=[]
for i in range(n):
   l = list(map(int,input().split()))
   L.append(l)
L.sort()

h=0
s=0
t=0
for i in range(n):
    h += L[i][1]
    if h >= m:
        t=h-m
        s=i
        break
r=0
for j in range(s+1):
    r += L[j][0]*L[j][1]
r -= t*L[s][0]
   
print(r)

Measured memory_bytes: 27756
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long  n,cnt=0;
    cin>>n;
    long long a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        c[i]=0;
    }
    for(int i=n-1;i>=0;i--)
    {
        if(b[i]==1 || (a[i]+cnt)%b[i]==0)
            continue;
        long long  x=b[i]-(a[i]+cnt)%b[i];
       // cout<<x<<endl;
        cnt+=x;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<math.h>
#include <string.h>



int main() {
	int i, j, k, l = 0;
	int m, g, n, q;
	int f = 0;
	int point[110000] = { 0 };
	int a;

	scanf("%d %d %d", &n, &k, &q);


	for (i = 0;i < q;i++) {
		scanf("%d", &a);
		point[a - 1] = point[a - 1] + 1;
	}

	for (i = 0;i < n;i++) {
		if (point[i] + k - q > 0) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}




//	printf("%d", f);

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
 
int main() {
	using namespace std;
    string str;
    cin >> str;
    int length = str.size();
    int n = 0, max_n = 0;
    for (int i = 0; i < length; i++) {
    	if (str [i] == 'T') n++;
    	else n--;
    	if (n > max_n) max_n = n;
    }
    cout << 2 * max_n << endl;
    return 0;
}

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

int main() 
{ 
	bool p[4][4];
	memset(p,false,sizeof(p));
	int a[4][4];
	memset(a,false,sizeof(a));
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>a[i][j];
		}
	}
	int temp,n;
	cin>>n;
	for(int i=0;i<n;i++){
		//int temp;
		cin>>temp;
		for(int j=1;j<=3;j++){
			for(int k=1;k<=3;k++){
				if(a[j][k] == temp){
					p[j][k] = true;
					break;
				}
			}
		}
	}
	bool ok =false;
	for(int i=1;i<=3;i++){
		if(p[i][1] == true && p[i][2]==true && p[i][3] == true){
			ok = true;
		}
	}
	if(ok){
		cout<<"Yes";
		return 0;
	}
	else{
		for(int i=1;i<=3;i++){
			if(p[1][i] == true && p[2][i]==true && p[3][i] == true){
				ok = true;
			}
		}
	}
	if(ok){
		cout<<"Yes";
		return 0;
	}
	else{
		if(p[1][1] == true && p[2][2]==true && p[3][3] == true){
			ok = true;
		}
		else{
			if(p[1][3] == true && p[2][2]==true && p[3][1] == true){
				ok = true;
			}
		}
		if(ok){
			cout<<"Yes";
		}
		else{
			cout<<"No";
		}
		
	}
	
	
	return 0; 
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
using namespace std;
const int SZ=1<<19,N=1e5+9,M=2*N;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
    G;while(*ip<'-')G;
    R x=*ip&15;G;
    while(*ip>'-'){x*=10;x+=*ip&15;G;}
    return x;
}
int he[N],ne[M],to[M],f[N],a[N],b[N];
int Getf(R x){
    return x==f[x]?x:f[x]=Getf(f[x]);
}
void Dfs(R x,R op){
    a[x]=op;
    for(R y,i=he[x];i;i=ne[i])
        if((y=to[i])!=f[x])
            f[y]=x,Dfs(y,-op),a[x]+=a[y];
}
int main(){
    R n=in(),m=in(),rt=1,re=1,p=0,ans=0;
    for(R i=1;i<=n;++i)f[i]=i;
    for(R p=0,i=1;i<=m;++i){
        R x=in(),y=in();
        if(Getf(x)!=Getf(y))f[f[x]]=f[y];
        else{rt=x,re=y;continue;}
        ne[++p]=he[x];to[he[x]=p]=y;
        ne[++p]=he[y];to[he[y]=p]=x;
    }
    f[rt]=0;Dfs(rt,1);
    if(n==m)
    {

    p=0;
        for(R i=re;i;i=f[i]) b[++p]=a[i];
        if(p&1)
        {
            if(a[rt]&1)return puts("-1"),0;
            for(R x=re;x;x=f[x])a[x]-=a[rt]>>1;
        }
        else
        {
            if(a[rt])return puts("-1"),0;
            sort(b+1,b+p+1);
            for(R x=re;x;x=f[x])a[x]-=b[p>>1];
        }
    }
    else if(a[rt])return puts("-1"),0;
    for(R i=1;i<=n;++i)ans+=abs(a[i]);
    return cout<<ans<<endl,0;
}

Measured memory_bytes: 14992
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  vector<int> ans(s.size(),0);
  int o,e = 0;
  int memo = 0;
  rep(i,s.size()) {
    if(i%2==0) e++;
    else o++;
    if(s[i] == 'R'&& s[i+1] == 'L') memo = i;
    else if(s[i] == 'L' && s[i+1] == 'R') {
      if(memo % 2 == 0) {
        ans[memo] = e;
        ans[memo+1] = o;
      }else {
        ans[memo] = o;
        ans[memo+1] = e;
      }
      o = 0;e = 0;
    }
  }
  if(memo % 2 == 0) {
    ans[memo] = e;
    ans[memo+1] = o;
  }else {
    ans[memo] = o;
    ans[memo+1] = e;
  }
  rep(i,s.size()) {
    if(i != s.size()-1) cout << ans[i] << ' ';
    else cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int width,length,interval,sum=1;
	scanf("%d%d%d",&width,&length,&interval);
	width=width-interval;
	while(width>=0)
	{
		
		if(width>=length+interval)	
		{width=width-length;
	
		sum++;}
		width=width-interval;

	}
	printf("%d\n",sum-1);
	return 0;
}

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

int solve(int n, int m, int p) {
    int a[n];
    int ret = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ret += 100*a[i];
    }
    if (a[m-1]) ret = ret * (100-p)/100 / a[m-1];
    else ret = 0;
    return ret;
}

int main(void){
    int n, m, p;
    vector<int> ans;
    while (1) {
        cin >> n >> m >> p;
        if (!n && !m && !p) break;
        ans.push_back(solve(n, m, p));
    }
    for (auto &i: ans) {
        cout << i << endl;
    }
}



Measured memory_bytes: 3156
def circle_in_rectangle(radius, pos, height, width):
    """
    radius: int
    pos: tuple, (x, y)
    height: int, height of rectangle
    width: int, width of rectangle

    returns True if circle is in rectangle, otherwise False

    >>> circle_in_rectangle(1, (1, 1), 4, 5)
    True
    >>> circle_in_rectangle(1, (2, 4), 4, 5)
    False
    """
    (x, y) = pos
    if x < radius or x > width - radius:
        return False

    if y < radius or y > height - radius:
        return False

    return True

if __name__ == '__main__':
    #import doctest
    #doctest.testmod()

    (w, h, x, y, r) = input().split(' ')

    if circle_in_rectangle(int(r), (int(x), int(y)), int(h), int(w)):
        print('Yes')
    else:
        print('No')

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


using namespace std;

int main(){
    long long n, tmp, ans=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> tmp;
        ans = ans^tmp;
    }
    if(ans==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
//http://wk1080id.hatenablog.com/entry/2018/01/14/021319
#include<vector>
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    long N,K;
    cin>>N>>K;
    vector<long> vec(N);
    for(auto &x:vec){
        cin>>x;

    }
    long gc=vec[0];
    for(int i=1;i<N;++i){
        gc=__gcd(gc,vec[i]);
    }

    long ma=*max_element(vec.begin(),vec.end());

    if(K>ma||K<gc||K%gc!=0){
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }


    cout<<"POSSIBLE"<<endl;



}

Measured memory_bytes: 1024
from collections import deque, defaultdict
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
edges = [[]for _ in range(n)]
dd = defaultdict(int)
for _ in range(m):
    x, y = list(map(lambda x: int(x)-1, input().split()))
    edges[x].append(y)
    dd[y] += 1

queue = deque([])
for i in range(n):
    if dd[i] == 0:
        queue.append(i)

toposorted = []
while queue:
    v = queue.popleft()
    toposorted.append(v)
    for v2 in edges[v]:
        if dd[v2] <= 0:
            continue
        dd[v2] -= 1
        if dd[v2] == 0:
            queue.append(v2)

dist = [0]*n
for i in range(n):
    v = toposorted[i]
    for v2 in edges[v]:
        if dist[v2] <= dist[v]-1:
            continue
        dist[v2] = dist[v]-1
print(-min(dist))


Measured memory_bytes: 76448
import java.util.Scanner;


public class Main {
    static Scanner s = new Scanner(System.in);

    public static void main(String[] args) {
        int count=0;
        int N = s.nextInt();

        while (true) {
            int rest = N / 3;
            int right = N / 3;
            int left = N / 3;

            if (N % 3 == 1) {
                rest += 1;
            } else if (N % 3 == 2) {
                right += 1;
                left += 1;
            }

            N = Math.max(right, left);
            N = Math.max(N, rest);
            count++;

            if(N==1) break;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 17348
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, d = 0;
char s[105];

int main(){
	getint(N), scanf("%s", s + 1);
	for(register int i = 1; i <= N; i++) if(s[i] == 'R') d++; else d--;
	return puts(d > 0 ? "Yes" : "No"), 0;
}


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

using namespace std;

typedef long long LL;

const int INF=0x3f3f3f3f;

int main(){
	string A,B,C;
	int a,b;
	cin>>A>>B>>a>>b>>C;
	if(A==C)a--;
	else b--;
	printf("%d %d\n",a,b);
	return 0;
}

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

using namespace std;

int mod;

void add(int &x, int y) {
    x += y;
    if (x >= mod) {
        x -= mod;
    }
}

int main() {
    int n;
    cin >> n >> mod;
    vector<vector<int>> dp(n, vector<int>(n - 1, 0));
    vector<int> f(n, 0);
    for (int i = 0; i < n; ++i) {
        dp[i][0] = 1;
        f[i] = 1;
    }
    for (int j = 1; j < n - 1; ++j) {
        for (int k = min(j + 1, n - j), i = k; i < n; ++i) {
            dp[i][j] = (dp[i][j] + mod + f[i - k]) % mod;
            f[i] = (f[i] + dp[i][j]) % mod;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans = (ans + (1ll * f[i] * (n - i)) % mod) % mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 98048
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a*a+b*b==c*c) cout<<a*b/2;
    else if(a*a+c*c==b*b) cout<<a*c/2;
    else cout<<b*c/2;
}


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

int main(void)
{
	int x, y;

	while(true) {
		cin >> x >> y;
		if(!x && !y)	break;
		cout << (x > y ? y : x) << " " << (x > y ? x : y) << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val b = sc.next()

    if (b == "A") {
      println("T")
      return
    }
    if (b == "C") {
      println("G")
      return
    }
    if (b == "G") {
      println("C")
      return
    }
    println("A")
  }
}

Measured memory_bytes: 25388
#include <iostream>
#include <iomanip>
#include <cmath>

const double PI = 4*atan(1);

int main(){
	double a, b, c, rad_C, S, L, h;
	int deg_C;
	std::cin >> a >> b >> deg_C;
	rad_C = deg_C * PI / 180;
	S = a * b * sin(rad_C) / 2;
	c = sqrt(a * a + b * b - 2 * a * b * cos(rad_C));
	L = a + b + c;
	h = 2 * S / a;
	std::cout << std::fixed << S << '\n' << L << '\n' << h << std::endl;
	return 0;
}

Measured memory_bytes: 1292
class Game:
    def __init__(self, mp, height):
        self.mp = mp
        self.height = height
        self.score = 0
        self.erase_flag = False

    def erase(self):
        for y in range(self.height):
            line = self.mp[y]
            new_line, add_score = self.fix(line)
            self.mp[y] = new_line
            self.score += add_score
            if add_score != 0:self.erase_flag = True

    def fix(self, line):
        add_score = 0
        new_line = line
        for length in range(5, 2, -1):
            for left in range(5 - length + 1):
                if all(map(lambda x:x==line[left], line[left:left+length])):
                    add_score = line[left] * length
                    new_line = line[:left] + [0] * length + line[left+length:]
                    return new_line, add_score
        return new_line, add_score

    def fall(self):
        for x in range(5):
            col = []
            for y in range(self.height):
                if self.mp[y][x] != 0:
                    col.append(self.mp[y][x])
            col = [0] * (self.height - len(col)) + col
            for y in range(self.height):
                self.mp[y][x] = col[y]

    def run(self):
        while True:
            self.erase_flag = False
            self.erase()
            if not self.erase_flag:break
            self.fall()

    def print_state(self):
        print(*self.mp, sep="\n")
        print(self.score)


while True:
    h = int(input())
    if h == 0:break
    mp = [list(map(int, input().split())) for _ in range(h)]
    game = Game(mp, h)
    game.run()
    print(game.score)


Measured memory_bytes: 5632
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long

struct edge { int t,next; }a[400010];

int head[200010],mx1[200010],mx2[200010],mn[200010],sum[200010],n,tot;
char bo[200010];
ll ans;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline void add(int x,int y) { a[++tot].t=y;a[tot].next=head[x];head[x]=tot; }

inline void dfs(int x,int y)
{
	mn[x]=2123333333;
	if (bo[x]=='1') sum[x]++,mn[x]=0;
	for (int i=head[x];i;i=a[i].next)
	{
		int t=a[i].t;
		if (t==y) continue;
		dfs(t,x);
		sum[x]+=sum[t];
		int hh=mx1[t]+1;
		if (mx1[x]<hh) mx2[x]=mx1[x],mx1[x]=hh;
		else mx2[x]=max(mx2[x],hh);
		if (sum[t]) mn[x]=min(mn[x],hh);
	}
}

inline void dfs1(int x,int y)
{
	for (int i=head[x];i;i=a[i].next)
	{
		int t=a[i].t;
		if (t==y) continue;
		int hh=(mx1[x]==mx1[t]+1)?mx2[x]+1:mx1[x]+1;
		if (mx1[t]<hh) mx2[t]=mx1[t],mx1[t]=hh;
		else mx2[t]=max(mx2[t],hh);
		if (sum[t]<sum[1]) mn[t]=min(mn[t],hh);
		dfs1(t,x);
	}
	int hh=min(mx2[x]+1,mx1[x]-1);
	if (hh>=mn[x]) ans+=hh-mn[x]+1;
}

int main()
{
	n=rd();tot=0;
	for (int i=1;i<n;i++)
	{
		int x=rd(),y=rd();
		add(x,y);add(y,x);
	}
	scanf("%s",bo+1);
	ans=0LL;dfs(1,0);dfs1(1,0);
	printf("%lld\n",ans+1);
	return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    double L; cin>>L;
    printf("%.10lf\n",L*L*L/27.0);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    int a,b,c,d;
    
    scanf("%d %d %d %d" , &a ,&b, &c, &d);
    
    if(abs(b-a) <=d && abs(c-b) <=d){
        puts("Yes");
    }else if(abs(c-a)<=d){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;

}


Measured memory_bytes: 128
#include<cstdio>
int n,m,tot;char ch[10];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
	{
		scanf("%s",ch+1);
		for(int j=1;j<=m;++j)
			tot+=ch[j]=='#';
	}
	puts(tot==n+m-1?"Possible":"Impossible");
	return 0;
}


Measured memory_bytes: 128
/*  
    tanuj_johal :: gla_clg_sync_with_CSE(true);
    bonding.tie(true);
    hardwork.tie(true);
    
    ::::::::--------------------::::::::
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;


const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
bool imp = false;

void solve()
{
    unordered_map<ll,ll> mp;        set<ll> st;
    multiset<ll> ms;
    
    ll a,b,n;cin>>a>>b>>n;
    ll s = 0;
    ll e = n;
    ll ans = 0;
    while(s <= e)
    {
        ll mid = (s+e)/2;
        ll find = floor(((double)a*mid)/b) - a*floor(mid/b);
        if(find>0)
        {
            ans = max(ans,find);
            s = mid+1;
        }
        else{
            e = mid-1;
        }
    }
    ll mid = min(b-1,n);
    ans = max(ans, (ll)(floor(((double)a*mid)/b) - a*floor(mid/b)));
    
    cout<<ans<<endl;
}

int main()
{
    fio
    int t=1;
    if(imp) cin>>t;
    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        solve();
        // tc++;
    }
    
}


Measured memory_bytes: 3668
"use strict";

function main(input) {
  input = input.trim().split("\n");
  const K = parseInt(input[0]);
  const S = input[1].length;
  if (S <= K) {
    console.log(input[1]);
    return;
  }
  const res = input[1].slice(0, K);
  console.log(res + "...");
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


Measured memory_bytes: 29628
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input.split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

n = int(input())

a = list(map(int,input().split()))
su = 0
b = list(map(int,input().split()))
for i in range(n):
	if a[i] - b[i] >= 0:
		su += a[i] - b[i]

print(su)

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int digit_sum(int n) {
    int s = 0;
    while (n != 0) s+=n%10,n/=10;
    return s;
}

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

    int N,A,B; cin >>N>>A>>B;

    int ans = 0;
    for (int n = 1; n <= N; n++) {
        int sum = digit_sum(n);
        // cout << FMT2(n,sum) << endl;
        if (A <= sum && sum <= B) ans += n;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
  
count = int(input())
  
for c in range(count):
    (b, f, r, v) = [int(x) for x in input().split()]
    data[b - 1][f - 1][r - 1] += v
  
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',data[b][f][r], end='')
        print()
    if b < 3:
        print('#' * 20)

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

int main() {

int64_t N, A, B;
cin >> N >> A >> B;
if(N%(A+B)>=A){
    cout << A*(N/(A+B))+A << endl;
}
else{
    cout << A*(N/(A+B))+(N%(A+B)) << endl;
}    
         
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007ll
#define MAX 200000
using namespace std;
typedef long long ll;
long long kaijo[MAX + 1], rev[MAX + 1];

ll Pow(ll a, ll b) {
	ll aa = a, bb = b, res = 1;
	while (bb) {
		if (bb & 1) {
			res = res * aa % MOD;
		}
		aa = aa * aa % MOD;
		bb >>= 1;
	}
	return res;
}

int main()
{
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	ll res = 0;
	vector<ll> kai(MAX), rkai(MAX);
	kai[0] = rkai[0] = 1;
	for (int i = 1; i < MAX; i++) {
		kai[i] = kai[i - 1] * i % MOD;
		rkai[i] = Pow(kai[i], MOD - 2);
	}
	for (int i = 0; i < W - B; i++) {
		ll ans1 = kai[H - A + B + i - 1], ans2 = kai[W + A - B - i - 2];
		ans1 = (ans1 * rkai[B + i]) % MOD;
		ans1 = (ans1 * rkai[H - A - 1]) % MOD;
		ans2 = (ans2 * rkai[A - 1]) % MOD;
		ans2 = (ans2 * rkai[W - B - i - 1]) % MOD;
		res = (res + (ans1 * ans2) % MOD) % MOD;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3328
#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>;
const int INF = 1 << 30;
 
int main() {
	int n;
	cin >> n;
	vector<int> a(3*n);
	rep(i, 3*n) cin >> a[i];
	sort(a.begin(), a.end(), greater<int>());
	ll ans = 0;
	int j = 1;
	rep(i, n)
	{
		ans += a[j];
		j += 2; 
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	
	int A , B ;
	
	scanf("%d %d", &A , &B);

	if(A == B ){
	 printf("Draw");
     }
	
	if((A == 1 && B != 1)||(A != 1 && B == 1)){
	  	
		  if(A == 1)
	  	 printf("Alice");
	  	if(B == 1)
	  	 printf("Bob");
		    
	  }else if(A>B)
	   {
		 if(A <= 13){
		 	printf("Alice");
		 }
	   }else if(B>A){
       	 if(B <= 13){
		 	printf("Bob");
		 }
	   }

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int R, G, B, N, r_max, g_max, b_max;
  long long result = 0;
  cin >> R >> G >> B >> N;
  r_max = N / R;
  g_max = N / G;
  b_max = N / B;
  for (int r=0;r<=r_max;r++) {
    int n_rest_r = N - r*R;
    for (int g=0;g<=g_max;g++) {
      int n_rest_g = n_rest_r - g*G;
      if (n_rest_g <0) {
	break;
      }
      if (n_rest_g % B == 0) {
	result++;
      }
    }
  }
  cout << result << endl;
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {
  
  ll N, Q;
  cin >> N >> Q;
  map<ll, ll> row, col;

  ll sum = 0;
  rep(q,Q) {
    ll c, x;
    cin >> c >> x;
    x--;
    ll ans;
    if (c == 1) {
      decltype(row)::iterator it = row.lower_bound(x);
      if (it == row.end()) {
        ans = N - 2;
      } else {
        ans = it->second - 1;
      }
      sum += ans;
      if (col.find(ans) == col.end()) {
        col.emplace(ans, x);
      } else {
        col[ans] = min(col[ans], x);
      }
    } else {
      decltype(col)::iterator it = col.lower_bound(x);
      if (it == col.end()) {
        ans = N - 2;
      } else {
        ans = it->second - 1;
      }
      sum += ans;
      if (row.find(ans) == row.end()) {
        row.emplace(ans, x);
      } else {
        row[ans] = min(row[ans], x);
      }
    }
  }

  ll finalAnswer = (N - 2) * (N - 2) - sum;

  cout << finalAnswer << endl;

  return 0;
}

Measured memory_bytes: 9660
//power sockets
#include<iostream>
using namespace std;
int main()
{
	int a, b, i;
	cin >> a >> b;
	for (i = 0; i < 21; i++)
	{
		if ((a - 1)*i + 1 >= b)
		{
			cout << i << " " << endl;
			break;
		}
	}
	return 0;
}


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

using namespace std;

int main()
{
	string str,rev,sub;
	int flag=0;
	cin >> str;
	string::iterator it = str.end()-1;
	while(it != str.begin()){
		rev += *it;
		it--;
	}
	rev += *it;
	while(!rev.empty()){
		sub = rev.substr(0,5);
		if(sub == "maerd" || sub == "esare"){
			rev.erase(rev.begin(),rev.begin()+5);
			continue;
		}else if(sub == "resar"){
			if(rev.substr(5,1) == "e"){
				rev.erase(rev.begin(),rev.begin()+6);
				continue;
			}else{
				flag = 1;
				break;
			}
		}else if(sub == "remae"){
			if(rev.substr(5,2) == "rd"){
				rev.erase(rev.begin(),rev.begin()+7);
				continue;
			}else{
				flag = 1;
				break;
			}
		}else{
			flag = 1;
			break;
		}	
	}
	if(flag == 0){
		cout << "YES";
	}else{
		cout << "NO";
	}
}

Measured memory_bytes: 512
from itertools import combinations
n = int(input())
names = [input()[0] for _ in range(n)]
li = [0]*5
for i,c in enumerate("MARCH"):
	cnt = 0
	for name in names:
		if c == name:
			cnt += 1
	li[i] = cnt
ans = 0
for i,j,k in combinations(li,3):
	ans += i*j*k
print(ans)

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

#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

#define rep(i,n)      for(int i=0; i < (n); ++i)
#define fr            first
#define sc            second
#define int           long long
#define uint          unsigned long long
#define pb            push_back
#define mp            make_pair
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define sz(x)         (x).size()

const double PI=3.1415926535897932384626433832795;
const int mod=1e9+7;
const int mod1=998244353;
int n,ans; string str;

int solve(){
    cin>>n;
    int a[n+1],b[n];
    for (int i = 0; i < n+1; ++i)
    {
        cin>>a[i];
    }
    for (int i = 0; i < n; ++i)
    {
        int b; cin>>b;
        if(b>a[i]){
            b-=a[i];
            ans+=a[i];
            if(b>a[i+1]){
                ans+=a[i+1];
                a[i+1]=0;
            }
            else{
                ans+=b;
                a[i+1]-=b;
            }
        }
        else{
            ans+=b;
        }
    }
    cout<<ans;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests=1;
    //cin>>tests;
    while(tests--) solve();
    return 0;
}

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

int n;
int a[500000];
int b[500000];

void merge(int l, int m, int r) {
  for (int i = l; i < r; ++i) {
    b[i] = a[i];
  }
  int p = l;
  int q = m;
  int c = l;
  while (c < r) {
    if (p == m) {
      a[c++] = b[q++];
    } else if (q == r) {
      a[c++] = b[p++];
    } else if (b[p] < b[q]) {
      a[c++] = b[p++];
    } else {
      a[c++] = b[q++];
    }
  }
}

int merge_sort(int l, int r) {
  int t = 0;
  if (l + 1 < r) {
    int m = (l + r) / 2;
    t += merge_sort(l, m);
    t += merge_sort(m, r);
    merge(l, m, r);
    t += r - l;
  }
  return t;
}

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

  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int t = merge_sort(0, n);
  for (int i = 0; i < n; ++i) {
    if (i) {
      cout << " ";
    }
    cout << a[i];
  }
  cout << endl;
  cout << t << endl;

  return 0;
}



Measured memory_bytes: 7036
#include <iostream>
#define N 10
using namespace std;

int main(){
  int w,d,wh[N],dh[N],ans;
  bool wused[N],dused[N];
  while(1){
    cin>>w>>d;
    if(!w&&!d) break;
    for(int i=0;i<w;i++) cin>>wh[i],wused[i]=false;
    for(int i=0;i<d;i++) cin>>dh[i],dused[i]=false;
    ans=0;
    for(int i=0;i<w;i++){
      if(wused[i]) continue;
      for(int j=0;j<d;j++){
	if(dused[j]||(wh[i]!=dh[j])) continue;
	wused[i]=dused[j]=true;
	ans+=wh[i];
	break;
      }
    }
    for(int i=0;i<w;i++)
      if(!wused[i]) ans+=wh[i];
    for(int i=0;i<d;i++)
      if(!dused[i]) ans+=dh[i];
    cout<<ans<<endl;
  }
  return 0;
}

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> board(h);
    rep(i, h) cin >> board.at(i);
    
    vector<int> dx = {-1, 0, 1, -1, 1, -1, 0, 1};
    vector<int> dy = {-1, -1, -1, 0, 0, 1, 1, 1};

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (board.at(i).at(j) == '#') continue;

            int num = 0;
            for(int k = 0; k < 8; k++){
                int ni = i + dy.at(k);
                int nj = j + dx.at(k);
                
                if (ni < 0 || h <= ni) {
                    continue;
                }
                if (nj < 0 || w <= nj) {
                    continue;
                }
                if (board.at(ni).at(nj) == '#'){
                    num++;
                }
            }
            board.at(i).at(j) = char(num + '0');
        }
    }
    rep(i, h){
        cout << board.at(i) << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;


public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		if(a+b==c+d) {
			System.out.println("Balanced");
		}else if(a+b>c+d) {
			System.out.println("Left");
		}else if(a+b<c+d) {
			System.out.println("Right");
		}
		
	}
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
    ll temp = 0;
    while(true){
        int i; cin >> i;
        if(i == 0) break;
        printf("Case %d: %d\n", temp+1, i);
        temp++;
    }
}



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

void fnInput(int& rnAchieve, vector<int>& rvnPrice, vector<vector<int>>& rvvnSkill)
{
  int nPriceSiz, nSkillSiz;
  cin >> nPriceSiz >> nSkillSiz >> rnAchieve;
  rvnPrice.resize(nPriceSiz);
  rvvnSkill.resize(nPriceSiz, vector<int>(nSkillSiz));

  for (int i = 0; i < rvvnSkill.size(); i++)
  {
    cin >> rvnPrice[i];

    for (int j = 0; j < rvvnSkill[i].size(); j++)
      cin >> rvvnSkill[i][j];
  }
}

int fnMinPriceSkillup(int nAchieve, const vector<int> cnrvnPrice, 
                      const vector<vector<int>>& cnrvvnSkill)
{
  int nMinPrice = INT_MAX;

  for (int nCtl = 0; nCtl < (1 << cnrvnPrice.size()); nCtl++)
  {
    int nPrice = 0;
    vector<int> vnSumSkill(cnrvvnSkill[0].size());

    for (int ny = 0; ny < cnrvnPrice.size(); ny++)
      if (nCtl & (1 << ny))
      {
        for (int nx = 0; nx < cnrvvnSkill[ny].size(); nx++)
          vnSumSkill[nx] += cnrvvnSkill[ny][nx];

        nPrice += cnrvnPrice[ny];
      }

    bool bRslt = true;

    for (int nSumSkill : vnSumSkill)
      if (nSumSkill < nAchieve)
      {
        bRslt = false;
        break;
      }
      if (bRslt)
        nMinPrice = min(nMinPrice, nPrice);
  }
  if (nMinPrice == INT_MAX)
    return -1;
  else
    return nMinPrice;
}
  
int main()
{
  int nAchieve;
  vector<int> vnPrice;
  vector<vector<int>> vvnSkill;

  fnInput(nAchieve, vnPrice, vvnSkill);
  cout << fnMinPriceSkillup(nAchieve, vnPrice, vvnSkill) << endl;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,b=0;
    
    cin>>n;
    int s[n+1];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    sort(s,s+n);
    for(int j=0;j<(n-1);j++){
        b+=s[j];
    }
    if(s[n-1]>=b){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli n;
    cin>>n;
    
    out(n*n*n);
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<sstream>

using namespace std;
typedef long long ll;
#define rep(i, x, y) for (ll (i)=(x); (i)<=(y); (i)++)
ll n;
string s;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(100);
	s = "";
	cin >> n;
	if (n == 0) {
		cout << 0 << '\n';
		return 0;
	}
	for (ll i = 1; n != 0; ++i) {
		if (n % (-2) != 0) {
			s = '1' + s;
			if (i % 2 == 1)n -= 1;
			else n += 1;
			n /= 2;
		}
		else {
			s = '0' + s;
			n /= 2;
		}
	}
	cout << s << '\n';
	return 0;
}


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

using namespace std;

int main(void){
    int N, K, tmp, count = 0;
    scanf("%d%d", &N, &K);

    for(int i = 0; i < N; i++){
        scanf("%d", &tmp);
        if(tmp >= K)
            count ++;
    }

    cout << count << endl;
    return 0;
}

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

int main(int argc, const char * argv[]) {
    int a, b, c;
    int ans;
    cin >> a >> b >> c;

    set<int> s;

    s.insert(a);
    s.insert(b);
    s.insert(c);

    cout << s.size() << endl;

}

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


bool isPrime(int n){
	int start=sqrt(n);
	for(int i=start;i>1;i--)
		if(n%i==0)
			return false;

	return true;
}
int gcd(int no1,int no2){
	if(no2==0)
		return no1;
	return gcd(no2,no1%no2);
}

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

    while(t--){
		int n;
		cin>>n;

		vector<int> data(n);
		for(int i=0;i<n;i++)
			cin>>data[i];

		map<int,int> exist;
		bool firstSol=true;

		vector<int> nonPrime;
		vector<int> prime;

		for(int i=0;i<n;i++){
			if(data[i]!=1){
				auto it = exist.find(data[i]);
				if(it==exist.end())
					exist.insert(make_pair(data[i],1));
				else
					firstSol=false;

				if(isPrime(data[i]))
					prime.push_back(data[i]);
				else
					nonPrime.push_back(data[i]);
			}
		}

		int finalAns=false;
		if(firstSol){
			bool allOne=true;
			for(int i=0;i<prime.size();i++){
				for(int j=0;j<nonPrime.size();j++)
				{
					if(nonPrime[j]>prime[i] && (nonPrime[j]%prime[i])==0){
						allOne=false;
						break;
					}
				}
				if(!allOne)
					break;	
			}
			if(allOne){
				for(int i=0;i<nonPrime.size();i++){
					for(int j=i+1;j<nonPrime.size();j++){
						if(gcd(nonPrime[i],nonPrime[j])!=1)
						{
							allOne=false;
							break;
						}
					}
					if(!allOne)
						break;
				}
			}
			if(allOne){
				finalAns=true;
				cout<<"pairwise coprime"<<endl;		
			}			
		}

		if(!finalAns){
			int ans=data[0];
			for(int i=1;i<n;i++)
				ans=gcd(ans,data[i]);

			if(ans==1){
				finalAns=true;
				cout<<"setwise coprime"<<endl;
			}
		}
		if(!finalAns)
			cout<<"not coprime"<<endl;
    }
    return 0;
}


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

int main() {

	double w,h,x,y,k=0,area;
	cin>>w>>h>>x>>y;
	area=w/2*h;
	if(x==w/2 && y==h/2) k=1;
	cout<<area<<" "<<k<<endl;

	return 0;
}

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

int main(void){
    int N;
    cin >> N;
    int can[2][N];
    int u[N], d[N];
    int sum;
    int ans = 0;
    u[0]=0; d[0]=0;
    for(int i = 0; i < N; i++){
        cin >> can[0][i];
        if(i==0) u[i]=can[0][i];
        else u[i]=u[i-1]+can[0][i];
    }
    for(int i = 0; i < N; i++){
        cin >> can[1][i];
        if(i==0) d[i]=can[1][i];
        else d[i]=d[i-1]+can[1][i];
    }
    for(int i = 0; i < N; i++){
        if(i==0) sum=u[i]+d[N-1];
        else sum=u[i]+(d[N-1]-d[i-1]);
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int N;
    cin >> N;
    rep(i, 26) {
        rep(j, 16) {
            if (N == 4 * i + 7 * j) {
                Yes;
                return 0;
            }
        }
    }
    No;
}


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

class Program
{
    static void Main()
    {
        int[] DG = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int D = DG[0];
        int G = DG[1];
        var PandC =
            Enumerable
            .Range(0, D)
            .Select(n => Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray())
            .Select(arr => new { p = arr[0], c = arr[1] })
            .ToArray();

        int ans = int.MaxValue;

        int PatternMax = (int)Math.Pow(2, D) - 1;

        for(int pattern = 0; pattern <= PatternMax; pattern++)
        {
            int cnt = 0;
            int pt = 0;

            int tmp = -1;

            for(int i = 0; i < D; i++)
            {
                if((pattern >> i & 1) == 1)
                {
                    pt += PandC[i].c + PandC[i].p * (i + 1) * 100;
                    cnt += PandC[i].p;
                }
                else
                {
                    tmp = i;
                }
            }

            if (tmp != -1 && pt < G)
            {
                if(pt + (PandC[tmp].p - 1) * (tmp + 1) * 100 < G)
                {
                    continue;
                }
                else
                {
                    var tmpCnt = (int)Math.Ceiling((G - pt) / (double)((tmp + 1) * 100));
                    cnt += tmpCnt;
                    pt += tmpCnt * (tmp + 1) * 100;
                }
            }

            if (pt >= G)
                ans = Math.Min(ans, cnt);
        }
        Console.WriteLine(ans);
    }
    
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}



Measured memory_bytes: 13396
#include<cstdio>
#include<map>
#define base 203
#define ull unsigned long long
using namespace std;
map<ull,bool>mp;
char s[5005];
ull f[5005],Hash[5005];
ull get(int l,int r){
	return Hash[r]-Hash[l-1]*f[r-l+1];
}
	int n;
bool check(int x){
	mp.clear();
	int l=x;
	for (int i=x;i<=n;i++){
		if (i-l>=x) mp[get(l-x+1,l)]=1,l++;
		if (mp[get(i-x+1,i)]) return 1;
	}
	return 0;
}
int main(){

	scanf("%d",&n);
	scanf("%s",s+1);
	f[0]=1;
	for (int i=1;i<=n;i++)
	Hash[i]=Hash[i-1]*base+s[i],f[i]=f[i-1]*base;
	int l=0,r=n;
	while (l<=r){
		int m=(l+r)>>1;
		//printf("%d %d %d\n",l,r,m);
		if (check(m)) l=m+1;else r=m-1;
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 640