akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
char m[200][200];
int main()
{
	int mx, my;
	scanf("%d%d", &mx, &my);
	for (int i = 0; i <= mx + 2; i++)for (int j = 0; j <= my + 2; j++)m[i][j] = '#';
	for (int i = 0; i < mx; i++)for (int j = 0; j < my; j++)scanf(" %c", &m[i + 1][j + 1]);
	for (int i = 0; i < mx + 2; i++)
	{
		for (int j = 0; j < my + 2; j++)printf("%c", m[i][j]); printf("\n");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int h,w;
char c[2000][2000];
int l[2000][2000],r[2000][2000],u[2000][2000],d[2000][2000];
int ans;
int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>c[i][j];
    for(int i=0;i<h;i++){
        if(c[i][0]=='.')l[i][0]=1;
        if(c[i][w-1]=='.')r[i][w-1]=1;
    }for(int j=0;j<w;j++){
        if(c[0][j]=='.')u[0][j]=1;
        if(c[h-1][j]=='.')d[h-1][j]=1;
    }for(int i=0;i<h;i++){
        for(int j=1;j<w;j++)if(c[i][j]=='.')l[i][j]=l[i][j-1]+1;
        for(int j=w-2;j>=0;j--)if(c[i][j]=='.')r[i][j]=r[i][j+1]+1;
    }for(int j=0;j<w;j++){
        for(int i=1;i<h;i++)if(c[i][j]=='.')u[i][j]=u[i-1][j]+1;
        for(int i=h-2;i>=0;i--)if(c[i][j]=='.')d[i][j]=d[i+1][j]+1;
    }
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)ans=max(ans,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 66688
#include<iostream>
#include<algorithm>

using namespace std;

#define NIL -1
#define INF 10000001

struct node{
  int key = INF;
};

node grf[100];
int hv[100][100], n;

void search(){
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            if(hv[i][j] == NIL){
                continue;
            }
            if(grf[i].key + hv[i][j] < grf[j].key){
                grf[j].key = grf[i].key + hv[i][j];
            }
        }
    }
    return;
}

