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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;


    int g[15][15];
    int main(){
        int n;
        std::cin >> n;
        rep(i, n)rep(j, n) g[i][j] = -1;
        rep(i, n){
            int m;
            std::cin >> m;
            rep(j, m){
                int a, x;
                std::cin >> a >> x;
                --a;
                g[i][a] = x;
            }
        }
        int ans = 0;
        rep(i, 1 << n){
            std::vector<int> d(n);
            rep(j, n) if(i >> j&1){
                d[j] = 1;
            }
        bool ok = true;
        rep(j, n){
            if (d[j])
            {
                rep(k, n){
                    if (g[j][k] == -1) continue;
                    if (g[j][k] != d[k]) ok = false;
                }
            }
        }
        if (ok) ans = max(ans, __builtin_popcount(i));        
        }
        std::cout << ans << "\n";
    
        
    
        return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define pb push_back
#define endl '\n'
#define N 100123

using namespace std;

ll fexp(ll b, int e) {
    ll res = 1;

    while(e) {
        if(e & 1) res = (res * b) % MOD;

        b = (b * b) % MOD;
        e >>= 1;
    }

    return res;
}

ll n, k, cnt[N], ans;

int main() {
    ios_base::sync_with_stdio(0);

    cin >> n >> k;

    cnt[k] = 1;
    ans = k;

    for(int i=k - 1; i >= 1; --i) {

        cnt[i] = fexp(k/i, n);

        for(int j = i + i; j <= k; j += i) {
            cnt[i] = (cnt[i] + MOD - cnt[j]) % MOD;
        }
        ans = (ans + (1LL * cnt[i] * i)) % MOD;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4412
N = int(input())
A = list(map(int,input().split()))
x = 1000
cnt = 0
flag = 0
for i in range(1,N):
    if flag==0 and A[i]-A[i-1]>0:
        cnt += x//A[i-1]
        x = x%A[i-1]
        flag = 1
    elif flag==0 and A[i]-A[i-1]<0:
        x += cnt*A[i-1]
        cnt = 0
        flag = -1
    elif flag==1 and A[i]-A[i-1]<0:
        x += cnt*A[i-1]
        cnt = 0
        flag = -1
    elif flag==-1 and A[i]-A[i-1]>0:
        cnt += x//A[i-1]
        x = x%A[i-1]
        flag = 1
if flag==1:
    x += cnt*A[N-1]
    cnt = 0
print(x)

Measured memory_bytes: 9244
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
constexpr int MOD = 1e9 + 7;

template <typename T>
T mypow(T a, T b)
{
    if (b == 0)
        return 1;
    T tmp = mypow(a, b / 2);
    if (b % 2)
        return (((tmp * tmp) % MOD) * a) % MOD;
    else
        return (tmp * tmp) % MOD;
}

int n, x, y, z;

// v が x y z となっているか
bool check(const vector<int> &v)
{
    int sz = v.size();
    if (sz < 3)
        return false;
    vector<int> sum(sz + 1, 0);
    for (int i = 0; i < sz; i++)
    {
        sum[i + 1] = sum[i] + v[i];
    }
    bool f = false;
    for (int k = 0; k <= sz - 3; k++)
    {
        for (int i = k + 1; i <= sz - 2; i++)
        {
            for (int j = i + 1; j <= sz - 1; j++)
            {
                if (sum[i] - sum[k] == x && sum[j] - sum[i] == y && sum[sz] - sum[j] == z)
                    f = true;
            }
        }
    }
    return f;
}

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

    cin >> n >> x >> y >> z;
    int sum = x + y + z;
    // dp[i][j] := i 番目迄見て, 直近(の符号)が j であり, 575 を含まないものの数
    vector<vector<ll>> dp(n + 1, vector<ll>(1 << sum, 0));
    // valid[i][j] := 直近が i の時に j を置けるか
    vector<vector<int>> valid(1 << sum, vector<int>(11, 0));
    for (int i = 0; i < (1 << sum); i++)
    {
        vector<int> num;
        int v = 0;
        for (int j = sum - 1; j >= 0; j--)
        {
            if ((i >> j) & 1)
            {
                if (v)
                    num.push_back(v);
                v = 1;
            }
            else
            {
                if (v)
                    v++;
            }
        }
        if (v)
            num.push_back(v);
        for (int j = 1; j <= 10; j++)
        {
            vector<int> num2 = num;
            num2.emplace_back(j);
            valid[i][j] = !check(num2);
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < (1 << sum); j++)
        {
            for (int k = 1; k <= 10; k++)
            {
                if (!valid[j][k])
                    continue;
                int mask = ((((j << k) & ((1 << sum) - 1)) | (1 << (k - 1)))) & ((1 << sum) - 1);
                dp[i + 1][mask] += dp[i][j];
                dp[i + 1][mask] %= MOD;
            }
        }
    }
    ll ret = 0;
    for (int i = 0; i < (1 << sum); i++)
        ret = (ret + dp[n][i]) % MOD;
    cout << (mypow((ll)10, (ll)n) + MOD - ret) % MOD << endl;
}


Measured memory_bytes: 53628
#include <bits/stdc++.h> 
using namespace std;
#define endl "\n"
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef long long ll;
#define MOD 1000000007;

int main() 
{ 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    map<string,int> m;
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
   
    cout << "RE x " << m["RE"] << endl;  
}

Measured memory_bytes: 3668
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	int a[n], b[n], flag = 0;
	bool flg = true;
	for(int i = 0; i<n; i++){
		scanf("%d %d", &a[i], &b[i]);
		if(a[i]==b[i]) flag++;
		else flag = 0;
		if(flag==3) flg = false;
	}
	if(flg == false) printf("Yes");
	else printf("No");
	return 0;
}

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

int main(){
    int t,x;
    cin >> t >> x;
    double ans;
    ans=t/double(x);
    printf("%.10f",ans);
    

    return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		String s = sc.next();
		
		int r = 0;
		int b = 0;
		
		for(int i = 0; i < n; i++) {
			if(s.charAt(i) == 'R') {
				r++;
			}else{
				b++;
			}
		}
		
		System.out.println(b < r ? "Yes" : "No" );
	}
}


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

