akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N,M;
int m[707][707];

vector<int> g[707];
int col[707];

int even,odd,edge;

void fail(){
    cout<<-1<<endl;
    exit(0);
}

void dfs(int now,int c){
    col[now]=c;
    if(c==1) even++;
    else odd++;
    edge+=(int)g[now].size();
    
    for(auto nex:g[now]){
        if(col[nex]==col[now]) fail();
        if(col[nex]==0) dfs(nex,-c);
    }
}

int dp[2][707][707];
const int INF=1e9;

void chmax(int &a,int b){
    if(a<b) a=b;
}

int main(){
  cin>>N>>M;
  rep(i,M){
      int a,b;
      cin>>a>>b;
      m[a][b]=1;
      m[b][a]=1;
  }

  for(int i=1;i<=N;i++){
      for(int j=1;j<=N;j++){
          if(i==j) continue;
          if(m[i][j]==0) g[i].push_back(j);
      }
  }

  int ans=0;
  vector<pair<int,int>> v;
  for(int i=1;i<=N;i++){
      if(col[i]==0){
          dfs(i,1);
          edge/=2;
          ans+=(odd*even)-edge;
          v.push_back(mkp(odd,even));

          odd=even=edge=0;
      }
  }

  rep(i,2) for(int j=0;j<=N;j++) for(int k=0;k<=N;k++) dp[i][j][k]=-INF;
  dp[0][0][0]=0;
  int t=0;

  for(int i=0;i<v.size();i++){
      for(int j=0;j<=N;j++){
          for(int k=0;k<=N;k++){
              if(dp[t][j][k]==-INF) continue;

              int l=v[i].first;
              int r=v[i].second;

              chmax(dp[1-t][j+l][k+r],dp[t][j][k]+j*r+k*l);
              chmax(dp[1-t][j+r][k+l],dp[t][j][k]+j*l+k*r);
          }
      }
      for(int j=0;j<=N;j++) for(int k=0;k<=N;k++) dp[t][j][k]=-INF;
      t=1-t;
  }

  int res=0;
  for(int j=0;j<=N;j++) for(int k=0;k<=N;k++) chmax(res,dp[t][j][k]);
  ans+=res;
  cout<<M-ans<<endl;

  return 0;
}


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