int main(){
    for(int i=0;i<100;++i){
        for(int j=0;j<100;++j){
            hv[i][j] = NIL;
        }
    }
    
    int p, token, vtal=0;
    cin >> n;
    
    for(int i=0;i<n;++i){
        cin >> p;
        cin >> p;
        vtal += p;
        for(int j=0;j<p;++j){
            cin >> token;
            cin >> hv[i][token];
        }
    }
    
    
    grf[0].key = 0;
    for(int i=0;i<vtal;++i){
        search();
    }
    
    
    for(int i=0;i<n;++i){
        cout << i << " " << grf[i].key << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3128
class Dice:
    N = [0, 1, 5, 4]
    S = N[::-1]
    E = [0, 3, 5, 2]
    W = E[::-1]
    R = [1, 2, 4, 3]
    L = R[::-1]

    def __init__(self, numbers):
        self.numbers = numbers

    def toX(self, x):
        data = getattr(self, x)
        self.numbers.append(0)
        for k in range(5):
            i1 = data[k - 1] if k != 0 else 6
            i2 = data[k] if k != 4 else 6
            self.numbers[i1] = self.numbers[i2]
        del self.numbers[6]

    def setTopandFront(self, top, front):
        while self.numbers[0] != top:
            if self.numbers.index(top) in self.N:
                self.toX('N')
            else:
                self.toX('E')
        while self.numbers[1] != front:
            self.toX('R')

dice = Dice([int(i) for i in input().split()])
for _ in range(int(input())):
    top, front = map(int, input().split())
    dice.setTopandFront(top, front)
    print(dice.numbers[2])



Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main()
{
  int N;cin>>N;
  string S,T;cin>>S>>T;
  
  vector<char> ret;
  for (int i=0;i<N;i++)
  {
    ret.push_back(S[i]);
    ret.push_back(T[i]);
  }

  for (int i=0;i<ret.size();i++)
    cout<<ret[i];
  cout<<endl;
}

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

int main() {
  int a , b , c ;
  cin >> a >> b >> c;
  if ( a == b && b == c ) cout << 1 << endl;
  else if (a != b && a != c && b != c) cout << 3 << endl;
  else cout << 2 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000000LL;
const int MAX=100001;
const double EPS=1e-10;
struct UnionFind{
    int par[100000];//親
    int fukasa[100000];//深さ
    UnionFind(){};
    //初期化
    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            fukasa[i]=0;
        }
    }
    //木の根を求める
    int find(int x){
        if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
    }
    //xとyの集合を併合
    void unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y){
            return;
        }
        if(fukasa[x]<fukasa[y]){
            par[x]=y;
        }else{
            par[y]=x;
            if(fukasa[x]==fukasa[y]){
                fukasa[x]++;
            }
        }
    }
    //xとyが同じ集合に属する?
    bool same(int x,int y){
        return find(x)==find(y);
    }
};
int main(){
    UnionFind uf;
    int n,m;
    cin>>n>>m;
    uf.init(n);
    int a[60],b[60];
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
    }
    int ans=0;
    for(int i=0;i<m;i++){
        uf.init(n);
        for(int j=0;j<m;j++){
            if(i==j){
                continue;
            }
            uf.unite(a[j],b[j]);
        }
        set<int> st;
        for(int k=0;k<n;k++){
            st.insert(uf.find(k));
        }
            if(st.size()>1){
                ans++;
            }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<tr1/unordered_map>
#include<queue> 
#include<list> 
#include<cmath>
#include<algorithm>
#include<string> 
#include<time.h>
using namespace std;
using namespace std::tr1;

bool noOdd(int a, int b, int c){
	if((a&1) || (b&1) || (c&1))	return false;
	return true;
}

bool equal(int a, int b, int c){
	return a==b && b==c;
}
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	int res = 0;
	while(noOdd(a,b,c) && !equal(a, b, c)){
		int a1 = a/2;
		int b1 = b/2;
		int c1 = c/2;
		a = b1+c1;
		b = a1+c1;
		c = a1+b1;
		res++;
	} 
	if(!noOdd(a, b, c))	cout << res <<endl;
	else
		cout<<-1<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
LL n,k;
int main()
{
	LL ans=0;scanf("%lld %lld",&n,&k);
	if(k==0) {printf("%lld",n*n);return 0;}
	for(LL i=k+1;i<=n;i++)
	{
		LL t=n/i,y=n%i;
		if(y>=k)
		{
			if(y==0) ans+=t*(y-k+1);
			else ans+=(t+1)*(y-k+1);
		}
		ans+=t*(i-1-max(k,y));
		if(y<k) ans+=t;
		//printf("%lld %lld\n",i,ans);
	}
	printf("%lld\n",ans);
}

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

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define pi pair <int, int>
#define sz(x) (int)((x).size())
#define int long long


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

const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 3e3 + 11;
const ll INF64 = 3e18 + 1;
const double lil = 0.0000000000001;

int n, dp[N][N], pref[N], l, r;

string s;


int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();

    cin >> n;

    cin >> s;

    dp[1][1] = 1;

    for(int i = 2; i <= n; i++){

        pref[0] = 0;

        for(int j = 1; j <= n; j++){
            pref[j] = (dp[i-1][j] + pref[j - 1] + mod) % mod;
        }

        for(int j = 1; j <= i; j++){

            if(s[i - 2] == '<'){
                l = 1; r = j - 1;
            }else{
                l = j; r = n;
            }

            if(l > r)continue;

            dp[i][j] = (pref[r] - pref[l - 1] + mod) % mod;
        }

    }

    int ans = 0;

    for(int i = 1; i <= n; i++)ans += (dp[n][i] + mod) % mod;

    rc((ans + mod) % mod);


}

Measured memory_bytes: 69248
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	cout << (char)(s1[0] - 'a' + 'A') << (char)(s2[0] - 'a' + 'A') << (char)(s3[0] - 'a' + 'A') << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  cin >> n >> m >> l;
  s = "NO";
  lep(i,1,1000){
    if(i * n % m == l)s = "YES";
  }
  print(s);
  return 0;
}

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

const int inf = 1e9;

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int ans;
    if(a+b <= 2*c) ans = a*x + b*y;
    else{
        if(x >= y) ans = min(2*c*x, 2*c*y+a*(x-y));
        else ans = min(2*c*y,2*c*x+b*(y-x));
    }
    cout << ans << endl;

}


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