int cmpfunc (const void * a, const void * b)
{
    if( *(int*)a - *(int*)b < 0 )
        return -1;
    if( *(int*)a - *(int*)b > 0 )
        return 1;
    if( *(int*)a - *(int*)b == 0 )
        return 0;
}

int main()
{
    int n, i, sum = 0;
    scanf("%d", &n);
    int arr[2*n];
    for (i = 0; i < 2*n; i++) scanf("%d", &arr[i]);
    qsort(arr, 2*n, sizeof(int), cmpfunc);
    for (i = 0; i < n; i++){
        sum += arr[i*2];
    }
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const int mx = 710000;
ll fac[mx], finv[mx], inv[mx];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < mx; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main()
{
	int X, Y, x, y, ans; scanf("%d%d", &X, &Y);
	if ((X + Y) % 3 != 0 || X > Y * 2 || Y > X * 2) ans = 0;
	else {
		x = (2 * X - Y) / 3;
		y = (2 * Y - X) / 3;
		COMinit();
		ans = COM(x + y, x);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 16768
#include<iostream>
#include<algorithm>
using namespace std;
int n;
long A,B,L[5555],R[5555];
int p[5555];
main()
{
	cin>>n>>A>>B;
	for(int i=0;i<n;i++)cin>>p[i];
	for(int i=0;i<n;i++)
	{
		long c=0;
		L[i]=9e18;
		for(int j=i;j--;)
		{
			if(p[j]>p[i])
			{
				c+=A;
			}
			else
			{
				L[i]=min(L[i],L[j]+c);
				c+=B;
			}
		}
		L[i]=min(L[i],c);
	}
	for(int i=n;i--;)
	{
		long c=0;
		R[i]=9e18;
		for(int j=i+1;j<n;j++)
		{
			if(p[j]>p[i])
			{
				R[i]=min(R[i],R[j]+c);
				c+=A;
			}
			else
			{
				c+=B;
			}
		}
		R[i]=min(R[i],c);
	}
	long ans=9e18;
	for(int i=0;i<n;i++)ans=min(ans,L[i]+R[i]);
	cout<<ans<<endl;
}

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

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; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,S; cin>>N>>S;
    vector<ll> A(N);
    rep(i,N)cin>>A[i];

    vector<vector<ll>> dp(N+1,vector<ll>(S+1,0));
    rep(r,N){
        rep(s,S+1){
            dp[r+1][s] = dp[r][s];
            if(s>=A[r])dp[r+1][s] += dp[r][s-A[r]];
            if(s==0||s==A[r]) dp[r+1][s]++;
            dp[r+1][s] %= MOD;
        }
    }
    ll res = 0;
    rep1(r,N){
        res += dp[r][S];
        res %= MOD;
    }
    cout<<res<<endl;
}


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

const int vmax=1010;
const int inf=1023456789;

int N,M,S;
struct node{int to,cost;};
vector<node> graph[vmax];

int dist[vmax];

bool bellman_ford(){
	rep(i,N)dist[i]=inf;
	dist[S]=0;
	rep(loop,N){
		rep(i,N)for(auto &e:graph[i]){
			if(dist[i]==inf) continue;
			if(dist[e.to]>dist[i]+e.cost){
				dist[e.to]=min(dist[e.to],dist[i]+e.cost);
				if(loop==N-1) return true;
			}
		}
	}
	return false;
}

int main(void){
	cin >> N >> M >> S;
	rep(i,M){
		int a,b,c;
		cin >> a >> b >> c;
		graph[a].push_back({b,c});
	}
	if(bellman_ford())
		cout << "NEGATIVE CYCLE" << endl;
	else{
		rep(i,N){
			if(dist[i]==inf)
				cout << "INF" << endl;
			else
				cout << dist[i] << endl;
		}
	}
	return 0;
}

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

int main()
{
	char a[26];
	int j = 0;
	for (int i = 97; i <= 122;)
	{
		a[j] = (char)i;
		j++;
		(int)i++;
	}
	char C;
	cin >> C;
	int s = 0;
	int ans;
	while (s < 26)
	{
		if (a[s] == C)
		{
			ans = s;
			break;
		}
		s++;
	}
	cout << a[ans + 1] << endl;
}


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

int main() {
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  a--; b--; c--; d--;
  string s;
  cin>>s;
  bool flag=false;
  for (int i=a; i<=c; i++) {
    if (s[i]=='#') {
      if (flag==false)
	flag=true;
      else {
	cout<<"No"<<endl;
	return 0;
      }
    }
    if (s[i]=='.') flag=false;
  }
  for (int i=b; i<=d; i++) {
    if (s[i]=='#') {
      if (flag==false)
	flag=true;
      else {
	cout<<"No"<<endl;
	return 0;
      }
    }
    if (s[i]=='.') flag=false;
  }
  if (c>d) {
    int cnt=0;
    for (int i=b-1; i<=d+1; i++) {
      if (s[i]=='.') {
	cnt++;
	if (cnt>=3) {
	  cout<<"Yes"<<endl;
      return 0;
	}
      }
      else cnt=0;
    }
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  
  return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
typedef long long ll;
using namespace std;
const ll INF = 1ll << 60;

ll dp[1005][10005];
int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n + 2), b(n + 2);
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];

  rep(i, n + 1) rep(j, h + 1) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= h; ++j) {
      chmin(dp[i + 1][j], dp[i][j]);
      chmin(dp[i + 1][min(j + a[i], h)], dp[i + 1][j] + b[i]);
    }
  }
  cout << dp[n][h] << endl;
}