int main(){

	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;

	if(x-r >= 0 && x+r <=W && y-r >= 0 && y+r <= H)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 3100
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
char board[55][55];

int main(void){
	int x, ans = 1;
	cin >> x;
	for (int i = 2;i <= x;i++) {
		int num = i;
		while (true) {
			num = num * i;
			if (num <= x)ans = max(ans, num);
			else break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    while(1){
        scanf("%d %d",&a,&b);
        if(a==0&&b==0){
            break;}
        if(a>=b){printf("%d %d\n",b,a);}
        else if(a<b){
        printf("%d %d\n",a,b);}
    }
    return 0;
}


Measured memory_bytes: 2040
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  int ny, nx;
  scanf("%d %d", &ny, &nx);
  int count[26] = {};
  for (int y = 0; y < ny; ++y) {
    string s(nx, ' ');
    scanf("%s", &s[0]);
    for (int x = 0; x < nx; ++x) {
      ++count[s[x] - 'a'];
    }
  }
  vector<int> needs;
  for (int y = 0; y <= ny - 1 - y; ++y)
    for (int x = 0; x <= nx - 1 - x; ++x)
      needs.push_back((y < ny - 1 - y ? 2 : 1) *
                      (x < nx - 1 - x ? 2 : 1));
  sort(needs.begin(), needs.end());
  for (int c = 0; c < 26; ++c)
    for (int i = needs.size() - 1; i >= 0; --i)
      if (count[c] >= needs[i]) {
        count[c] -= needs[i];
        needs.erase(needs.begin() + i);
      }
  bool result = needs.empty();
  printf(result ? "Yes\n" : "No\n");
  return 0;
}


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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string t;
    cin >> t;
    for(size_t i=0;i<t.size();++i) if(t[i] == '?') t[i] = 'D';
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;

int main()
{
    FAST

    ll n;

    cin>>n;

    ll tmp = n%1000;

    ll a = 1000-tmp;

    if(a==1000)
        a = 0;

    cout<<a<<endl;

    return 0;
}



Measured memory_bytes: 3648
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista

def wakacje(): 
    N = wczytaj_liste()[0]
    punkty_za_zadania = [None]*N
    for i in range(N):
        punkty_za_zadania[i] = wczytaj_liste()
    wczoraj = [0, 0, 0]
    dzisaj = [None]*3
    for i in range(N):
        dzisaj[0] = max(wczoraj[1]+punkty_za_zadania[i][0], wczoraj[2]+punkty_za_zadania[i][0])
        dzisaj[1] = max(wczoraj[0]+punkty_za_zadania[i][1], wczoraj[2]+punkty_za_zadania[i][1])
        dzisaj[2] = max(wczoraj[0]+punkty_za_zadania[i][2], wczoraj[1]+punkty_za_zadania[i][2])
        wczoraj = dzisaj[:]
    print (max(wczoraj))
    
wakacje()

Measured memory_bytes: 58712
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
typedef long long ll;
const int mod=1000000007;
#define lol(i,n) for(int i=0;i<n;i++)

using namespace std;
int n,q;
int main(){
    cin >> n >>q;
    queue <pair<string,int>> s;
    string name;
    int t;
    lol(i,n){
        cin >> name >> t;
        s.push(make_pair(name,t));
    }
    pair<string,int> u;
    int a,sum=0;;
    while(!s.empty()){
        u=s.front();s.pop();
        a=min(u.second,q);
        u.second-=a;
        sum+=a;
        if(u.second!=0)s.push(u);
        else cout << u.first << " "<< sum << endl;
    }
    }



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

int main() {
  int A, B, C, X; cin >> A >> B >> C >> X;
  int count = 0;
  for(int a = 0; a<=A;a++){
    for(int b=0;b<=B;b++){
      for(int c=0;c<=C;c++){
        int total = 500*a+100*b+50*c;
        if(total == X) count++;
      }
    }
  }
  cout << count << endl;
        
}

Measured memory_bytes: 256
function main(input) {
  const D = parseInt(input, 10);
  
  if (D === 25) {
    console.log('Christmas');
  } else if (D === 24) {
    console.log('Christmas Eve');
  } else if (D === 23) {
    console.log('Christmas Eve Eve');
  } else {
    console.log('Christmas Eve Eve Eve');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29500
//Circle

#include <iostream>
#include <cmath>

namespace {

constexpr double pi()
{
  return std::atan(1.0) * 4.0;
}

}

int main()
{
  double radius;
  std::cin >> radius;
  
  const double area = radius * radius * pi();
  const double circumference = 2 * radius * pi();

  printf("%f %f\n", area, circumference);

  return 0;
}

Measured memory_bytes: 1228
S = list(input())
a = 10 * int(S[0]) + int(S[1])
b = 10 * int(S[2]) + int(S[3])

if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
a,b,c,x,y=map(int,input().split())
price=0
if a+b>=c*2:
    min_point=min(x,y)
    price +=min_point*c*2
    x -=min_point
    y -=min_point
    if x>y:
        if a>=c*2:
            price +=c*2*x
        else:
            price +=a*x
    elif y>x:
        if b>=c*2:
            price +=c*2*y
        else:
            price +=b*y
    print(price)
else:
    print(a*x+b*y)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		if (a == 0 && b == 0) {
			break;
		}
		if (a <= b) {
			System.out.println (a + " " + b);
		} else {
			System.out.println (b + " " + a);
		}
		}
	}
}


Measured memory_bytes: 36168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    unordered_map<ll, ll> cnt;
    REP(i, n)
    {
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll ans = 0;
    for (auto itr = cnt.begin(); itr != cnt.end();itr++){
        ans += itr->second*(itr->second-1)/2;
    }

    REP(i,n){
        ll tmp = ans - cnt[a[i]] * (cnt[a[i]] - 1) / 2;
        ll dcnt = cnt[a[i]] - 1;
        cout << tmp + dcnt * (dcnt - 1) / 2 << endl;
    }

    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n;
  cin >> n;

  ll t, a;
  cin >> t >> a;
  t *= 1000;
  a *= 1000;

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

  ll ans = 0;
  double d = 1e9;
  for (ll i = 0; i < n; ++i) {
    ll p = abs(a - (t - h[i] * 6));
    if (d > p) {
      d = p;
      ans = i+1;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T>
{
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let numbers: Vec<i32> = read_vec();
    if (numbers[0] * numbers[1]) % 2 == 0
    {
        println!("Even");
    }
    else
    {
        println!("Odd");
    }
}


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

map <string, long long> a;
map <string, long long>::iterator it;
string s;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    long long n, l = 0; cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> s;
        sort(s.begin(),s.end());
        a[s]++;
    }
    for(it = a.begin(); it != a.end(); it++){
        if((*it).second > 1) l += (*it).second * ((*it).second - 1) / 2;
    }
    cout << l;
    return 0;
}


Measured memory_bytes: 11264
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

px = 1
lst = [i + 1 for i in range(n)]
tmp = 1 
for i in range(n - 1):
  tmp *= i + 1
for i, x in enumerate(p[:-1]):
  idx = lst.index(x)
  lst.pop(idx)
  px += idx * tmp
  tmp //= n - i - 1

qx = 1
lst = [i + 1 for i in range(n)]
tmp = 1 
for i in range(n - 1):
  tmp *= i + 1
for i, x in enumerate(q[:-1]):
  idx = lst.index(x)
  lst.pop(idx)
  qx += idx * tmp
  tmp //= n - i - 1

print(abs(px - qx))

Measured memory_bytes: 3064
N = gets.to_i
s = N.times.map{gets.split.map(&:to_s)}

s.sort {|a,b| -1*(a[1].to_i <=> b[1].to_i)}.sort {|a,b| (a[0] <=> b[0])}.each do |i|
  p s.index(i)+1
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};

bool valid(int x,int y,int H,int W){return 0<=x && x<H && 0<=y && y<W;}

bool movable(int x,int y,int i,const vector<vector<int>> &row,const vector<vector<int>> &col){
  if(i&1){
    if(i==1){return !col[x][y+1];}
    else{return !col[x][y];}
  }
  if(i==0){return !row[x+1][y];}
  return !row[x][y];
}

bool culclate(){
  ll H,W,R,C;
  cin>>H>>W>>R>>C;
  if(H==0 && W==0 && R==0 && C==0){return false;}
  R--; C--;
  vector<vector<int>> row(H+1,vector<int>(W));
  vector<vector<int>> col(H,vector<int>(W+1));
  for(int i=0;i<H;i++){cin>>row[i]>>col[i];} cin>>row.back();
  vector<vector<bool>> dp(H,vector<bool>(W,false));
  queue<pll> Q;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      bool c1=false,c2=false;
      for(int k=0;k<4;k++){
        int x=i+dx[k],y=j+dy[k];
        if(!valid(x,y,H,W)){
          if(movable(i,j,k,row,col)){
            c1=true;
          }
          else{
            c2=true;
          }
        }
      }
      if(c1 && c2){
        dp[i][j]=true;
        for(int k=0;k<4;k++){
          int x=i+dx[k],y=j+dy[k];
          if(valid(x,y,H,W) && !dp[x][y]){Q.push({x,y});}
        }
      }
    }
  }
  while(!Q.empty()){
    pll u=Q.front(); Q.pop();
    int i=u.F,j=u.S;
    bool c1=false,c2=false;
    for(int k=0;k<4;k++){
      int x=i+dx[k],y=j+dy[k];
      if(!valid(x,y,H,W)){
        if(movable(i,j,k,row,col)){
          c1=true;
        }
        else{
          c2=true;
        }
      }
      else if(dp[x][y]){
        if(movable(i,j,k,row,col)){
          c1=true;
        }
        else{
          c2=true;
        }
      }
    }
    if(c1 && c2){
      dp[i][j]=true;
      for(int k=0;k<4;k++){
        int x=i+dx[k],y=j+dy[k];
        if(valid(x,y,H,W) && !dp[x][y]){Q.push({x,y});}
      }
    }
  }
  bool win=dp[R][C];
  for(int k=0;k<4;k++){
    int i=R,j=C;
    int x=i+dx[k],y=j+dy[k];
    if(!valid(x,y,H,W)){
      if(movable(i,j,k,row,col)){
        win=true;
      }
    }
    else if(dp[x][y]){
      if(movable(i,j,k,row,col)){
        win=true;
      }
    }
  }
  /*
  for(auto &I:dp){
    for(int i=0;i<W;i++){cout<<I[i];}cout<<endl;
  }
  //*/
  cout<<(win?"Yes":"No")<<endl;
  
  
  return true;
}

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


  return 0;
}