int main(){
  std::string str;
  int cnt = 0;
  std::cin >> str;
  for(int i = 0; i < str.length(); i++){
    if(str[i] == 'o') cnt++;
  }
  if(15 - str.length() >= 8 - cnt){
    std::cout << "YES";
  }
  else{
    std::cout << "NO";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int s(int x) {
  int sum = 0;
  while(x) {
    sum += x%10;
    x /= 10;
  }
  return sum;
}

int main()
{
  int n;
  cin>>n;
  int mn = 10000;
  FOR(a,1,n) {
    int b = n-a;
    mn = min(mn, s(a) + s(b));
  }
  cout << mn << endl;
  return 0;
}


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

int main(){
	double f;
	int a,b,d,r;
	cin >> a >> b;
	
	d = a / b;
	r = a % b;
	f = (double)a / b;
	cout << d << " " << r << " " << fixed << f << endl;
	
	return 0;
}

Measured memory_bytes: 3228
import java.util.*;

class Main {
	public static void main(String[] arg){
		Scanner in = new Scanner(System.in);
			int n = in.nextInt();	
			int[] a = new int[n];
			for(int i=0;i<n;i++){
				a[i] = in.nextInt();
			}
			for(int j=0;j<n;j++){
				System.out.print(a[n-j-1]);
				if(j==n-1){
					System.out.println();
				}
				else{
					System.out.print(" ");
				}
			}	
	}
}

Measured memory_bytes: 19652
#include<stdio.h>

int main() {
	int i;
	int a, b, c;
	scanf("%d %d %d",&a,&b,&c);
	for (i = 1; i <= 10; i++) {
		c = a * c - b;
		printf("%d\n", c);
	}









	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<vector>

int main(void){
    std::vector<int> ns(1500), ms(1500);
    std::map<int, int> nc, mc;
    while(1){
        int nl, ml;
        std::cin >> nl >> ml;
        if(nl == 0 || ml == 0) break;
        for(int i = 0; i != nl; i++) std::cin >> ns[i];
        for(int i = 0; i != ml; i++) std::cin >> ms[i];
        nc.clear(); mc.clear();
        for(int i = 0; i != nl; i++)
            for(int acc = 0, j = i; j != nl; j++){
                acc+=ns[j];
                nc[acc]++;
            }
        for(int i = 0; i != ml; i++)
            for(int acc = 0, j = i; j != ml; j++){
                acc+=ms[j];
                mc[acc]++;
            }
        int r = 0;
        for(std::map<int, int>::iterator it = nc.begin(); it != nc.end(); it++)
            r += (*it).second * mc[(*it).first];
        std::cout << r << std::endl;
    }
    return 0;
}

Measured memory_bytes: 32464
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

string s;
int ps[500000];
int n, m;

signed main()
{
    cin >> n >> m;
    cin >> s;
    for (int i = 0; i + 1 < s.size(); i++)
    {
        if (s[i] == 'A' && s[i + 1] == 'C')
        {
            ps[i] = 1;
        }
    }
    for (int i = 1; i + 1 < s.size(); i++)
    {
        ps[i] += ps[i - 1];
    }
    while (m--)
    {
        int l, r;
        cin >> l >> r;
        l--, r--;
        cout << (r > 0 ? ps[r - 1] : 0) - (l > 0 ? ps[l - 1] : 0) << "\n";
    }
}


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

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(v) (v).begin(),(v).end()
#define endl '\n'

using namespace std;

const int N = 200005;
const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, l, cur = 0, x, res = 1;
    cin >> n >> l;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        cur += x;
        res += cur <= l;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 10000
using namespace std;
long long mod=998244353;
int n,s;
int a[maxn];
long long wss[maxn];
long long tw[maxn];
long long ps[maxn];
long long rem;
int main() {
    scanf("%d %d",&n,&s);
    for(int i=0;i<n;i++) {
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++) {
        for(int i=0;i<=s;i++) tw[i]=wss[i];
        tw[a[i]]+=(i+1);
        for(int j=a[i];j<=s;j++) {
            tw[j]+=wss[j-a[i]];
        }
        rem=rem+((n-i)*(tw[s]-wss[s]))%mod;
        for(int i=0;i<=s;i++) {
            wss[i]=tw[i]%mod;
            tw[i]=wss[i];
        }
    }
    rem+=mod;
    rem%=mod;
    printf("%lld",rem);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int p[8];
	int q[8]={1,2,1,2,1,4,1,4};
	int ans[8][8];
	int waitnum[8];
	while(1){
		for(int i=0;i<8;i++){
			if(scanf("%d",&p[i])==EOF){
				return 0;
			}
		}
		for(int i=0;i<8;i++){	//iは回答のナンバー　並べ方
			for(int j=0;j<8;j++){
				ans[i][j]=q[(i+j)%8];
			}
			waitnum[i]=0;
			for(int j=0;j<8;j++){
				int tmp=p[j]-ans[i][j];
				if(tmp<=0){
					tmp = 0;
				}
				waitnum[i]+=tmp;
			}
		}
		int min=0;
		for(int i=1;i<8;i++){
			if(waitnum[i]<waitnum[min]){
				min=i;
			}
			else if(waitnum[i]==waitnum[min]){
				for(int j=0;j<8;j++){
					if(ans[i][j]<ans[min][j]){
						min=i;
						break;
					}else if(ans[i][j]>ans[min][j]){
						break;
					}
				}
			}
		}
		printf("%d",ans[min][0]);
		for(int i=1;i<8;i++){
			printf(" %d",ans[min][i]);
		}
		printf("\n");
	}
	return 0;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int x = cin.Int();
			int num = x / 100;
			int r = x % 100;
			int need = r / 5;
			if (r % 5 != 0) {
				need += 1;
			}

			if (need > num) {
				Console.WriteLine(0);
			} else {
				Console.WriteLine(1);
			}
		}
	}


	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

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

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

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

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

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

const int64_t MOD = 1e9+7;
void add(int64_t &a, int64_t b) {
    a = (a+b) % MOD;
}
void mul(int64_t &a, int64_t b) {
    a = a*b % MOD;
}

int64_t dp[201][1000001];

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> S(n);
    for(int i = 0; i < n; ++i) { cin >> S[i]; }
    sort(S.rbegin(), S.rend());
    dp[0][x] = 1;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j <= 100000; ++j) {
            add(dp[i+1][j%S[i]], dp[i][j]);
            add(dp[i+1][j], dp[i][j] * (n-i-1));
        }
    }

    int64_t ans = 0;
    for(int j = 0; j <= 100000; j++) { add(ans, j*dp[n][j]); }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 569600
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
 