Measured memory_bytes: 78464
from collections import defaultdict

n, m = map(int, input().split())
AC = defaultdict(int)
WA = defaultdict(int)

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        AC[p] = 1
    elif s == 'WA' and AC[p] == 0:
        WA[p] += 1
num_ac, num_wa = 0, 0
for p, c in AC.items():
    if c == 1:
        num_ac += 1
        num_wa += WA[p]
print(num_ac, num_wa)

Measured memory_bytes: 64344
#include<stdio.h>
int main(){
  int i=0;
  int data[4];
  while(scanf("%d",&data[i])!=EOF){
    int i,j,hit=0,blow=0;
    int str[4]={0};
    for(i=1;i<4;i++){
      scanf("%d",&data[i]);
    }
    for(i=0;i<4;i++){
      scanf("%d",&str[i]);
    }
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(data[i]==str[j]){
	  if(data[j]==str[j]){
	    hit++;
	  } else{
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }
  return(0);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
    vector <string> v;
    stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x);
    return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
    cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
    err(++it, args...);
}
 
int ini(){int x; scanf("%d",&x);return x;}
long long inl(){ long long x;scanf("%lld",&x); return x;}
double ind(){double x; scanf("%lf",&x);return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int t=1,te=0;
   // cin>>t;
    while(t--){
        int n;
        cin>>n;
        bool f=true;
        for(int i=1;i<=n;++i){
            int x;
            cin>>x;

            if(x%2==0){
                if(!(x%3==0 or x%5==0)){
                   f=false;
                }

            }
        }
        if(f){
            printf("APPROVED\n");
        }
        else{
            printf("DENIED\n");
        }

        //printf("Case %d: ",++te);
    }
    return 0;
}




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

typedef unsigned long long  ULL;
typedef long long LL;

#define pb push_back
#define mp make_pair
#define reset(a, b) memset(a, b, sizeof(a))
#define rep(i,b) for(int i=0; i<b; i++)
#define F first 
#define S second

 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int T;
//    cin>>T;
    T=1;
    while(T--){
       
       string s;
       cin>>s;
       
       if(s[0]==s[1] && s[1]==s[2]) cout<<"No";
       else cout<<"Yes";
       
       
       
    }
    
    return 0;
}

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

int n,a[55],mn,mx;

int find(int k)
{
	for (int i=1; i<=n; i++)  if (a[i]==k)  return i;
	return 0;
}