Measured memory_bytes: 4980
#include <stdio.h>
int main(void) {
	int n, x, a, b, c, ab, abc, cnt;

	while (1) {
		scanf("%d %d", &n, &x);
		if (n == 0 && x == 0)
			break;
		n += 1;
		cnt = 0;
		for (a = 1; a < n; a++) {
			if (a >= x)
				break;
			for (b = a+1; b < n; b++) {
				ab = a + b;
				if (ab >= x)
					break;
				for (c = b+1; c < n; c++) {
					abc = ab + c;
					if (abc == x) {
						cnt += 1;
						break;
					}
					if (abc > x)
						break;
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A , B , C , D;
  cin >> A >> B >> C >> D;
  
if (A + B > C + D) {
  cout << "Left" << endl;
  }
  else if (A + B < C + D) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}


Measured memory_bytes: 256
import sys

n, m = map(int, input().split())
s = input()
to_a = [set() for _ in range(n)]
to_b = [set() for _ in range(n)]
for _ in range(m):
	a, b = map(int, input().split())
	if s[a-1] == "A":
		if s[b-1] == "A":
			to_a[a-1].add(b-1)
			to_a[b-1].add(a-1)
		else:
			to_b[a-1].add(b-1)
			to_a[b-1].add(a-1)
	if s[a-1] == "B":
		if s[b-1] == "B":
			to_b[a-1].add(b-1)
			to_b[b-1].add(a-1)
		else:
			to_a[a-1].add(b-1)
			to_b[b-1].add(a-1)

not_valid = set([i for i in range(n) if len(to_a[i]) * len(to_b[i]) == 0])
cnt = 0
#print(not_valid)

while not_valid:
	node = not_valid.pop()
	#print(node)
	cnt += 1

	for next_node in to_a[node]:
		if next_node == node:
			continue
		if s[node] == "A":
			to_a[next_node].remove(node)
		else:
			to_b[next_node].remove(node)

		if len(to_a[next_node]) * len(to_b[next_node]) == 0:
			not_valid.add(next_node)

	for next_node in to_b[node]:
		if next_node == node:
			continue
		if s[node] == "A":
			to_a[next_node].remove(node)
		else:
			to_b[next_node].remove(node)

		if len(to_a[next_node]) * len(to_b[next_node]) == 0:
			not_valid.add(next_node)

	#print(not_valid)

if cnt == n:
	print("No")
else:
	print("Yes")

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

int n,i,p,a[1001];

int main(){
    cin >> n;
    for(i=1;i<=n;i++){
    	cin >> a[i];
        if(abs(a[i])>=abs(a[p]))
			p=i;
    }
    cout << 2*n-1 << endl;
    for(i=1;i<=n;i++)
    	cout << p << ' ' << i << endl;
    if(a[p]>0)
		for(i=1;i<n;i++)
			cout << i << ' ' << i+1 << endl;
    else
		for(i=n;i>1;i--)
			cout << i << ' ' << i-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        #define REP(i, n) for(int i = 0;i < n;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 FORR(i, m, n) for(int i = m;i >= n;i--)
        #define SORT(v, n) sort(v, v+n);
        #define VSORT(v) sort(v.begin(), v.end());
        #define llong long long
        #define pb(a) push_back(a)
        #define INF 999999999
        using namespace std;
        typedef pair<int, int> P;
        typedef pair<llong, llong> LP;
        typedef pair<int, P> PP;
        typedef pair<llong, LP> LPP;
     
        int dy[]={0, 0, 1, -1, 0};
        int dx[]={1, -1, 0, 0, 0};
     
        int main()
        {
            vector<int> a(5,0);
            REP(i,5) cin>>a[i];
            sort(a.begin(),a.end());
            int k;
            cin>>k;
            if(a[4]-a[0]>k) cout<<":("<<endl;
            else cout<<"Yay!"<<endl;
     
        }

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int x,y,z;
    cin >> x >> y >> z;
    x -= z;
    y += z;
    P(x/y);
    return  0;
}


Measured memory_bytes: 256
#include <cstdio>  
using namespace std;  
int main() { 	
	int a,b,c,d,e; 	
	scanf("%d %d %d", &a, &b, &c);
	if(a<c){
		if(a+b>c){
			printf("YES");
				}
		else{
			printf("NO");
		}
			}
	else if(a==c){
		printf("YES");
	}
	else {
		printf("NO");
		}

}






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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

const int maxn = 1e2 + 2;

set<int> s;

int findGrun() {
	for(int i=0;;i++){
		if(!s.count(i)){return i;}
	}
}

int main(){
	int n,k,i,j;
	scanf("%d %d",&n,&k);
	int a[maxn];
	for(i=0;i<n;i++){scanf("%d",&a[i]);}
	// grundy number method

	// int grun[100010];
	// grun[0] = 0;
	// for(i=1;i<=k;i++){
	// 	s.clear();
	// 	for(j=0;j<n;j++){
	// 		if(i-a[j] >= 0){
	// 			s.insert(grun[i-a[j]]);
	// 			// printf("diinsert: %d\n",i-a[j]);
	// 		}
	// 	}
	// 	grun[i] = findGrun();
	// 	// printf("grun[%d]: %d\n\n",i,grun[i]);
	// }
	// if(grun[k] == 0){printf("Second\n");}
	// else{printf("First\n");}

	// dp bottom up approach
	// dp[k] = condition that at k stone, if 1 then player 1 win, 0 otherwise
	int dp[100010];
	memset(dp, 0, sizeof dp);
	dp[0] = 0;
	for(i=1;i<=k;i++){
		dp[i] = 0;
		for(j=0;j<n;j++){
			if(a[j] <= i){
				if(dp[i - a[j]] == 0){
					dp[i] = 1;
					break;
				}
			}
		}
	}
	printf("%s\n",(dp[k]? "First": "Second"));
	return 0;
};

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#define N 300000
using namespace std;


bool p[N];
int num[N];

int main(){

  for(int i=0;i<N;i++)p[i] = true;
  p[0] = p[1] = false;

  for(int i=2;i*i<N;i++){
    if(p[i]){
      for(int j=2*i;j<N;j+=i)p[j] = false;
    }
  }

  vector<int> v;
  int sum = 0,pos = 0;
  while(v.size()<10000){
    if(p[pos]){
      sum += pos;
      v.push_back(sum);
    }
    pos++;
  }

  int n;
  while(cin >> n ,n)cout << v[n-1] << endl;
  
}

Measured memory_bytes: 0
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int A, B;
        A = cin.nextInt();
        B = cin.nextInt();
        if (is3(A) || is3(B) || is3(A + B)) Console.WriteLine("Possible");
        else Console.WriteLine("Impossible");
    }

    bool is3(int a)
    {
        return a % 3 == 0;
    }
    

    

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
using System;
using System.Linq;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    int C = int.Parse(input[2]);
    Console.WriteLine((A == B) ? C : (A ==C) ? B : A);
  }
}

Measured memory_bytes: 13140
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ans=0,cnt; cin>>n;
    vector<int> x(n,0),y(n,0);
    rep(i,n) cin>>x[i];
    rep(i,n) cin>>y[i];
    rep(i,n){
        cnt=0;
        for(int j=0;j<n-i;j++) cnt+=x[j];
        for(int j=n-i-1;j<n;j++) cnt+=y[j];
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

int main(){
    int n, k;
    while( cin >> n >> k ){
        int cnt = 0;
        while( n ){
            cnt++;
            n /= k;
        }
        cout << cnt << "\n";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10 ;
int main(){
    int n ;
    cin >> n ;
    vector<int> v(n) ;
    vector<int> cnt(MAXN) ;
    for(int i=0;i<n;i++){
        cin >> v[i] ;
        cnt[v[i]]++;
        cnt[v[i]+1]++;
        cnt[ ((v[i]-1)%MAXN+MAXN)%MAXN ]++;
    }
    cout << *max_element(cnt.begin(),cnt.end()) << endl;
    return 0 ;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

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

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

int main(){
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  if(n == 0) cout << 1 << endl;
  else if(n == 1) cout << 2 << endl;
  else if(n == 2) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 1196
/*/**/

#include <bits/stdc++.h>

using namespace std;

int a[100021];

int main() {
	int n;
	scanf("%d", &n);
	long long ans = 0;
	scanf("%d", a);
	ans += a[0] / 2;
	bool have = a[0] % 2;
	for(int i = 1; i < n; i++) {
		scanf("%d", a + i);
		ans += a[i] / 2;
		if(not a[i]) {
			have = false;
		}
		else if(a[i] & 1) {
			if(have) {
				ans++;
				have = false;
			}
			else {
				have = true;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

using namespace std;

constexpr static int MAXN = 2e5;

int R, C, N;
int x1[MAXN], y1[MAXN], x2[MAXN], y2[MAXN];

int calc_idx(int x, int y) {
    if (y == 0)
        return x;
    if (x == R)
        return R + y;
    if (y == C)
        return R + C + (R - x);
    if (x == 0)
        return R + C + R + (C - y);
    assert(false);
}

bool on_edge(int x, int y) {
    return (x == 0 || x == R) || (y == 0 || y == C);
}

bool check() {
    vector <pair <int, int>> ivals;
    for (int i = 0; i < N; i++)
        if (on_edge(x1[i], y1[i]) && on_edge(x2[i], y2[i])) {
            int j1 = calc_idx(x1[i], y1[i]);
            int j2 = calc_idx(x2[i], y2[i]);
            //cout << "e: " << i << " " << j1 << " " << j2 << endl;
            if (j1 > j2)
                swap(j1, j2);
            ivals.push_back({j1, j2});
        }

    // chords on a circle
    sort(ivals.begin(), ivals.end());
    vector <int> cur;
    for (int i = 0; i < ivals.size(); i++) {
        while (cur.size() != 0) {
            int j = cur.back();
            bool c1 = (ivals[i].first > ivals[j].first
                    && ivals[i].first < ivals[j].second);
            bool c2 = (ivals[i].second > ivals[j].first
                    && ivals[i].second < ivals[j].second);
            if (c1 ^ c2)
                return false;
            if (c1 && c2)
                break;
            cur.pop_back();
        }
        cur.push_back(i);
    }
    return true;
}

int main() {
    cin >> R >> C >> N;
    for (int i = 0; i < N; i++)
        cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    cout << (check() ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3060
var lines = [];
var result = 0;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0]);
    var a = lines[1].split(" ").map(value => Number(value));

    a.sort((a, b) => a - b);

    var counter = Array(N).fill(0);
    var j = 0;

    counter[0] = [a[0], 1];

    for (var i = 1; i < N; i++) {
        if (a[i] !== a[i - 1]) { j++; counter[j] = [a[i], 1] }
        else { var cnt = counter[j][1] + 1; counter[j] = [a[i], cnt]; }
    }

    for (var i = 0; i < counter.length; i++) {

        if (counter[i][0] === counter[i][1]) { continue; }
        else {
            if (counter[i] === 0) { continue; }
            else {
                result += (counter[i][1] < counter[i][0] ? counter[i][1]: counter[i][1] - counter[i][0]);
            }
        }
    }
    console.log(result);
});

Measured memory_bytes: 51416
r1 = input().split(" ")
s = r1[0]
t = r1[1]
r2 = list(map(int,input().split(" ")))
a = r2[0]
b = r2[1]
u = input()

if s == u:
    print(str(a-1) + " " + str(b))
else:
    print(str(a) + " " + str(b-1))

Measured memory_bytes: 3064
import java.util.*;

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

    int n = sc.nextInt();
    int[] w = new int[n + 1];

    int sum = 0;
    for (int i = 1; i <= n; i++) {
      w[i] = sc.nextInt();
      sum += w[i];
    }

    int s1 = 0;
    int s2 = 0;
    int ans = sum;
    for (int i = 1; i <= n; i++) {
      s1 += w[i];
      s2 = sum - s1;
      ans = Math.min(ans, Math.abs(s2 - s1));
    }
    
    System.out.println(ans);
  }
}


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

int main(){
    
    while(1){
        int h,w;
        cin >> h >> w;
        
        if (h == 0 && w == 0){ break; }
       
        for (int i=0; i < h; i++){
            for (int j=0; j < w; j++){
                if ((j+i) % 2 == 0){
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  int i,j,n,sum=0,x,y,a,b,sum1=0,p,m=0,h;
    cin>>p;
    while(p--)
    {
       cin>>x;
       if(x%2==0)
       {
           if(x%3==0||x%5==0)
           {
               continue;
           }
           else
           {
               m=-1;
               break;
           }
       }
    }

    if(m!=-1)
    {
        cout<<"APPROVED"<<endl;
    }

    else
    {
       cout<<"DENIED"<<endl;
    }



    return 0;

}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

x, a, b = ri(), ri(), ri()
print((x-a)%b)















Measured memory_bytes: 27052
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Satoshi
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            int q = Partition(a, 0, n - 1);
            var sb = new StringBuilder();
            for (int i = 0; i < n; i++)
            {
                if (i == q)
                {
                    sb.Append("[");
                }
                sb.Append(a[i]);
                if (i == q)
                {
                    sb.Append("]");
                }
                if (i != n - 1)
                    sb.Append(" ");
            }
            string ans = sb.ToString();
            Console.WriteLine(ans);

        }

        public static int Partition(int[] a, int p, int r)
        {
            int x = a[r];
            int i = p - 1;
            for (int j = p; j < r; j++)
            {
                if (a[j] <= x)
                {
                    i++;
                    int tmp = a[i];
                    a[i] = a[j];
                    a[j] = tmp;
                }           
            }
            int temp = a[i + 1];
            a[i + 1] = a[r];
            a[r] = temp;
            return i + 1;
        }
    }
}

Measured memory_bytes: 18312
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
void Chocolate() {
	int N, D, X;
	cin >> N >> D >> X;
	int res = 0;
	for (size_t i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		int s = 1;
		while (s <= D)
		{
			res++;
			s += a;
		}
	}
	cout << (res + X) << endl;
}
int main() {
	Chocolate();
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  if (n == 1) {
    cout << "Hello World";
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
// const int M = 1000000007;
const int M = 1046527;
typedef tuple<int,int, int> P;


struct point{
    double x,y;
    point operator-(const point p1){
        point res(*this);
        double rx,ry;
        rx = res.x-p1.x;
        ry = res.y-p1.y;
        point pp;
        pp.x = rx;pp.y=ry;
        return pp;
    }
};
typedef pair<point,point> PP;

void cosh(int n, point p1, point p2){
    if(n==0){
        
        
        return;
    }
    point s,u,t;
    double length = sqrt(pow(std::abs(p1.x-p2.x),2)+pow(std::abs(p1.y-p2.y),2))/3;
    // s.x += length;s.y += length;
    // 行列の演算を行う
    double th = M_PI*60/180;
    s.x=(2*p1.x+p2.x)/3;
    s.y=(2*p1.y+p2.y)/3;
    t.x=(p1.x+2*p2.x)/3;
    t.y=(p1.y+2*p2.y)/3;
    u.x = (cos(th))*(t.x-s.x) -sin(th)*(t.y-s.y) + s.x;
    u.y = (sin(th))*(t.x-s.x) + (cos(th))*(t.y-s.y) + s.y;
    
    cosh(n-1,p1,s);
    printf("%.10f %.10f\n", s.x, s.y);
    cosh(n-1,s,u);
    printf("%.10f %.10f\n", u.x, u.y);
    cosh(n-1,u,t);
    printf("%.10f %.10f\n", t.x, t.y);
    cosh(n-1,t,p2);
}

int main(){
    int n;
    cin >> n;
    point p1,p2;
    p1.x=0;p1.y=0;
    p2.x=100;p2.y=0;
    printf("%.8f %.8f\n", p1.x, p1.y);
    cosh(n,p1,p2);
    printf("%.8f %.8f\n", p2.x, p2.y);
    return 0;
}


Measured memory_bytes: 3232
using System;

namespace abc158A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            if (A == "AAA" || A == "BBB")
            {
                Console.WriteLine("No");
            }
            else
                Console.WriteLine("Yes");
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1L << 30
#define long int64_t

long N;

int main(){
  cin >> N;
  vector<long> P(N);
  rep(i, N) cin >> P.at(i);

  long ans = 0;
  long min =INF;
  rep(i, N){
    long P_i = P.at(i);
    
    if (P_i <= min){
      ans ++;
      min = P_i;
    } 

  }
  cout << ans++ << endl;


}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define lli long long int
int main(){
	int n,k;
	cin>>n>>k;
	vector<int> a(n+1);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<vector<int> > dp(n,vector<int>(k+1));
	vector<vector<lli> > prefix(n,vector<lli>(k+1,0));
	for(int i=0;i<n;i++){
		dp[i][0]=1;
		prefix[i][0]=1;
	}
	for(int j=1;j<=a[0];j++){
		dp[ 0][j]=1;
		prefix[0][j]=prefix[0][j-1]+1;
	}
	for(int j=a[0]+1;j <=k;j++){
		prefix[0][j]=prefix[0][j-1];
	}
	
	for(int i=1;i<n;i++){
		for(int j=1;j<=k;j++){
			dp[i][j]=((prefix[i-1][j]-(j-a[i]-1>=0?prefix[i-1][j-a[i]-1]:0))+mod)%mod;
			prefix[i][j]=(prefix[i][j-1]+dp[i][j]);
			
		}
	}
	
	cout<<dp[n-1][k]<<endl;
}

Measured memory_bytes: 118648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,sum=0;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        long el;
        cin>>el;
        sum+=el;
    }
    if(sum<=n)
        cout<<n-sum;
    else
        cout<<"-1";
    return 0;
}

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

int main()
{   
    int h,w;
    while(1){
        cin >> h >> w;
        if (h == 0 && w ==0){
            break;
        }else{
            string s = string(w,'#');
            string d = string(w-2,'.');
            cout << s << endl;
            for(int i = 0;i<h-2;i++){
                cout << "#" << d << "#" << endl;
            }
            cout << s << endl;
            cout << endl;
        }

    }
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
#define INF 1e12
const int MOD = 1000000007;
typedef pair<ll,ll> P;

int main(void){
    double L;
    cin >> L;
    double ans;
    ans = L * L * L / 27;
    printf("%.8f",ans);
    //cout << pow(ans,3) << endl;
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
int a , b , c , d;
cin >> a >> b >> c >> d;
cout << max(a * b , c * d) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;

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

  int x;
  cin >> x;
  int a = x/500;
  int b = (x%500)/5;
  cout << a*1000+b*5 << endl;
  return 0;
  
}


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

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		String S = sc.get();
		Pattern cont = Pattern.compile("(.)(\\1|(.\\1))");
		Matcher matcher = cont.matcher(S);
		if (!matcher.find()) {
			System.out.println("-1 -1");
			return;
		}
		MatchResult result = matcher.toMatchResult();
		System.out.printf("%d %d%n", result.start() + 1, result.end());
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	}
}


Measured memory_bytes: 25352
#include<iostream>
using namespace std;
#define f(i,a,b) for(int i=a;i<=b;++i)
int main()
{
	int x,y;
	cin>>x>>y;
	if(x*4>=y&&x*2<=y&&y%2==0) cout<<"Yes";
	else cout<<"No";
	return 0;
 } 

Measured memory_bytes: 3588
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
using namespace std;
using ll = long long;
int main()
{
	ll a, b = 0, c = 0, d = 0;
	cin >> a;
	char C;
	char s[1000];
	for (int i = 0; i < a; i++)
	{
		cin >> C;
		s[i] = C;
		if (C == ')')
		{
			if (d == 0)
			{
				b++;
			}
			else
			{
				d--;
			}
		}
		else
		{

			{
				d++;
			}
		}
	}
	for (int i = 0; i < b; i++)
	{
		cout << '(';
	}
	for (int i = 0; i < a; i++)
	{
		cout << s[i];

	}
	for (int i = 0; i < d; i++)
	{
		cout << ')';

	}
	cout << endl;

	return 0;
}

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

int main()
{
  int n, last = -1, ans = 0;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for(int i=0; i<n; i++)
    cin >> a[i];
  for(int i=0; i<n; i++)
    cin >> b[i];
  c[0] = 0;
  for(int i=1; i<n; i++)
    cin >> c[i];
  
  for(int i=0; i<n; i++)
  {
    int ai = a[i] - 1;
    if(ai - 1 == last)
      ans += b[ai] + c[ai];
    else
      ans += b[ai];
    
    last = ai;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
import java.util.Scanner;
class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		char[] a=s.next().toCharArray(),b=s.next().toCharArray();
		System.out.println(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]?"YES":"NO");
	}
}

Measured memory_bytes: 22868
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

static const int INF = 1001001001;

using namespace std;

long long func(long long a, long long b)
{
    if (b % a == 0) {
        return 2*a*(b/a) - a;
    } else {
        return 2*a*(b/a) + func(b%a, a);
    }
}

int main()
{
    long long n, x, ans;
    cin >> n >> x;
    if (2*x < n) {
        ans = n + func(x, n - x);
    } else {
        ans = n + func(n - x, x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 510000;
const int INF = 1e9;
const double pi=acos(-1);
int a[3][3];
int main(){
  rep(i,3){
    rep(j,3){
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  rep(i,n){
    int b;
    cin >> b;
    rep(j,3){
      rep(k,3){
        if(a[j][k]==b)a[j][k]=-1;
      }
    }
  }
  bool bingo = false;
  if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1) bingo = true;
  if(a[2][0]==-1 && a[1][1]==-1 && a[0][2]==-1) bingo = true;
  if(a[0][0]==-1 && a[0][1]==-1 && a[0][2]==-1) bingo = true;
  if(a[1][0]==-1 && a[1][1]==-1 && a[1][2]==-1) bingo = true;
  if(a[2][0]==-1 && a[2][1]==-1 && a[2][2]==-1) bingo = true;
  if(a[0][0]==-1 && a[1][0]==-1 && a[2][0]==-1) bingo = true;
  if(a[0][1]==-1 && a[1][1]==-1 && a[2][1]==-1) bingo = true;
  if(a[0][2]==-1 && a[1][2]==-1 && a[2][2]==-1) bingo = true;
  if(bingo) cout << "Yes"<< endl;
  else cout << "No" << endl;
  return 0;
}


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

int main()
{
     int a[3];
     int sum=0;
     scanf("%d %d %d",&a[0],&a[1],&a[2]);
     for(int i=0;i<2;i++)
        for(int j=i+1;j<=2;j++)
     {

         if(a[i]!=a[j]) sum++;
     }
     if(sum==0) printf("1\n");
     else printf("%d\n",sum);
     return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string top2[4] = {"SS", "SW", "WS", "WW"};
    for (int k = 0; k < 4; k++) {
        string ans = "";
        ans += top2[k];
        for (int i = 1; i < n; i++) {
            if (s[i] == 'o') {
                if (ans[i] == 'S') {
                    ans += ans[i - 1];
                } else {
                    ans += ans[i - 1] == 'S' ? 'W' : 'S';
                }
            } else {
                if (ans[i] == 'W') {
                    ans += ans[i - 1];
                } else {
                    ans += ans[i - 1] == 'S' ? 'W' : 'S';
                }
            }
        }
        if (ans[0] == ans[n]) {
            if (s[0] == 'o') {
                if (ans[0] == 'S') {
                    if (ans[1] == ans[n - 1]) {
                        cout << ans.substr(0, n);
                        return 0;
                    }
                } else {
                    if (ans[1] != ans[n - 1]) {
                        cout << ans.substr(0, n);
                        return 0;
                    }
                }
            } else {
                if (ans[0] == 'W') {
                    if (ans[1] == ans[n - 1]) {
                        cout << ans.substr(0, n);
                        return 0;
                    }
                } else {
                    if (ans[1] != ans[n - 1]) {
                        cout << ans.substr(0, n);
                        return 0;
                    }
                }
            }
        }

    }

    cout << -1 << endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	vector<int> p(n);
	for(int i =0;i<n;i++){
		cin>>p.at(i);
	}
	int ans = 0;
	for(int i=1;i<n-1;i++){
		if (((p.at(i-1)<p.at(i))&&(p.at(i)<p.at(i+1))) ||((p.at(i-1)>p.at(i))&&(p.at(i)>p.at(i+1)))){
			ans+=1;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256