int main() {
    int H, W;
    char S[60][60];
    cin >> H >> W;
    
    rep(i,0, H){
        cin >> S[i];
    }
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1, -1};
    rep(i,0, H){
        rep(j,0, W){
            if (S[i][j] == '#'){
                bool found = false;
                rep(k, 0, 4){
                    int i2 = i+dx[k];
                    int j2 = j+dy[k];
                    if(i2 >=0 && i2<H && j2 >= 0 && j2<W && S[i2][j2] == '#') {
                        found = true;
                    }
                }
                if (!found) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main() {
    int N; std::cin >> N;
    for (auto i{ 1 }; i < 10; ++i)
        for (auto j{ 1 }; j < 10; ++j)
            if (i * j == N) {
                std::cout << "Yes";
                return 0;
            }

    std::cout << "No" << std::endl;
    return 0;
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int u = max(a, c);
  int l = min(b, d);

  if (l - u < 0) cout << 0 << endl;
  else cout << l - u << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

	int N, A[100];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  int ret = 0;
  for(int i = 1; i < N; i++) {
    if(A[i - 1] == A[i]) {
      A[i] = 1000 + i;
      ret++;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{;
    int a, n;
    double ias = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        ias += (double)1 / a;
    }
    cout << 1 / ias << endl;
    return 0;
}

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

typedef long long ll;

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
       const int INF=1e9+7;
       int n;
       cin>>n;
       vector<double>arr(n+1);
       for(int i=1;i<=n;i++)cin>>arr[i];

   vector<vector<double>>ans(n+1,vector<double>(n+1));
   ans[0][0]=1;
   for(int i=1;i<=n;i++)ans[i][0]=ans[i-1][0]*(1-arr[i]);

for(int i=1;i<=n;i++)
{
  for(int j=1;j<=i;j++)
  {
      ans[i][j]=(1-arr[i])*ans[i-1][j]+(arr[i])*ans[i-1][j-1];
  }
}

double total_prob=0;

for(int j=(n+1)/2;j<=n;j++)
{
  total_prob+=ans[n][j];
}

cout<<fixed<<setprecision(15)<<total_prob<<"\n";

return 0;

}




Measured memory_bytes: 70784
#include "bits/stdc++.h"
using namespace std;
#define int long long

signed main() {
	int n, q;
	string s;
	cin >> n >> q >> s;

	vector<int> l(q);
	vector<int> r(q);
	for (size_t i = 0; i < q; ++i)
	{
		cin >> l[i];
		cin >> r[i];
	}

	vector<int> danpen(n+1);
	int cnt2 = 0;
	for (size_t j = 1; j < n+1; ++j)
	{
		if (s.substr(j - 1, 2) == "AC") {
			danpen[j] = danpen[j - 1] + 1; //j文字目のACの数
		}
		else {
			danpen[j] = danpen[j - 1];
		}
	}
	for (size_t i = 0; i < q; ++i)
	{
		cout << danpen[r[i] - 1] - danpen[l[i] - 1] << endl;
	}
}




Measured memory_bytes: 3456
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	g := make([][]Edge, n)
	for i := 0; i < n; i++ {
		g[i] = make([]Edge, 0)
	}

	var a, b int
	for i := 0; i < n-1; i++ {
		fmt.Scan(&a, &b)
		a, b = a-1, b-1
		g[a] = append(g[a], Edge{b, i})
		g[b] = append(g[b], Edge{a, i})
	}

	max, colors := calc(g)

	fmt.Println(max)
	for i := 0; i < n-1; i++ {
		fmt.Println(colors[i])
	}
}

// Edge .
type Edge struct {
	to, id int
}

func calc(g [][]Edge) (int, []int) {
	max := 0
	colors := make([]int, len(g)-1)

	var dfs func(v, c, p int)
	dfs = func(v, c, p int) {
		k := 1
		for _, vv := range g[v] {
			u, ei := vv.to, vv.id
			if u == p {
				continue
			}
			if k == c {
				k++
			}
			colors[ei] = k

			if max < k {
				max = k
			}
			k++

			dfs(u, colors[ei], v)
		}
	}
	dfs(0, -1, -1)

	return max, colors
}


Measured memory_bytes: 35328
import java.io.*;
        import java.util.Scanner;

public class Main{
    public static void main(String []args) throws IOException
    {
        Scanner sc = new Scanner(System.in);
        long  num = sc.nextLong();
        if(num%2==0 && num%num==0)
            System.out.println(num);
        else
            System.out.println(num*2);
    }
}

Measured memory_bytes: 23508
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

// ALDS1_6_B
public class Main {
	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 = i + 1;
				int tmp = A[i];
				A[i] = A[j];
				A[j] = tmp;
			}
		}
		int tmp = A[i + 1];
		A[i + 1] = A[r];
		A[r] = tmp;
		return i + 1;
	}
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = br.readLine().split(" ");
		int A[] = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(str[i]);
		}
		int q = partition(A, 0, n-1);
		StringBuilder build = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i != 0) build.append(" ");
			if (q == i) build.append("[" + A[i] + "]");
			else build.append(A[i]);
		}
		System.out.println(build);
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}