void work()
{
	scanf("%d",&n),mn=1<<30,mx=-mn;
	for (int i=1; i<=n; i++)
		scanf("%d",&a[i]),mx=max(mx,a[i]),mn=min(mn,a[i]);
	printf("%d\n",2*n-2);
	if (mx>=-mn)
		{
			int x=find(mx);
			for (int i=1; i<=n; i++)
				if (i!=x)  printf("%d %d\n",x,i);
			for (int i=2; i<=n; i++)  printf("%d %d\n",i-1,i);
		}else
		{
			int x=find(mn);
			for (int i=1; i<=n; i++)
				if (i!=x)  printf("%d %d\n",x,i);
			for (int i=n; i>1; i--)  printf("%d %d\n",i,i-1);
		}
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 256
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define pb push_back
#define in insert
#define er erase
#define ct count
#define ep empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inf = LLONG_MAX;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2,mod); }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }


ll x[1005],y[1005],r[1005];
double c[1005][1005];
double lc[1005];
int vis[1005];
void dij(int n,int s){
    _for(i,0,n){
        lc[i]=inf;
        vis[i]=0;
    }
    lc[s]=0;
    _for(i,0,n){
        int k=-1;
        double mi=inf;
        _for(j,0,n){
            if(!vis[j]&&lc[j]<mi){
                mi=lc[j];
                k=j;
            }
        }
        if(k==-1)break;
        vis[k]=1;
        _for(j,0,n){
            if(!vis[j]&&lc[k]+c[k][j]<lc[j]){
                lc[j]=lc[k]+c[k][j];
            }
        }
    }
}
signed main() {
    //ifstream cin("E:\\acm dream\\in.in");
	//ofstream cout("E:\\acm dream\\out.out");
	FIO;
    #ifdef err
	double be = clock();
    #endif

    int sx,sy,ex,ey;cin>>sx>>sy>>ex>>ey;
    int n;cin>>n;
    x[0]=sx,y[0]=sy,r[0]=0,x[n+1]=ex,y[n+1]=ey,r[n+1]=0;
    _for(i,1,n+1){
        cin>>x[i]>>y[i]>>r[i];
    }
    n++;
    _for(i,0,n+1){
        _for(j,i+1,n+1){
            c[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-(r[i]+r[j]);
            if(c[i][j]<0)c[i][j]=0;
            c[j][i]=c[i][j];
        }
    }
    dij(n+1,n);
    cout<<fixed<<setprecision(10)<<lc[0];

    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 11756
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r) \
    for (int i = l; i < r; i++) cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;

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

    long double l;
    cin >> l;

    long double d = l / 3;
    cout << setprecision(12) << fixed;
    long double ans = d * d * d;

    cout << ans << endl;
    return 0;
}


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

using namespace std;

 template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

int main() {

	string S;
	cin >> S;

	if (S[2] == S[3] && S[4] == S[5]) {
		cout << "Yes";
	}
	else cout << "No";

	return 0;
}

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

using namespace std;

int main()
{    
    int n;
    cin >> n;
    
    long long cum = 0;
    for(int i=0; i<n+1; ++i){
        if(i%3 != 0 && i%5 != 0){
            cum += i;
        }
    }

    cout << cum << endl;
    return 0;
}

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

using ll = long long;

void solve(long long N, std::vector<long long> L){
    int cnt = 0;
    for(int i = 0;i < N - 2;i++){
        for(int j = i + 1;j < N - 1;j++){
            for(int k = j + 1;k < N;k++){
                if(L[i] != L[j] && L[j] != L[k] && L[i] != L[k]){
                    if(abs(L[i] - L[j]) < L[k] && L[k] < L[i] + L[j]){
                        cnt++;
                    }
                }
            }
        }
    }
    cout<<cnt<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(L));
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){
	int n;
	cin>>n;
	int max0=-INF,max1=-INF,min0=INF,min1=INF;
	
	vector<pii> xy(n);
	rep(i,n){
		int x,y;
		cin>>x>>y;
		chmax(max0,x-y);
		chmin(min0,x-y);
		chmax(max1,x+y);
		chmin(min1,x+y);
	}
	int ans=-INF;
	chmax(ans,max1-min1);
	chmax(ans,max0-min0);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 6416
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N-1);
    rep(i, N-1) cin >> A[i];

    vector<int> ans(N);
    rep(i, N-1) {
        ans[A[i]-1] += 1;
    }
    rep(i, N-1) {
        cout << ans[i] << endl;
    }
    cout << 0 << endl;
    return 0;
}

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

