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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  vector<int> MH(N);
  MH.at(0) = H.at(0);
  for (int i = 1; i < N; i++) {
    MH.at(i) = max(MH.at(i - 1), H.at(i));
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (H.at(i) == MH.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int k = scan.nextInt();
		int ans = 0;
		
		for(int i=0;i<k;i++) {
			if(a>=1) {
				ans += 1;
				a -= 1;
			}else if(b>=1) {
				b -= 1;
			}else {
				ans -= 1;
				c -= 1;
			}
		}
		
		System.out.println(ans);
		
	}	
	
	
	//最小公約数
	/*
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	*/
	
	//入れ替え
	/*
	static int swap (int a, int b) {
		int swap_arr[] = new int[2];
		
		swap[0] = b;
		swap[1] = a;
		
		return swap_arr;
	}
	*/
	
}


Measured memory_bytes: 35800
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  string s;
  cin >> s;
  ll k=s.size();
  vl dp(k+1,0);
  dp[0]=1;
  /*rep(i,k){
    cout << i << ":" << s[i] << endl;
  }*/
  FOR(i,0,k+1){
    if(i>=5&&dp[i-5]==1&&((s[i-5]=='d'&&s[i-4]=='r'&&s[i-3]=='e'&&s[i-2]=='a'&&s[i-1]=='m')||(s[i-5]=='e'&&s[i-4]=='r'&&s[i-3]=='a'&&s[i-2]=='s'&&s[i-1]=='e'))){
      dp[i]=1;
    }
    if(i>=7&&dp[i-7]==1&&s[i-7]=='d'&&s[i-6]=='r'&&s[i-5]=='e'&&s[i-4]=='a'&&s[i-3]=='m'&&s[i-2]=='e'&&s[i-1]=='r'){
      dp[i]=1;
    }
    if(i>=6&&s[i-6]=='e'&&s[i-5]=='r'&&s[i-4]=='a'&&s[i-3]=='s'&&s[i-2]=='e'&&s[i-1]=='r'&&dp[i-6]==1){
      dp[i]=1;
    }
  }
  /*rep(i,k+1){
    cout << i << ":" << dp[i] << endl;
  }*/
  if(dp[k]==1){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 1280
# ABC 045 B

A = list(input())
B = list(input())
C = list(input())

player = 'a'

while True:
    if player =='a':
        if len(A)==0:
            print('A')
            break
        player = A.pop(0)
    elif player =='b':
        if len(B)==0:
            print('B')
            break
        player = B.pop(0)
    elif player =='c':
        if len(C)==0:
            print('C')
            break
        player = C.pop(0)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll fact[(int)2e5+5];
ll komb(ll a, ll b){
	return fact[a+b] * exp(fact[a]*fact[b], mod-2) % mod;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	fact[0] = 1;
	for(int i = 1; i <= 2e5; i++) fact[i] = (fact[i-1]*i) % mod;
	int n, m; cin>>n>>m;
	unordered_map<int, int> cnt;
	for(int i = 2; i*i <= m; i++){
		while(m % i == 0){
			m /= i;
			cnt[i]++;
		}
	}
	if(m > 1) cnt[m]++;
	ll ans = 1;
	for(auto x: cnt){
		ans = (ans * komb(n-1, x.second)) % mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

void countingsort(unsigned short *A,unsigned short *B,int *C,int k)
{
  int i,j;
  int max=0;
  for(i=0;i<k;i++){//CにAの各要素の出現回数を格納
      C[A[i]]++;
      if(max<A[i]) max=A[i];
  }
  for(i=1;i<max+1;i++) C[i] = C[i-1] + C[i];//累積和を計算
  for(i=k-1;i>-1;i--) {//BにAのlastから理想の位置に格納
    B[C[A[i]]]=A[i];
    C[A[i]]--;
  }
  for(i=1;i<k+1;i++){
      if(i != 1) printf(" ");
      printf("%d",B[i]);
  }
  printf("\n");
}

int main(){
  unsigned short *A, *B;
  int C[VMAX+1]={};
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<n;i++) scanf("%hd",&A[i]);
    
  countingsort(A,B,C,n);

  free(A);
  free(B);
  return 0;
}


Measured memory_bytes: 9192
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PA;
const int MOD = 1000000007;
const ll INF=2e18;

ll N,M;
ll x[110],y[110],h[110];
string s;
int main(){
    cin>>N;
    ll not0Index=0;
    for(ll i=0;i<N;i++){
      cin>>x[i]>>y[i]>>h[i];
      if(h[i]!=0)not0Index=i;
    }
    for(ll i=0;i<=100;i++){
      for(ll j=0;j<=100;j++){
        ll H=h[not0Index]+abs(i-x[not0Index])+abs(j-y[not0Index]);
        bool f=true;
        for(ll k=0;k<N;k++){
          if(k==not0Index)continue;
          if(h[k]==0){
            if(abs(i-x[k])+abs(j-y[k])<H){
              f=false;
              break;
            }
          }
          else if(h[k]+abs(i-x[k])+abs(j-y[k])!=H){
            f=false;
            break;
          }
        }
        if(f){
          cout<<i<<" "<<j<<" "<<H<<endl;
          return 0;
        } 
      }
    }
    return 0;
}


Measured memory_bytes: 256
n, k = gets.split(" ").map(&:to_i)

answer = 0

1.upto(n) do |number|
  omote_count = 0

  1.upto(100000) do |x|
    if number <= k - 1
      number = number * 2
      omote_count += 1
      next
    end

    break
  end

  answer += Rational(1, n) * (Rational(1, 2) ** omote_count)
end

puts answer.to_f


Measured memory_bytes: 1788
N = int(input())
count = 0
count2 = 0

for i in range(N):
	count = 0
	#print(i + 1,9)
	if (i + 1) % 2 == 1:
		#print(i + 1,8)
		for j in range(i + 1):
			
			if (i + 1) % (j + 1) == 0:
				count += 1
				
			if j + 1 == i + 1:
				if count == 8:
					count2 += 1
					#print(i + 1,7)
					
print(count2)

Measured memory_bytes: 3060
import sys

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
cnt = 26 * [0]
Input = ""
loop = True

#while loop:
#    I = input()
#    if not I:
#        loop = False
#    Input += I

for I in sys.stdin:
    Input += I

for i1 in range(len(alphabet)):
    for i2 in range(len(Input)):
        if 'A' <= Input[i2] <= 'Z':
            w = Input[i2].lower()
        else:
            w = Input[i2]
        if alphabet[i1] == w:
            cnt[i1] += 1
    print(alphabet[i1] + " : " + str(cnt[i1]))

Measured memory_bytes: 7512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


struct edge{int to;ll cap;int rev;};
struct Dinic{
private:
    int n;
    vector<vector<edge>> v;
    vector<int> dist,iter;
public:
    Dinic(int sz):n(sz),v(sz),dist(sz),iter(sz){}
    
    void addedge(int from,int to,ll cap){
        int x=v[to].size(),y=v[from].size();
        v[from].push_back({to,cap,x});
        v[to].push_back({from,0,y});
    }
    
    void bfs(int s){
        fill(dist.begin(),dist.end(),-1);
        queue<int> q;
        dist[s]=0;
        q.push(s);
        while(q.size()){
            int x=q.front();q.pop();
            rep(i,v[x].size()){
                edge &e=v[x][i];
                if(e.cap>0&&dist[e.to]<0){
                    dist[e.to]=dist[x]+1;
                    q.push(e.to);
                }
            }
        }
    }
    
    ll dfs(int x,int t,ll f){
        if(x==t)return f;
        for(int& i=iter[x];i<(int)v[x].size();++i){
            edge& e=v[x][i];
            if(e.cap>0&&dist[x]<dist[e.to]){
                ll d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    v[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    ll max_flow(int s,int t){
        ll flow=0;
        while(1){
            bfs(s);
            if(dist[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            ll f;
            while((f=dfs(s,t,1LL<<62))>0)flow+=f;
        }
    }
};
int main(){
    int n;
    cin>>n;
    int a[n],b[n],c[n],d[n];    
    rep(i,n)cin>>a[i]>>b[i];
    rep(i,n)cin>>c[i]>>d[i];
    Dinic dn(2*n+2);
    rep(i,n)rep(j,n){
        if(a[i]<c[j]&&b[i]<d[j])dn.addedge(i, j+n, 1);
    }
    
    rep(i,n){
        dn.addedge(2*n, i, 1);
        dn.addedge(i+n, 2*n+1, 1);
    }
    cout<<dn.max_flow(2*n, 2*n+1)<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
int main()
{
	int data;
	scanf("%d", &data);
	for (int p = 0; p < data; p++)
	{
		ll a, b, c, d;
		scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
		vector<pii>ans;
		ll gen = max((a + b) / (b + 1), (a + b) / (a + 1));
		ll beg = 0, end = a / gen;
		for (;;)
		{
			if (beg == end)break;
			ll med = (beg + end + 1) / 2;
			ll ra = a - med*gen, rb = b - max(0LL, med - 1);
			if ((ra + 1)*gen >= rb &&ra >= 0 && rb >= 0)beg = med;
			else end = med - 1;
		}
		a -= beg*gen, b -= max(0LL, beg - 1);
		//printf("%lld %lld\n", gen, beg);
		if (beg == 0)
		{
			ll sb = b%gen;
			if (a*gen < b)
			{
				ans.push_back(make_pair(2, b - a*gen));
				ans.push_back(make_pair(4, a));
			}
			else if (sb == 0)
			{
				ll x = b / gen;
				ans.push_back(make_pair(1, a - (x - 1)));
				ans.push_back(make_pair(2, gen));
				ans.push_back(make_pair(4, x - 1));
			}
			else
			{
				ll x = b / gen;
				ans.push_back(make_pair(1, a - x));
				ans.push_back(make_pair(2, sb));
				ans.push_back(make_pair(4, x));
			}
		}
		else
		{
			ans.push_back(make_pair(3, beg - 1));
			ans.push_back(make_pair(1, gen));
			if (a*gen < b - 1)
			{
				ans.push_back(make_pair(2, b - a*gen));
				ans.push_back(make_pair(4, a));
			}
			else
			{
				ans.push_back(make_pair(2, 1));
				b--;
				ll x = (b + gen - 1) / gen;
				ans.push_back(make_pair(1, a - (x - 1)));
				ans.push_back(make_pair(2, b - (x - 1)*gen));
				ans.push_back(make_pair(4, x - 1));
			}
		}
		string s;
		for (int i = c; i <= d; i++)
		{
			ll rem = i - 1;
			for (int j = 0; j < ans.size(); j++)
			{
				ll len = ans[j].second;
				if (ans[j].first >= 3)len *= gen + 1;
				if (rem < len)
				{
					if (ans[j].first == 1)s.push_back('A');
					else if (ans[j].first == 2)s.push_back('B');
					else
					{
						rem %= gen + 1;
						if (ans[j].first == 3)
						{
							if (rem == gen)s.push_back('B');
							else s.push_back('A');
						}
						else
						{
							if (rem == 0)s.push_back('A');
							else s.push_back('B');
						}
					}
					break;
				}
				else rem -= len;
			}
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 384
package main

import (
	"fmt"
)

func main() {
	var (
		a     string
		count = 0
	)
	fmt.Scan(&a)
	for i := 0; i < len(a); i++ {
		if a[i] == '1' {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <iostream>

void BigOrSmall(int a, int b){
    if (a < b){
        std::cout << "a < b" << std::endl;
    }
    else if (a > b){
        std::cout << "a > b" << std::endl;
    }
    else{
        std::cout << "a == b" << std::endl;
    }
}

int main(){
    // ---------------------------
    // ITP_1_2_A
    int a, b;
    std::cin >> a >> b;
    BigOrSmall(a,b);
    // ---------------------------

    return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
#include<math.h>

int main(void){
    int n,min=pow(10,9),max=0;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++){
        if(a[i]<min){
            min=a[i];
        }
        if(a[i]>max){
            max=a[i];
        }
    }

    printf("%d\n",max-min);
    return 0;

}

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

int main(int, char**) {
  string s, t;
  cin >> s >> t;

  if (s == t) {
    cout << "Yes" << endl;
    return 0;
  } else {
    for (int i = 0; i < s.size(); i++) {
      if (s[0] == t[i]) {
        int si = 0;
        int j = i;
        while (si < s.size()) {
          if (j == s.size()) {
            j = 0;
          }
          if (s[si] == t[j]) {
            ++si;
            ++j;
          } else {
            break;
          }
        }
        if (si == s.size()) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m;
	int a[1001],b[1001];
	int c[1001],d;
	int max;
	int i,j;
	
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		c[i]=0;
	}
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			if(a[j]<=b[i]){
				c[j]++;
				break;
			}
		}
	}
	max=c[0];
	d=1;
	for(i=1;i<n;i++){
		if(max<c[i]){
			max=c[i];
			d=i+1;
		}
	}
	printf("%d\n",d);
	return 0;
}

Measured memory_bytes: 1036
#!/usr/bin/env python3
import sys
import collections


def solve(N: int, A: "List[int]"):
    D = collections.defaultdict(int)
    for a in A:
        D[a] += 1

    res = 0
    for k,v in D.items():
        if k < v:
            res += v - k
        elif k > v:
            res += v

    print(res)
        



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24240
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int A, P; cin>>A>>P;
  int ans = (A*3+P)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
s_L = list(s)

first = s_L[0]
second = s_L[0]
third = s_L[1]

ans = 0

for i in range(n-2):
    first = second
    second = third
    third = s_L[i+2]
    
    if first == "A" and second == "B" and third == "C":
       ans += 1
    

    
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
    int n,m;
    cin>>n>>m;
    int workday=0;
    rep(i,m){
        int a;
        cin>>a;
        workday+=a;
    }
    if(workday<=n)
        printf("%d\n",n-workday);
        else puts("-1");
    return 0;
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

long long n, m;
int main(){
    n = read(), m = read();
    cout << (n * (n-1) / 2) + (m * (m-1) / 2) << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> dp(n+1,1e9);
  dp.at(0)=0;
  for(int i=1;i<n+1;i++) {
    dp.at(i)=min(dp.at(i),dp.at(i-1)+1);
    int temp=6;
    while(i-temp>-1) {
      dp.at(i)=min(dp.at(i),dp.at(i-temp)+1);
      temp*=6;
    }
    temp=9;
    while(i-temp>-1) {
      dp.at(i)=min(dp.at(i),dp.at(i-temp)+1);
      temp*=9;
    }
  }
  cout << dp.at(n) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std; 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

   long long int x;
   cin>>x;

   long long int d = x/500;
   x = x - d*500;

   long long int e = x/5;

   cout<<(d*1000 + e*5)<<"\n";


    
	return 0; 
} 


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

int main() {
	int N;
	cin>>N;
	vector<vector<pair<int, long> > >tree;
	vector<pair<int, long> >tmp;
	for(int i=0;i<N;++i){
		tree.push_back(tmp);
	}
	int a, b;
	long c;
	for(int i=0;i<N-1;++i){
		cin>>a>>b>>c;
		a--;
		b--;
		tree[a].push_back(make_pair(b, c));
		tree[b].push_back(make_pair(a, c));
	}
	int Q, K;
	cin>>Q>>K;
	K--;
	vector<pair<int, int> >query;
	int x, y;
	for(int i=0;i<Q;++i){
		cin>>x>>y;
		x--;
		y--;
		query.push_back(make_pair(x, y));
	}
	long dist[N];
	for(int i=0;i<N;++i){
		dist[i] = -1;
	}
	queue<pair<int, long> >que;
	que.push(make_pair(K, 0));
	pair<int, long> state;
	while(!que.empty()){
		state = que.front();
		que.pop();
		if(dist[state.first] != -1)continue;
		dist[state.first] = state.second;
		for(int i=0;i<tree[state.first].size();++i){
			que.push(make_pair(tree[state.first][i].first, tree[state.first][i].second + state.second));
		}
	}
	/**
	for(int i=0;i<N;++i){
		cout<<i<<" "<<dist[i]<<endl;
	}
	**/
	for(int i=0;i<Q;++i){
		cout<<dist[query[i].first] + dist[query[i].second]<<endl;
	}
}


Measured memory_bytes: 12144
#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;

map<int,int> mp;
//素因数分解 {素数、何乗}の配列、1のときは要素なしの配列
vector<pair<int,int>> primefact(ll N){
    vector<pair<int,int>> ans(0);
    ll a=2;
    while(N>=a*a){
        if(N%a==0){
            ans.push_back({a,0});
            ll A=ans.size()-1;
            while(N%a==0){
                ans.at(A).second++;
                N/=a;
            }
        }
        a++;
    }
    if(N>1)ans.push_back({N,1});
    return ans;
}

//MODをとるパターン
ll modpower(ll n,ll p){
    if(p==0){return 1;}
    if(p%2==1){return n*modpower(n,(p-1)/2)%MOD*modpower(n,(p-1)/2)%MOD;}
    else{return modpower(n,p/2)*modpower(n,p/2)%MOD;}
}

int main() {
    int N;
    cin>>N;
    vector<int> A(N);
    rep(i,N)cin>>A.at(i);
    vector<vector<P>> AP(0);
    rep(i,N){
        AP.emplace_back(primefact(A.at(i)));
    }
    rep(i,N){
        rep(j,sz(AP.at(i))){
            if(mp.count(AP.at(i).at(j).first)){
                chmax(mp[AP.at(i).at(j).first],AP.at(i).at(j).second);
            }
            else{mp[AP.at(i).at(j).first]=AP.at(i).at(j).second;}
        }
    }
    int S=sz(mp);
    vector<P> B(S);
    int ord=0;
    for(P pa:mp){
        B.at(ord).first=pa.first;
        B.at(ord).second=pa.second;
        mp.erase(pa.first);
        ord++;
    }

    vector<ll> ans(N,1);
    rep(i,N){
        int ao=0;
        rep(j,S){
            if(ao<sz(AP.at(i)) && AP.at(i).at(ao).first==B.at(j).first){
                ans.at(i)*=modpower(B.at(j).first,B.at(j).second-AP.at(i).at(ao).second);
                ao++;
            }
            else{ans.at(i)*=modpower(B.at(j).first,B.at(j).second);}
            ans.at(i)%=MOD;
        }
    }
    ll sum=0;
    rep(i,N){
        sum+=ans.at(i);
        sum%=MOD;
    }
    cout<<sum<<endl;
}

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

int main(){
	int a=1,b=1,i,l;
	while((cin>>a>>b)&&(a!=0||b!=0)){
			for(l=1;l<=b;l++){
				cout<<"#";
			}
			cout <<endl;
			for(i=2;i<a;i++){
			cout<<"#";
				for(l=2;l<b;l++){
				cout<<".";
				}
			cout<<"#"<<endl;
			}
			for(l=1;l<=b;l++){
				cout<<"#";
			}
			cout <<endl;
		cout <<endl;		
	}
}

Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mons = 0
for i in range(N):

    tmp = min(B[i], A[i])
    mons += tmp
    B[i] -= tmp

    tmp = min(B[i], A[i+1])
    mons += tmp
    A[i+1] -= tmp

print(mons)


Measured memory_bytes: 18476
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
double p,e,t;

double solve(int k, double l, double r){
	double mid = (l +r) /2;
	if(k == 0){
		if(abs(t-mid) < e) return 1;
		else return 0;
	}
	if(t < l && abs(t-l) > e) return 0;
	if(t > r && abs(t-r) > e) return 0;
	if(abs(t-l) < e && abs(t-r) < e) return 1;
	double pl = (t<mid)? 1-p : p;
	double pr = (t<mid)? p : 1-p;
	return pl*solve(k-1, l, mid) +pr*solve(k-1, mid, r);
}

int main(){
	int k;
	double l,r;
	cin >> k >> l >> r >> p >> e >> t;
	cout << fixed << setprecision(10);
	cout << solve(k, l, r) << endl;
	return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  int n, r;
  cin >> n >> r;
  int ans = (n >= 10) ? r : r + 100 * (10 - n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
while True:
	n,x = map(int,input().split())
	if n == 0 and x == 0:
		break
	cnt=0
	for i in range(1,x//3):
		for j in range(i+1,x//2):
			k=x-i-j
			if j<k<=n:
				cnt+=1
	print(cnt)


Measured memory_bytes: 5596
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 998244353

n, s = map(int, input().split())
a = [int(item) for item in input().split()]

dp = [[0] * (s+1) for _ in range(n)]
dp[0][0] = 1
if a[0] <= s:
    dp[0][a[0]] = 1
ans = 0
for i, item in enumerate(a[1:]):
    for j in range(s+1):
        # Not use item
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
        # Do use item
        if j + item <= s:
            dp[i+1][j + item] += dp[i][j]
            dp[i+1][j + item] %= MOD
    # Start from i
    if item <= s:
        dp[i+1][item] += 1
    dp[i+1][0] += 1
    ans += dp[i+1][s]
    ans %= MOD

print(ans)

Measured memory_bytes: 113116
#include<stdio.h>
 
int abc(int h,int a){
  int count = 0;
  while(h>0){
    h -= a;
    count++;
  }
  return count;
}
 
int main(void){
  int h,a,ans;
  scanf("%d %d",&h,&a);
  ans = abc(h,a);
  printf("%d",ans);
  return 0;
}
  

Measured memory_bytes: 128
using System;
class Program
{
    static void Main(string[] args)
    {
        int n, k, i = 0, q, j;
        int[] m, x = new int[4], y = new int[4], p = new int[] { 10, 50, 100, 500 };

        while (true)
        {
            n = int.Parse(Console.ReadLine());
            if (n==0) { break; }
            if (i!=0) { Console.WriteLine(); }
            i++;
            k = 0;
            m = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            for (j = 3; j >= 0; j--)
            {
                k += m[j] * p[j];
            }
            q = k - n;
            for (j = 3; j >= 0; j--)
            {
                x[j] = q / p[j]; q -= x[j] * p[j];
                y[j] = Math.Max(0, m[j] - x[j]);
            }

            for (j = 0; j < 4; j++)
            {
                if (y[j]!=0) { Console.WriteLine("{0} {1}", p[j], y[j]); }
            }
        }
    }
}


Measured memory_bytes: 9344
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    int n; cin>>n;
    string s;
    long a[5]={};
    for(int i=0;i<n;i++){
        cin>>s;
        if(s[0]=='M') a[0]++;
        if(s[0]=='A') a[1]++;
        if(s[0]=='R') a[2]++;
        if(s[0]=='C') a[3]++;
        if(s[0]=='H') a[4]++;
    }
 
    long sum=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                sum+=a[i]*a[j]*a[k];
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  int N, K;
  cin >> N >> S >> K;
  
  char target_character = S.at(K-1);
  
  int i;
  for (i=0; i<S.size(); i++){
    if(S.at(i) == target_character){
      cout << S.at(i);
    }else{
      cout << "*";
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  o.o(o.n()*o.n())
}
m();

Measured memory_bytes: 29664
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main() {
	int N,T;
	std::cin>>N>>T;
	int ans=INF;
	for(int i=0;i<N;i++){
		int c,t;
		std::cin>>c>>t;
		if(t<=T)ans=std::min(ans,c);
	}
	if(ans==INF)puts("TLE");
	else std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m;
char s[1100];
int main(){
	cin>>n;
	scanf("%s",s+1);  m=strlen(s+1);
	for(int i=1;i<=n && i<=m;++i)
		printf("%c",s[i]);
	if(m>n)  printf("...");
	printf("\n");
	return 0;
}




Measured memory_bytes: 3836
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int qian=n/1000,bai=n/100%10,shi=n/10%10,ge=n%1000%100%10;
		if((qian==bai&&bai==shi&&shi==ge)||(qian==bai&&bai==shi)||(bai==shi&&shi==ge))
				printf("Yes\n");
		else
			printf("No\n");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  int ans = 0;

  cin >> s;
  
  if (s[0] == '1') {
      ans += 1;
  }
  if (s[1] == '1') {
      ans += 1;
  }
  if (s[2] == '1') {
      ans += 1;
  }
  
  cout << ans << endl;
}

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

void problemOne(){
      int a;
      int b;
      while (cin >> a >> b){
            int sum = a + b;
            int intLength = 0;
            while (sum != 0) {
                  sum /= 10;
                  intLength += 1;
            }
            cout << intLength << endl;
      }
}

int main(){
      problemOne();
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define all(x) (x).begin(), (x).end()

int size = 1;
vector<long> segtree, lazy;

void eval(int l, int r, int now){
    if(r - l > 1){
        lazy[now * 2 + 1] += lazy[now];
        lazy[now * 2 + 2] += lazy[now];
    }
    segtree[now] += lazy[now] * (r - l);
    lazy[now] = 0;
}

void add(int a, int b, long x, int l, int r, int now){
    eval(l, r, now);
    if(r <= a || b <= l){
        return;
    }else if(a <= l && r <= b){
        lazy[now] += x;
        eval(l, r, now);
    }else{
        add(a, b, x, l, (l + r) / 2, now * 2 + 1);
        add(a, b, x, (l + r) / 2, r, now * 2 + 2);
        segtree[now] = segtree[now * 2 + 1] + segtree[now * 2 + 2];
    }
}

long sum(int a, int b, int l, int r, int now){
    eval(l, r, now);
    if(r <= a || b <= l){
        return 0;
    }else if(a <= l && r <= b){
        return segtree[now];
    }else{
        return sum(a, b, l, (l + r) / 2, now * 2 + 1) + sum(a, b, (l + r) / 2, r, now * 2 + 2);
    }
}

int main(){
    int n, q;
    cin >> n >> q;
    while(size < n){
        size *= 2;
    }
    segtree.resize(size * 2 - 1, 0l);
    lazy.resize(size * 2 - 1, 0l);
    for(int i = 0; i < q; i++){
        int com;
        cin >> com;
        if(com){
            int s, t;
            cin >> s >> t;
            cout << sum(s - 1, t, 0, size, 0) << endl;
        }else{
            int s, t;
            long x;
            cin >> s >> t >> x;
            add(s - 1, t, x, 0, size, 0);
        }
    }
}



Measured memory_bytes: 7072
i;l,a;main(L){
	scanf("%d",&L);
	printf("%d %d ",l,(l=32-__builtin_clz(L))*2-3+__builtin_popcount(L));
	for(;++i<l;){
		printf("%d %d %d %d %d %d ",i,i+1,0,i,i+1,a=1<<i-1);
		if(L&a)printf("%d %d %d ",i,l,L-=a);
	}
}

Measured memory_bytes: 128
import java.io.PrintStream;
import java.util.Scanner;
public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;

    public static void main(String[] args) {
        int a = ni();
        int b = ni();
        int c = ni();
        if (a == b && b == c ) {
            so.println("Yes");
        } else {
            so.println("No");
        }
    }

    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static String ns() {
        return sc.next();
    }

    static int[] nints(int n) {
        return nints(n, 0);
    }

    static int[] nints(int n, int padding) {
        int[] a = new int[padding + n];
        for (int i = 0; i < n; i++)
            a[padding + i] = ni();
        return a;
    }
}


Measured memory_bytes: 21716
#include <iomanip>
#include <iostream>
#include <string>

using namespace std;

int64_t gcd(int64_t a, int64_t b) {
  if (!b) return a;
  return gcd(b, a % b);
}

int64_t lcm(int64_t a, int64_t b) {
  int64_t d = gcd(a, b);
  return a / d * b;
}

int main(int argc, char *argv[]) {
  int64_t N, K;
  cin >> N >> K;
  int64_t a = 0, b = 1;  // a / b = p
  for (int i = 1; i <= N; i++) {
    // c / d = q;
    int64_t c = 1, d = 1;
    for (int k = i; k < K; k *= 2) d *= 2;
    d *= N;
    int64_t lcm_bd = lcm(b, d);
    a = lcm_bd / b * a + lcm_bd / d * c;
    b = lcm_bd;
  }
  cout << setprecision(10) << ((double)a / b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <complex>

using namespace std;
using Arrow = complex<long long>;

class Solution {
public:
	long double engines(vector<Arrow>& arrows) {
		const int n = arrows.size();
		sort(arrows.begin(), arrows.end(), [](const auto& a, const auto& b) { return atan2(a.imag(), a.real()) < atan2(b.imag(), b.real()); });
#if 0
		cout << "Input in sorted: " << endl;
		for (auto arrow : arrows)
			cout << arrow << endl;
		cout << endl;
#endif
		Arrow curr(0, 0);
		long long ans = 0;
		int j = 0;
		for (int i = 0; i < n; i++) {
			if (j < i) {
				curr = Arrow(0, 0);
				j = i;
			}
			while (j < i + n && norm(curr + arrows[j % n]) >= norm(curr)) {
				curr += arrows[j % n];
				j++;
			}
			ans = max(ans, norm(curr));
			curr -= arrows[i % n];
		}
		return sqrt(ans);
	}
};

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

	vector<Arrow> arrows(n);
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		arrows[i] = Arrow(x, y);
	}

	Solution sol;
	long double ans = sol.engines(arrows);
	cout << fixed << setprecision(50) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>                                                                             
using namespace std;                                                                                 
using ll = long long;                                                                                
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }              
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }              
                                                                                                     
int main() {                                                                                         
  int n;                                                                                             
  cin >> n;                                                                                          
  ll sum = 0;                                                                                        
  for (int i=1; i<=n; i++) {                                                                         
    if (i%3 != 0 && i%5 != 0) {                                                                      
      sum += i;                                                                                      
    }                                                                                                
  }                                                                                                  
                                                                                                     
  cout << sum << endl;                                                                               
                                                                                                     
  return 0;                                                                                          
}                             

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

const int N = 1e5+10;
priority_queue<int> p;
ll sp[N],sq[N],sr[N];
int main(){
    int a,b,x,y,z;
    cin >> a >> b >> x >> y >> z;
    int val;
    for(int i=1;i<=x;++i){
        cin >> val;
        p.push(val);
    }
    int idx = 1;
    while (!p.empty())
    {
        sp[idx] = p.top() + sp[idx - 1];
        p.pop();
        idx++;
    }
    for(int i=1;i<=y;++i){
        cin >> val;
        p.push(val);
    }
    idx = 1;
    while (!p.empty())
    {
        sq[idx] = p.top() + sq[idx - 1];
        p.pop();
        idx++;
    }
    for(int i=1;i<=z;++i){
        cin >> val;
        p.push(val);
    }
    idx=1;
    while (!p.empty())
    {
        sr[idx] = p.top() + sr[idx - 1];
        p.pop();
        idx++;
    }
    int j=b,i = a;
    ll ans = 0;
    while(i>0||j>0){
        ll cs = sp[i]+sq[j]+sr[a+b-i-j];
        if(i>0&&j>0){
            ll lcs = sp[i-1]+sq[j]+sr[a+b+1-i-j];
            ll rcs = sp[i]+sq[j-1]+sr[a+b+1-i-j];
            if(lcs >= rcs && lcs >=cs){
                i--;
            }else if(rcs >= lcs && rcs >= cs){
                j--;
            }else{
                ans = cs;
                break;
            }
        }else{
            if(i>0)
            {
                ll lcs = sp[i - 1] + sq[j] + sr[a + b + 1 - i - j];
                if(lcs >= cs){
                    ans = lcs;
                    i--;
                }
                else
                {
                    ans = cs;
                    break;
                }
            }
            else if(j>0)
            {
                ll rcs = sp[i] + sq[j - 1] + sr[a + b + 1 - i - j];
                if(rcs >= cs){
                    ans = rcs;
                    j--;
                }
                else
                {
                    ans = cs;
                    break;
                }
                
            }
            else
            {
                break;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;

int main(int argc,char const* argv[])
{
  int a,b;
  cin >> a >> b;
  if(a>8 || b>8)
    {
      cout << ":(" << endl;
    }
  else
    {
      cout << "Yay!" << endl;
    }
  return 0;
}


Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");
        DecimalFormat df = new DecimalFormat("0.00000000");
        
        int L = Integer.parseInt(sc.next());
        double d = (double) L/3.0;
        double ans = d*d*d;
        pw.println(df.format(ans));
        
        pw.flush();
    }
}

Measured memory_bytes: 21716
#include <iostream>
using namespace std;
int h, w, bom[50][50];
string field[50];
void dfs(int x, int y) {
    for (int dx = -1; dx <= 1; dx++) {
        for (int dy = -1; dy <= 1; dy++) {
            int nx = x + dx, ny = y + dy;
            if (nx >= 0 && nx < h && ny >= 0 && ny < w && field[nx][ny] != '#') {
                bom[nx][ny]++;
            }
        }
    }
}

int main(void){
    // Your code here!
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> field[i];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (field[i][j] == '#') {
                dfs(i, j);
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (field[i][j] == '#') cout << '#';
            else cout << bom[i][j];
        }
        cout << endl;
    }
}

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

int main(){

string s;
cin >> s;
for(int i=0;i<s.size();i++){
    if(s.at(i)=='?'){
        cout << "D";
    }
    else{
        cout << s.at(i);
    }
}
cout << endl;
}


Measured memory_bytes: 3712
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
void input_array(int how_data,int *data);
int get_random(int min, int max);
int factorial(int n);
int fibonacci(int n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);

int main(void){
    long tgt;
    scanf("%ld",&tgt);
    long double ans;
    /*
    tgt | ans
    1       1   1
    2       2   2
    3       2   1+2
    4       3   1+3
    5       3   2+3
    6       3   1+2+3
    7       4   3+4
    1 2 2 3 3 3 4 4 4 4ってかんじ？
    X<10^9だからO(x)でもTLE？
    */
    ans=((-1+sqrt(1+8*tgt))/2);
    printf("%ld\n",(long)(ans+0.9999999999));
    return 0;
    
    
    
    
}


//how_data個の配列data[]に標準入力
//input_array(how_data,data);
void input_array(int how_data,int *data){
    int loop;
    for(loop=0;loop<how_data;loop++){
        scanf("%d",&data[loop]);
    }
}

int get_random(int min, int max){   //指定の範囲から乱数を1つ返すやつ
    //srand((unsigned int)time(0));   //現在時刻で疑似乱数初期化
    rand();rand();rand();rand();    //乱数を空打ち
    return (rand()%(max+1-min))+min;
}


int factorial(int n){//n!のMOD10^9+7を返すやつ
    unsigned long long int ret=1;
    for(int i=1;i<=n;i++)ret=(ret*i)%1000000007;
    return (int)ret;
}

int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_09);
    if(*sys1<*sys2){
        return -1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return 1;
    }
}

int qsort_90(const int *sys1 , const int *sys2){ //大きいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_90);
    if(*sys1<*sys2){
        return 1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return -1;
    }
}
int fibonacci(int n){
    switch(n){
        case 0:return 0;
        case 1:return 1;
        default :return fibonacci(n-1)+fibonacci(n-2);
    }
}



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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  int a = n % 100;
  if ((a + 4) / 5 > n / 100)
    cout << 0 << endl;
  else
    cout << 1 << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		int n = sc.nextInt();
		long m = sc.nextLong();
		int k = sc.nextInt();

		long limit = 998244353;
		long[] nextPattern = new long[k + 1];
		long[] colorPattern = new long[k + 1];

		//隣り合わせが k + 1 個ある時の色の組み合わせを算出
		long pattern = 1;
		if (k < n - 1) {
			for (int i = 0; i <= n - k - 2; i++) {
				if (i == 0) {
					pattern = m;
				} else {
					pattern = (pattern * (m - 1)) % limit;
				}
			}
		}
		//1～k個の連続が発生する個数を計算する。
		for (int i = 0; i <= k; i++) {
			//どこが隣り合わせになるかの組み合わせ。
			if (i == 0) {
				nextPattern[i] = 1;
			} else if (i > (n - 1) / 2) {
				nextPattern[i] = nextPattern[n - 1 - i];
			} else {
				//nCr = nC(r - 1) * (n - r) / (r + 1) -> nextPattern[i - 1] * (n - i) / i
				//余りの割り算は、モジュラ逆数を掛ける。
				nextPattern[i] = (((nextPattern[i - 1] * (long) (n - i)) % limit) * (long) modinv(i, (int) limit)) % limit;
				if (nextPattern[i] < 0) {
					nextPattern[i] += limit;
				}
			}

			//色の組み合わせ。
			if (i == 0) {
				if (k == n - 1) {
					colorPattern[k - i] = m;
				} else {
					colorPattern[k - i] = (pattern * (m - 1)) % limit;
				}
			} else {
				colorPattern[k - i] = (colorPattern[k - i + 1] * (m - 1)) % limit;
			}
		}

		long countPattern = 0;
		for (int i = 0; i <= k; i++) {
			countPattern = (countPattern + (nextPattern[i] * colorPattern[i]) % limit) % limit;
		}

		// 出力
		System.out.println(countPattern);
		sc.close();
	}

	//モジュラ逆数
	public static int modinv(int a, int m) {
		int tempA = a;
		int tempB = m;
		int x0 = 1;
		int y0 = 0;
		int x1 = 0;
		int y1 = 1;
		while (tempB != 0) {
			int q = tempA / tempB;
			int temp = tempA;
			tempA = tempB;
			tempB = temp % tempB;
			temp = x0;
			x0 = x1;
			x1 = temp - q * x1;
			temp = y0;
			y0 = y1;
			y1 = temp - q * y1;
		}
		return x0 % m;
	}
}


Measured memory_bytes: 39152
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int)1e9 + 7;
// constexpr int MOD = 998244353;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    long r = 0;
    long g = 0;
    long b = 0;
    for (size_t i = 0; i < n; i++) {
        if (s[i] == 'R') {
            r++;
        } else if (s[i] == 'G') {
            g++;
        } else {
            b++;
        }
    }

    long ans = r * g * b;
    for (size_t i = 0; i < n; i++) {
        for (size_t j = i + 1; j < n; j++) {
            int k = j + j - i;
            if (k >= n)
                break;
            if (s[i] != s[j] and s[j] != s[k] and s[k] != s[i])
                ans--;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

#define ll long long
int a,b;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b;
	if(a + b < 10)
		cout<<a + b;
	else
		cout<<"error";
	return 0;
}

Measured memory_bytes: 384