Measured memory_bytes: 40492
function Main(s){
  s = s.split("\n");
  var n = s[0].split(" ").map(a=>+a);
  var m = n[1]; n = n[0];
  var a = s[1].split(" ").map(a=>+a);
  var ans = 0;
  var b = {};
  var t = 0;
  for(var i = 0; i < n; i++){
    t = (t + a[i]) % m;
    if(b[t])b[t]++; else b[t] = 1;
  }
  for(i in b){
    i = +i;
    if(i === 0)ans += b[i] * (b[i]+1) / 2;
    else if(b[i] > 1)ans += b[i] * (b[i]-1) / 2;
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int card[100001] = {};

int main(){
    int n,m,ans = 0;
    vector<int> l,r;
    cin >> n >> m;

    REP(i,m){
        int a,b;
        cin >> a >> b;
        l.pb(a);
        r.pb(b);
    }

    sort(l.begin(),l.end(),greater<int>());
    sort(r.begin(),r.end());

    cout << max(0,(r[0]-l[0]+1)) << endl;
    return 0;

}


Measured memory_bytes: 1276
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>
#include<string>
#include<queue>
#include<set>
#include<stack>
#include<map>

using namespace std;

int main(){
    int N;
    cin>>N;
    long long a[200000],b[200000];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    for(int i=0;i<N;i++){
        cin>>b[i];
    }
    const int MAX_I=31;
    long long pow2[MAX_I];
    pow2[0]=1;
    for(int i=1;i<MAX_I;i++){
        pow2[i]=2*pow2[i-1];
    }
    long long ans=0;
    for(int k=0;k<MAX_I-1;k++){
        //ansのk桁目を求める
        long long modiA[200000],modiB[200000];
        for(int i=0;i<N;i++){
            modiA[i]=a[i]%pow2[k+1];
            modiB[i]=b[i]%pow2[k+1];
        }
        sort(modiB,modiB+N);
        long long tmp=0;
        for(int i=0;i<N;i++){
            //modiA[i]と足し合わせてk桁目が1になるmodiBの数を数える
            //「pow2[k]以上，2*pow2[k]未満」と「3*pow2[k]以上，4*pow2[k]未満」の2パターンある．
            long long x,y,z,w;
            x=pow2[k]-modiA[i];
            y=2*pow2[k]-modiA[i];
            z=3*pow2[k]-modiA[i];
            w=4*pow2[k]-modiA[i];
            long long* posX=lower_bound(modiB,modiB+N,x);
            long long* posY=lower_bound(modiB,modiB+N,y);
            long long* posZ=lower_bound(modiB,modiB+N,z);
            long long* posW=lower_bound(modiB,modiB+N,w);
            tmp += (posY-posX)+(posW-posZ);
            //cout<<k<<' '<<i<<' '<<(int)(posY-posX)<<' '<<(int)(posW-posZ)<<endl;
        }
        if(tmp%2==1){
            ans += pow2[k];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6528
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println("ABC" + in.next());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 23252
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

#ifdef DEBUG
#define Dump(x) cerr << #x << " = " << x << endl;
#else
#define Dump(x)
#endif


long get(long n, long m)
{
    long k_max = m / n;
    if (k_max == 1) return 1;

    long k = k_max;
    for (; k > 1; --k)
        if (m % k == 0)
            break;
    if (k == 1)
        return 1;
        
    Dump(k);
    return k * get(n, m / k);
}


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

    cout << get(N, M) << endl;
}


Measured memory_bytes: 256
H, W, A, B = map(int, input().split())
if W<=A or H<=B:
    print("No")
    exit()
K = "1"*A + "0"*(W-A)
L = "0"*A + "1"*(W-A)
for i in range(H):
    if i <= B-1:
        print(K)
    else:
        print(L)

Measured memory_bytes: 67448
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(m)]
G = Graph(ab)

for new_v in G[0]:
    if n in G[new_v - 1]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

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

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

  long long ans = 1;
  for (int i=1; i<=N; i++) {
    ans *= i;
    ans %= 1000000007;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		 int num = Integer.parseInt(a+b);
	for(int i=1;i<400;i++){
		if(i*i==num){
			System.out.println("Yes");
		    System.exit(0);
		}
	}
	System.out.println("No");
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   int x, a, b;
   cin >> x >> a >> b;

   if (abs(x - a) < abs(x - b))
   {
      cout << "A" << endl;
   }
   else
   {
      cout << "B" << endl;
   }
   return 0;
}


Measured memory_bytes: 636
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int n;

ll dp[100100][3] = {0};

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

int main(){
    cin >> n;
    int active[n][3];

    rep(i,n){
        rep(j,3){
            cin >> active[i][j];
        }
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){

                if(j==k) continue;
                chmax(dp[i+1][k] , dp[i][j] + active[i][k]);

            }
        }
    }

    ll ans =0;

    rep(i,3) chmax(ans, dp[n][i]);

    dunk(ans);
}

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

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = max(a * c, a * d);
  ans = max(ans, b * c);
  ans = max(ans, b * d);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main() {
    int N;
    cin>>N;
    vector< string > vec(2);
    cin>>vec[0]>>vec[1];
    
    long long otv=1;
    int i,las;
    if (vec[0][0]==vec[1][0]) {
        otv*=3;
        i=1;
        las=0;
    }
    else {
        otv*=6;
        i=2;
        las=1;
    }
    while (i<N) {
        if (vec[0][i]==vec[1][i]) {
            if (las==0){
                otv*=2;
                otv%=1000000007;
            }
            las=0;
            i++;
        }
        else {
            if (las==0) {
                otv*=2;
                otv%=1000000007;
            }
            else {
                otv*=3;
                otv%=1000000007;
            }

            las=1;
            i+=2;
        }
    }
cout<<otv;
return 0;
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

char str[200005];
int count_b;
long long ans;

int main(){
	scanf("%s", str);
	for(int i = 0; str[i]; i++){
		char c = str[i];
		if(c == 'B'){
			count_b++;
		}else{
			ans += count_b;
		}
	}
	
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

const int MAX = 1005;
int dp[MAX][MAX];

int edit_distance(const string& s1, const string& s2){
  memset(dp, 0, sizeof(dp));
  for(int i = 0; i <= (int)s1.size(); i++) dp[i][0] = i;
  for(int i = 0; i <= (int)s2.size(); i++) dp[0][i] = i;

  for(int i = 1; i <= (int)s1.size(); i++)
    for(int j = 1; j <= (int)s2.size(); j++){
      dp[i][j] = min(dp[i-1][j] + 1,
                     min(dp[i][j-1] + 1,
                         dp[i-1][j-1] + (s1[i-1]==s2[j-1]?0:1)));
    }
  return dp[s1.size()][s2.size()];
}

int main(){
  string s1, s2;
  cin >> s1 >> s2;
  cout << edit_distance(s1, s2) << endl;
  return 0;
}

Measured memory_bytes: 5144
#include <cstdio>
#include <cstdlib>
#include <algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1<<29;

int main(){
	int d,n; scanf("%d%d",&d,&n);
	int t[200],a[200],b[200],c[200];
	rep(i,d) scanf("%d",t+i);
	rep(i,n) scanf("%d%d%d",a+i,b+i,c+i);

	int dp[201][101];
	rep(i,d) rep(j,101) dp[i][j]=-INF;
	rep(k,n) if(a[k]<=t[0] && t[0]<=b[k]) dp[0][c[k]]=0;
	rep(i,d-1) rep(j,101) {
		rep(k,n) if(a[k]<=t[i+1] && t[i+1]<=b[k]) dp[i+1][c[k]]=max(dp[i+1][c[k]],dp[i][j]+abs(c[k]-j));
	}
	printf("%d\n",*max_element(dp[d-1],dp[d-1]+101));

	return 0;
}

Measured memory_bytes: 1112
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int X,Y,A,B,C;
   cin >> X >> Y >> A >> B >> C;
   vector<int> p(A),q(B),r(C);
   f(i,0,A){
      cin >> p[i];
   }
   f(i,0,B){
      cin >> q[i];
   }
   f(i,0,C){
      cin >> r[i];
   }
   sort(all(q),greater<int>());
   sort(all(p),greater<int>());
   sort(all(r),greater<int>());
   multiset<int> s;
   f(i,0,X){
      s.insert(p[i]);
   }
   f(i,0,Y){
      s.insert(q[i]);
   }
   f(i,0,C){
      s.insert(r[i]);
   }
   int ans = 0;
   for(auto &e : s) ans += e;
   int cnt = 0;
   for(auto &e : s){
      if(cnt == (int)s.size()-(X+Y)) break;
      ans -= e;
      cnt++;
   }
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 15744
#include<string>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include <iomanip>
#include<cmath>
#include<stack>
#include <algorithm>
#include<cstdio>
#include <cstring>
#include <iostream>
#define inf 0n7fffffff
using namespace std;
int main()
{
    int n,m;
    int i,j,k;;
    int a[15]={0};
    scanf("%d%d",&n,&k);
    for(i=0; i<k; i++)
    {
        scanf("%d",&m);
        a[m]++;
    }
    for(i=n;; i++)
    {
        int flag=1,c=i;
        while(c)
        {
            if(a[c%10]==1)
            {
                flag=0;
                break;
            }
            c/=10;
        }
        if(flag)
        {
            cout<<i;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
s = int(input())
M = None

def f(n):
	if n % 2 == 0:
		return int(n/2)
	else:
		return 3*n + 1

def a(n):
	if n==0:
		return 0
	if n==1:
		return s
	return f(a(n-1))

m=2
n=1
while a(m) != a(n): 
	if n + 1 < m :
		n += 1
	else:
		m += 1
		n  = 1

print(m) 

Measured memory_bytes: 3064
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        h: usize,
        w: usize,
        k: usize,
        c: [String; h],
    }

    let c: Vec<Vec<_>> = c.iter().map(|s| s.chars().collect::<Vec<char>>()).collect();
    let mut ans = 0;

    for mask_r in 0..1 << h {
        for mask_c in 0..1 << w {
            let mut black = 0;
            for i in 0..h {
                for j in 0..w {
                    if ((mask_r >> i) & 1 == 0) && ((mask_c >> j) & 1 == 0) && c[i][j] == '#' {
                        black += 1;
                    }
                }
            }
            if black == k {
                ans += 1;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    cout << s.substr(0, 3) << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>

int main()
{
    long double l;
    cin>>l;

    long double ans=pow(l/3,3);

    cout<< fixed<<setprecision(15)<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
double N;

int main() {
  INCANT;
  cin >> N;
  cout << pow(N/3, 3) << "\n";
  return 0;
}

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

int main() {
  string S,T;
  cin >> S >> T;
  int A = S.size();
  int count = 0;
  for(int i = 0;i < A;i++){
    if(S[i] != T[i]){
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	ll X;
	cin >> X;
	
	ll c = 100;
	int ans = 0;
	while (c < X) {
		c += c / 100;
		++ans;
	}
	
	cout << ans << endl;
	return 0;
}


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

//降順
int des(const void *a, const void *b)
{
  return *(int *)b - *(int *)a;
}

int main() {
  int N, K;
  cin >> N >> K;
  int l[N];
  for (int i=0; i<N; i++)
    cin >> l[i];
  qsort(l, N, sizeof(int), des);
  int ans = 0;
  for (int i=0; i<K; i++)
    ans += l[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;

int main() {

	//桁 + 総和 / 10 - 1
	long M; cin >> M;
	long res = 0;
	long sum = 0;
	for (int i = 0; i < M; i++) {
		long C, D; cin >> C >> D;
		res += D;
		sum += C * D;
	}
	res += (sum - 1) / 9;
	res--;

	cout << res << endl;
}

Measured memory_bytes: 256
card = [list(map(int, input().split())) for i in range (3)]
N = int(input())
b = [int(input()) for i in range(N)]

for k in range(N):
  for i in range(3):
    for j in range(3):
      if card[i][j] == b[k]:
        card[i][j] = 0
      
#print(card)

#bingo = False
for i in range(3):
  if card[i] == [0, 0, 0]:
    #bingo = True
    print("Yes")
    exit()
  elif [x[i] for x in card] == [0, 0, 0]:
    #bingo = True
    print("Yes")
    exit()
    
if [card[i][i] for i in range(3)] == [0, 0, 0]:
  #bingo = True
  print("Yes")
  exit()
elif [card[2-i][i] for i in range(3)] == [0, 0, 0]:
  #bingo = True
  print("Yes")
  exit()
else:
  #print("Yes" if bingo else "No")
  print("No")

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
int main() {
	int A, B, C, D; cin >> A >> B >> C >> D;
	int ans1 = A / D, ans2 = C / B;
	if (A % D != 0) ans1++;
	if (C % B != 0) ans2++;
	if (ans1 >= ans2) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
#include<cassert>
#include<utility>
#include<algorithm>
#include<complex>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  int t=0,ans=0;
  while(t==0){
    for(int i=0;i<n;i++){
      if(a[i]%2==0)a[i]/=2;
      else{t=1;break;}
    }
    if(t==0)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
from itertools import accumulate
def main():
    l, r, d = map(int, input().split())
    res = 0
    for i1 in range(l, r + 1):
        res += i1 % d == 0

    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9056
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
 
using namespace std;

int main( ) {
    string T;
    cin>>T;
    rep(i,0,T.size()) {
        if(T[i]=='?') {
            T[i]='D';
        }
        }
        cout<<T<<endl;
    
    }


Measured memory_bytes: 3752
# -*- coding: utf-8 -*-
import sys

N = input()
an = input()
lit = sorted(map(int, an.split()))
color = {}

for i in range(400, 3201, 400):
    color[i] = list(filter(lambda x: i-400 <= x <i , lit))
rainbow = list(filter(lambda x: x>=3200, lit))
label = 0

for v in color.values():
    if len(v) != 0:
        label += 1
        
if label == 0 and len(rainbow) > 0:
    print('1 {}'.format(len(rainbow)))
else:
    print('{} {}'.format(label, label + len(rainbow)))


Measured memory_bytes: 3064
from collections import defaultdict

N, K = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
dd = defaultdict(int)

ans = 0
for i in range(K, 0, -1):
    dd[i] = pow(K // i, N, mod)
    for temp in range(i * 2, K + 1, i):
        dd[i] -= dd[temp]
    ans += dd[i] * i
    ans %= mod
print(ans)


Measured memory_bytes: 21096
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
//const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){cout << a << " " << b << " " << c << endl;}
#define INT_MAX 1<<30;
const int MAX = 1020000;
const double EPS = 1e-6;
const int mod = 1e9+7;

ll GCD(ll a, ll b){
    if(b==0) return a;
    else return GCD(b,a%b);
}

ll lcm(ll a, ll b){
    return a/GCD(a,b)*b;
}

 
int main(){
    vl v(4,0);
    ll a,b; cin >> a >> b;
    v[a]++; v[b]++;
    REP(i,1,4){
        if(v[i]==0){
            cout << i << endl;
            return 0;
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<long long> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];

    long long mx = 0, cnt = 0;
    for (int i = 0; i < n - 1; i++) {
        if (h[i] >= h[i + 1]) cnt++;
        else {
            mx = max(mx, cnt);
            cnt = 0;
        }
    }
    mx = max(mx, cnt);

    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 1024