int N;
vector<vector<int> > adj;
vector<vector<int> > dp, cdp, rdp;
void dfs(int u, int p) {
    int ccnt = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        ccnt++;
        dfs(v, u);
    }
    if(!ccnt) {
        dp[u][0] = 0;
        dp[u][1] = 1;
        return;
    }
    cdp[u].resize(ccnt);
    rdp[u].resize(ccnt);
    int pos = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        cdp[u][pos] = dp[v][0];
        if(pos) cdp[u][pos] &= cdp[u][pos - 1];
        pos++;
    }
    pos = ccnt - 1;
    for(int i = adj[u].size() - 1; i >= 0; i--) {
        int v = adj[u][i];
        if(v == p) continue;
        rdp[u][pos] = dp[v][0];
        if(pos != ccnt - 1) rdp[u][pos] &= rdp[u][pos + 1];
        pos--;
    }
    dp[u][0] = 0;
    pos = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        dp[u][0] |= dp[v][1] & (pos == 0 || cdp[u][pos - 1]) & (pos == ccnt - 1 || rdp[u][pos + 1]);
        pos++;
    }
    dp[u][1] = cdp[u].back();
}

int main() {
    scanf("%d", &N);
    adj.resize(N);
    for(int i = 0; i < N - 1; i++) {
        int u, v; scanf("%d %d", &u, &v);
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dp = vector<vector<int> >(N, vector<int>(2));
    cdp.resize(N);
    rdp.resize(N);
    dfs(0, -1);
    if(dp[0][0]) printf("Second");
    else printf("First");
}


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

int main()
{
    int n = 0;
    cin >> n;
    bool over = false;

    int count = 0;
    for(int i = 1; i < n; ++i){
            for(int j = 1; j < n; ++j){
                int a = i*j;
                if(a >= n){
                    //cout << "e" <<  endl;
                    break;
                }
                //cout << a << endl;

                for(int k = n-a; k < n; ++k){
                    int ans = i*j+k;
                    //cout <<ans<< endl;
                    //cout << "i " << i << " j " << j << " k " << k << endl;
                    if(ans < n){
                        continue;
                    }else if(ans > n){
                        break;
                    }
                    ++count;
                    break;

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

Measured memory_bytes: 3596
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <utility>
#include <set>
#include <unordered_set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>
#include <complex>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

const ll mod = 1e9+7;

ll f(ll x)
{
    if (x == 1) return 1;
    return x/3;
}

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios::sync_with_stdio(0); cin.tie(0);
    
    string s; cin >> s; int n = s.size();
    s = 'S' + s;
    
    ll a = 0;
    ll ab = 0;
    ll abc = 0;
    ll ways = 0; //ways to make a string
    ll waystot = 1;
    
    int st = 0;
    for (int i = 1; i <= n; i++)
        if (s[i] == 'A' || s[i] == '?') {st = i; break;}
    
    for (int i = st; i <= n; i++)
    {
        ll prevA  = a%mod;
        ll prevAB = ab%mod;
        ll prevABC = abc%mod;
        
        bool Q = (s[i] == '?');
        
        a = ab = abc = 0;
        
        //how many ways to make upto
        
        if (s[i] == 'A' || s[i] == '?')
        {
            a += prevA + waystot;
            ab += prevAB;
            abc += prevABC;
        }
        if (s[i] == 'B' || s[i] == '?')
        {
            a += prevA;
            ab += prevAB + prevA;
            abc += prevABC;
        }
        if (s[i] == 'C' || s[i] == '?')
        {
            a += prevA;
            ab += prevAB;
            abc += prevABC + prevAB;
        }
        
        if (Q) waystot = (waystot * 3)%mod;
    }
    
    cout << abc%mod << '\n';
    
    return 0;
    
}




Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
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;}
 
int main(){
  ll x, y;
  cin >> x >> y;
  ll ans = 0;
  if(x == 1) ans += 300000;
  if(x == 2) ans += 200000;
  if(x == 3) ans += 100000;
  if(y == 1) ans += 300000;
  if(y == 2) ans += 200000;
  if(y == 3) ans += 100000;

  if(x == 1 && y == 1) ans += 400000;

  cout << ans << endl;
  return 0;
}

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


signed main(){
    int a,b;
    cin>>a>>b;
    if(a>0)cout<<"Positive"<<endl;
    else{
    if(b<0&&(b-a)%2==0)cout<<"Negative"<<endl;
    else{
    if(b<0&&(b-a)%2==1)cout<<"Positive"<<endl;
    else cout<<"Zero"<<endl;
    }
    }
}


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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector< vector<bool> > rg(n, vector<bool>(n, 0));
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    rg[u][v] = rg[v][u] = 1;
  }
  vector< vector<int> > g(n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (rg[i][j] == 0) {
        g[i].emplace_back(j);
        g[j].emplace_back(i);
      }
    }
  }
  bitset<1000> dp;
  dp[0] = 1;
  vector<int> color(n, -1);
  function<bool(int, int&, int &, int)> dfs = [&](int v, int &x, int &y, int c) -> bool {
    if (color[v] == c) return true;
    if (color[v] != -1 && color[v] != c) return false;
    color[v] = c;
    if (c == 0) x++;
    else y++;
    bool ok = true;
    for (auto u : g[v]) {
      ok &= dfs(u, x, y, c ^ 1);
    }
    return ok;
  };

  for (int i = 0; i < n; i++) {
    if (color[i] == -1) {
      int x = 0, y = 0;
      if (!dfs(i, x, y, 0)) {
        cout << "-1\n";
        return 0;
      }
      dp = (dp << x) | (dp << y);
    }
  }
  for (int i = n / 2; i >= 0; i--) {
    if (dp[i] == 1) {
      cout << i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2 << '\n';
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;
typedef vector<PII> VPII;

// TEMPLATE DEFINITIONS END

int a, b;

void read_input(){

    cin >> a >> b;
}

void solve(){

    for(int i=1;i<=1000;i++){
        if(floor(i * 0.08) == a && floor(i * 0.1) == b){
            cout << i << "\n";
            return;
        }
    }
    cout << "-1\n";
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 10 + 10;
unsigned long long pow3[maxn];
template<class T> 
inline void read(T& x)
{
	char c = getchar(); T p = 1, n = 0;
	while(c < '0' || c > '9'){if(c == '-') p = -1; c = getchar();}
	while(c >= '0' && c <= '9'){n = n * 10 + c - '0'; c = getchar();}
	x = p * n;
}
int main()
{
	int n; read(n);
	pow3[0] = 1;
	for(int i = 1; i <= n; ++i) pow3[i] = pow3[i - 1] * 3;
	unsigned long long ans = 0, prev = 1;
	for(int i = 0, a; i < n; ++i)
	{
		read(a), a %= 2;
		if(a == 0) ans += prev * pow3[n - 1 - i], prev *= 2;
		else ans += prev * 2 * pow3[n - 1 - i];
	}
	printf("%llu\n", ans);
	return 0;
}

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


int main(){
  int n,h;

  cin >> n >> h;
  vector<string> s(n);
  vector<int> t(n);

  for(int i=0;i<n;i++){
    cin >> s[i] >> t[i];
  }
  string S;
  int T;
  long long success=0, total=0;
  int i=0,j=0;
  while(1){
    if(h==0) break;
    else if(j==s.size()) break;
    S=s[j];
    T=t[j];
    i=0;
    while(1){
      if(T<0||i==S.size()) break;
      printf("? %s\n", S.c_str()); fflush(stdout);
      char c[2];
      scanf("%s", c);
      if(S[i]==c[0]||S[i]==toupper(c[0])){
        S[i]='_';
        success++;
        total++;
        i++;
      }else{
        total++;
        T--;
      }
    }
    if(T<0) h--;
    j++;
  }
  long long tmp = (success*10000/total)-(success *10000/ total) %10;
  double success_type_rate = tmp/100.0;
  if(h!=0){printf("! Game Clear %.1lf\n", success_type_rate); fflush(stdout);}
  else printf("! Game Over\n"); fflush(stdout);
}

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

int main(){
  int A,B;
  cin >> A >> B;
  int sum=0;
  for(int i=0; i<2; i++){
    if(A > B){
      sum += A; 
      A = A-1;
    }else{
      sum += B;
      B = B-1;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter
n=int(input())
v=list(input().split())
v1=Counter(v[0::2]).most_common()
v2=Counter(v[1::2]).most_common()
ans=0
v1.append([0,0])
v2.append([0,0])
if v1[0][0]!=v2[0][0]:
  ans=n-v1[0][1]-v2[0][1]
else:
  ans=min(n-v1[1][1]-v2[0][1],n-v1[0][1]-v2[1][1])
print(ans)

Measured memory_bytes: 102400
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define pb push_back
#define PI 3.14159265
int M = 1000000007;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[100000] = {0};
  for (int i = 1; i <= 100; ++i)
  {
    for (int j = 1; j <= 100; ++j)
    {
      for (int k = 1; k <= 100; ++k)
      {
        int val = i * i + j * j + k * k + i * j + i * k + k * j;
        a[val]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
  {
    cout << a[i] << endl;
  }

}


Measured memory_bytes: 4408
#include <cstdio>

int main() {
    int num[3];
    int sum = 0;
    int max_num = 0, min_num = 10001;
    for(int i = 0; i < 3; i++) {
        scanf(" %d", &num[i]);
        max_num = max_num < num[i]? num[i]: max_num;
        min_num = min_num > num[i]? num[i]: min_num;
        sum += num[i];
    }

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



Measured memory_bytes: 2716
program Ti
    implicit none
    integer A,B,i
    real :: eight = 0.08, ten = 0.1

    read *,A,B

    do i = 0, 10000
        if(int(i*eight) == A .and. int(i*ten) == B) then
            print '(i0)',int(i)
            stop
        endif
    enddo

    print '(i0)',-1

end program Ti

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

int main() {

  string S;
  cin >> S;

  vector<int> count(S.size());

  int answer = 0;

  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
      if (i == 0) {
        count[i] = 1;
      } else {
        count[i] = count[i-1] + 1;
      }
      answer = max(answer, count[i]);
    } else {
      count[i] = 0;
    }
  }

  cout << answer << endl;

}

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

typedef long long ll;

int main(){
  ll a,b;
  cin >> a >> b;
  if(a*b<=0){
    cout << "Zero" << endl;
  }
  else if(b<0&&(a-b)%2==0){
    cout << "Negative" << endl;
  }
  else{
    cout << "Positive" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x)		   (x << 1)
#define right(x) 	   (x << 1) + 1
#define mid(l, r) 	   ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	   {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))

template<typename T >T min_ ( T a , T b ) { return a > b ? b : a ; }
template < typename T ,  typename... Ts > T min_( T first , Ts... last ){ return  min_(first, min_(last...)); }
template<typename T >T max_ ( T a , T b ) { return a > b ? a : b ; }
template < typename T ,  typename... Ts > T max_( T first , Ts... last ){ return  max_(first, min_(last...)); }

template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) {
    out << v[i]; if (i != last) out << ", "; } out << "]"; return out;
}
const int mod = 1e9+7;

ll pwr(ll base, ll p){
ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans;
}
ll gcd(ll a, ll b) {  return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) {  return a*(b/gcd(a,b)); }

const long double PI = (long double)(3.1415926535897932384626433832795);
const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();


int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n; 
    vi arr(n+1); 
    map<int,int> mp;
    for(int i = 2; i <= n; ++i) {
        cin >> arr[i];
        mp[arr[i]] += 1;
    }
    for(int i = 1; i <= n; ++i) {
        cout << mp[i] << " ";
    }

    


    

    return 0;
}


Measured memory_bytes: 13556
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
char str[1005][1005];
int rui[1001][1001]={};
int main(){
	while(1){
	scanf("%d",&n);
	if(!n) break;
	memset(rui,0,sizeof(rui));
	for(int i=1;i<=n;i++){
		scanf("%s",&str[i]);
	}
	for(int j=1;j<=n;j++){
	for(int i=n-1;i>=0;i--){
		str[j][i+1]=str[j][i];
	}
	}
for(int i=1;i<=n;i++){
	if(str[i][1]=='*'){
		rui[i][1]=rui[i-1][1]+1;
	}else{
		rui[i][1]=rui[i-1][1];
	}
}
for(int i=1;i<=n;i++){
	if(str[1][i]=='*'){
		rui[1][i]=rui[1][i-1]+1;
	}else{
		rui[1][i]=rui[1][i-1];
	}
}
for(int i=2;i<=n;i++){
	for(int j=2;j<=n;j++){
		if(str[i][j]=='*'){
			rui[i][j]=rui[i-1][j]+rui[i][j-1]-rui[i-1][j-1]+1;
		}else{
			rui[i][j]=rui[i-1][j]+rui[i][j-1]-rui[i-1][j-1];
		}
	}
}
int ans=0;
for(int i=1;i<=n;i++){
	for(int j=i;j<=n;j++){
		if(j-i+1<=ans) continue;
		for(int k=1;k<=n-(j-i);k++){
			int eo=rui[j][k+j-i]-rui[j][k-1]-rui[i-1][k+j-i]+rui[i-1][k-1];
			if(!eo){
				ans=max(ans,(j-i+1));
				break;
			}
		}
	}
}
printf("%d\n",ans);
}
return 0;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int n;
	string s;
	cin >> n >> s;

	int ans = 1;
	int c = s[0];
	REP(i, 1, n){
		if(s[i] == c) continue;
		else{
			ans++;
			c = s[i];
		}
	}

	cout << ans;
	
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#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 rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
//const int MAX=;

int A,B;
void input(){
    cin>>A>>B;
    A--;
    B--;
    if(B%A==0)cout<<B/A;
    else cout<<B/A+1;
}

void solve(){

}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int ans=0;
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        s[i];
    }
    for(int i=0;i<s.size();i++){
        if(s[i]=='+'){
           ans++; 
        }
        else{
            ans--;
        }
    }
    cout<<ans<<endl;
  return 0;  
}


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k,s = inpl()
for i in range(n):
    if i < k:
        print(s)
    else:
        print(s-1 if s != 1 else 100)


Measured memory_bytes: 71892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    ll N,K;
    cin>>N>>K;
    vector<ll> A(N);
    rep(i,N)cin>>A.at(i);
    vector<ll> S(N+1);
    S.at(0)=0;
    rep(i,N){
        S.at(i+1)=S.at(i)+A.at(i);
        S.at(i+1)%=K;
    }
    vector<pair<ll,ll>> x(N+1);
    rep(i,N+1){
        x.at(i).first=((S.at(i)-i)%K+K)%K;
        x.at(i).second=i;
    }
    sort(x.begin(),x.end());
    queue<ll> change;
    rep(i,N){
        if(x.at(i).first!=x.at(i+1).first){
//cout<<i+1<<endl;
            change.push(i+1);
        }
    }
    change.push(N+1);
    ll cha=change.front();change.pop();
    ll ans=0;
    rep(i,N+1){
        if(i==cha){
            cha=change.front();change.pop();
        }
        pair<ll,ll> Q=x.at(i);
        Q.second+=K;
    //cout<<"("<<Q.second<<endl;
        ll plu=lower_bound(x.begin(),x.end(),Q)-x.begin();//ギリアウト
//cout<<plu<<endl;
        if(plu>cha){plu=cha;}
        plu-=i+1;
        if(plu>0){ans+=plu;}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8192
// IlyM

#include <bits/stdc++.h>

#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=1e6+5,mod=1000000007;
double r;
int main()
{
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>r;
	r*=3.14159265;
	r*=2;
	cout<<r;
	return 0;
}


Measured memory_bytes: 3800
A = [list(map(str, input().split())) for i in range(3)]
N = int(input())

for i in range(N):
    B = input()
    for k in range(3):
        for m in range(3):
            if A[k][m] == B:
                A[k][m] = '-1'


if A[0][0] == '-1' and A[0][1] == '-1' and A[0][2] == '-1':
    print('Yes')
    exit()

if A[1][0] == '-1' and A[1][1] == '-1' and A[1][2] == '-1':
    print('Yes')
    exit()

if A[2][0] == '-1' and A[2][1] == '-1' and A[2][2] == '-1':
    print('Yes')
    exit()

if A[0][0] == '-1' and A[1][0] == '-1' and A[2][0] == '-1':
    print('Yes')
    exit()

if A[0][1] == '-1' and A[1][1] == '-1' and A[2][1] == '-1':
    print('Yes')
    exit()

if A[0][2] == '-1' and A[1][2] == '-1' and A[2][2] == '-1':
    print('Yes')
    exit()

if A[0][0] == '-1' and A[1][1] == '-1' and A[2][2] == '-1':
    print('Yes')
    exit()

if A[0][2] == '-1' and A[1][1] == '-1' and A[2][0] == '-1':
    print('Yes')
    exit()


print('No')

Measured memory_bytes: 3192
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
  size_t n;
  std::cin >> n;

  std::vector<std::vector<long long>> input(3,std::vector<long long>(n,0));
  for(int j = 0; j < n; j++){
    for(int i = 0; i < 3;i++){
      std::cin >> input[i][j];
    }
  }

  std::vector<std::vector<long long>> dp(3,std::vector<long long>(n,0));
  dp[0][0] = input[0][0];
  dp[1][0] = input[1][0];
  dp[2][0] = input[2][0];

  for(size_t i = 1; i < n; i++){
    dp[0][i] = (input[0][i] + std::max(dp[1][i-1],dp[2][i-1]));
    dp[1][i] = (input[1][i] + std::max(dp[0][i-1],dp[2][i-1]));
    dp[2][i] = (input[2][i] + std::max(dp[0][i-1],dp[1][i-1]));
  }

  std::cout << std::max({dp[0][n - 1], dp[1][n - 1], dp[2][n-1]}) << std::endl;
}

Measured memory_bytes: 5744
def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        
        fact.append((fact[-1]*i) % mod)
        
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    
    return fact, fact_inv

def cmb(n, r, mod=10**9+7):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

N, K = map(int,input().split())
A = list(map(int,input().split()))
mod=10**9+7
A.sort()
A_rev = A[::-1]
fact, fact_inv = make_array_for_comb(N=N, mod=mod)
f_max, f_min = 0, 0
for i, num in enumerate(A):
    if i >=K-1:
        f_max += num*cmb(i, K-1)
for i, num in enumerate(A_rev):
    if i >= K-1:
        f_min += num*cmb(i, K-1)
print((f_max - f_min)%mod)

Measured memory_bytes: 21448
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

const int MAXN = 1e5+5;

int n,a[MAXN],b[MAXN];

int main()
{
    cin >> n;
    for (int i=1; i<=n+1; i++) cin >> a[i];
    for (int i=1; i<=n; i++) cin >> b[i];

    long long res(0);
    for (int i=1; i<=n; i++)
    {
        int tmpa = a[i];
        res += min(a[i],b[i]);
        a[i] -= min(a[i],b[i]);
        b[i] -= min (b[i],tmpa);
        res += min(b[i],a[i+1]);
        a[i+1] -= min(a[i+1],b[i]);
    }

    cout << res;

    return 0;
}


Measured memory_bytes: 1024