akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

mint dp[200][200]; 

int main(){
    int k;
    string s;
    cin >> k;
    cin >> s;
    int n = s.size();
    combination comb(n+k);
    mint ans = 0;

    for (int i=0; i<=k; i++) {
        mint res = comb(n-1+k-i, n-1);
        res *= mint(25).pow(k-i);
        res *= mint(26).pow(i);
        ans += res;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35900
#include <bits/stdc++.h>   
using namespace std;
int n, a, lst = 1e9, ans = 0;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a);
		if (i == 1 || a < lst) ans++;
		lst = min(lst, a);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 384
s = input()

flag = True

for i, x in enumerate(s):
    if x == "L":
        if i % 2 == 0:
            flag = False
            break
    elif x == "R":
        if i % 2 == 1:
            flag = False
            break

if flag is True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
const int maxn = 11;
int arr[maxn], n;
long long ans = 0;
void solve(int cur, int prod){
    if(cur == n){
        if(prod == 0) ans++;
        return;
    }
    for(int e = arr[cur]-1; e <= arr[cur]+1; e++){
        solve(cur + 1, prod * e % 2);
    }
}
int M(){
    if(!(cin >> n)) return 0;
    for(int e = 0; e < n; e++) cin >> arr[e];
    ans = 0;
    solve(0, 1);
    cout << ans << endl;
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 256
program main
      implicit none
      integer(4) :: n, i, j, k
      integer(4) :: a(3,3)
      integer(4), allocatable :: b(:)

      read *, a(1,:)
      read *, a(2,:)
      read *, a(3,:)
      read *, n
      allocate( b(n) )
      do i = 1, n
        read *, b(i)
      end do

      do i = 1, n
        do j = 1, 3
          do k = 1, 3
            if ( b(i) == a(j,k) ) a(j,k) = 0
          end do
        end do
      end do

      if (( a(1,1) == a(1,2) ) .and. ( a(1,2) == a(1,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(2,1) == a(2,2) ) .and. ( a(2,2) == a(2,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(3,1) == a(3,2) ) .and. ( a(3,2) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,1) == a(2,1) ) .and. ( a(2,1) == a(3,1) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,2) == a(2,2) ) .and. ( a(2,2) == a(3,2) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,3) == a(2,3) ) .and. ( a(2,3) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,1) == a(2,2) ) .and. ( a(2,2) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,3) == a(2,2) ) .and. ( a(2,2) == a(3,1) ) ) then
        print *, 'Yes'
        stop
      end if

      print *, 'No'

end program main


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

int main(){

    int a;
    cin>>a;
    string s;
    cin>>s;

    int i = 0;
    while(s[i]!='\0'){
        if(s[i]==s[i+1]){
            s.erase(s.begin()+i);
        }
        else{
            i++;
        }
    }
    cout<<s.size();
    return 0;

}


Measured memory_bytes: 512
// Problem : B - Frog 2
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define f first
#define s second
typedef long long ll;
typedef unsigned long long ull ;
typedef long double ld;

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e6 + 1;
ll n ,k;
ll h[N];
ll dp[N];// dp[i] - min cost incurred in reaching on the ith step
void solve(){
	cin >> n >> k;
	rep(i ,n) cin >> h[i + 1];
	// base 
	rep(i , N) dp[i] = inf;
	dp[1] = 0;
	for(ll i = 1 ; i <= k ; i++){
		for(ll j=1 ; j < i ; j++){
			dp[i] = min(dp[i] , dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	// transition
	for(ll i = k + 1 ; i <= n ; i++){
		for(ll j = 1 ; j <= k ; j++){
			dp[i] = min(dp[i] , dp[i - j] + abs((h[i] - h[i - j]) ) );
		}
	}
	cout << dp[n] << endl;
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 10496
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a%3==0){
		puts("Possible");
	}else if(b%3==0){
		puts("Possible");
	}else if((a+b)%3==0){
		puts("Possible");
	}else{
		puts("Impossible");
	}
	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong p, m, c;
	cin >> p >> m >> c;

	cout << p + m + c << endl;

	return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

int w,h,s[30][30],c[4],d[30][30][4],ans; //d[pos][dir]:=位置posに向きdirで入るための最小コスト

int encode(int y,int x){
    return w*y+x;
}

pii decode(int pos){
    return pii(pos/w,pos%w);
}

void dijkstra(){
    ans=inf;
    fill_n((int*)d,900*4,inf);
    d[0][0][0]=0;
    typedef tuple<int,int,int> triple;
    priority_queue<pair<int,triple>,vector<pair<int,triple>>,greater<pair<int,triple>>> que;
    que.push(make_pair(0,triple(0,0,0)));
    while(!que.empty()){
        pair<int,triple> p=que.top(); que.pop();
        int dist=p.first;
        int y=get<0>(p.second),x=get<1>(p.second),dir=get<2>(p.second);

        if(y==h-1 and x==w-1){
            ans=min(ans,dist);
            continue;
        }
        if(dist>d[y][x][dir]) continue;

        rep(i,0,4){
            int cost=c[i],ndir=(dir+i)%4;
            if(i==s[y][x]) cost=0;

            int ny=y+dy[ndir],nx=x+dx[ndir];
            if(ny<0 or h<=ny or nx<0 or w<=nx) continue;
            if(dist+cost<d[ny][nx][ndir]){
                d[ny][nx][ndir]=dist+cost;
                que.push(make_pair(d[ny][nx][ndir],triple(ny,nx,ndir)));
            }
        }
    }
}

void solve(){
    while(true){
        cin >> w >> h;
        if(w==0 and h==0) break;

        rep(y,0,h) rep(x,0,w) cin >> s[y][x];
        rep(i,0,4) cin >> c[i];

        dijkstra();

        cout << ans << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 1332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
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; }
const long long INF = 1LL << 60;
int main()
{   
    int N;
    cin>>N;
    vector<int> d(N);
    REP(i,N) cin>>d[i];

    int sum=0;
    REP(i,N){
        REP2(j,i+1,N){
            sum+=d[i]*d[j];
        }
    }
    
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
long long mod = 1000000007;

int grid[105][105];
int dis[105][105];
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int rows, cols; cin >> rows >> cols;
	
	
	for(int r = 0;r < rows;r++){
		string s; cin >> s;
		for(int c = 0;c < cols;c++){
			grid[r][c] = (s[c] == '#');
			dis[r][c] = mod;
		}
	}
	
	
	
	for(int r = 0;r < rows;r++){
		for(int c = 0;c < cols;c++){
			if(r == 0 && c == 0){
				dis[0][0] = grid[r][c];;
				continue;
			}
			
			
			if(r != 0){
				int cost = 0;
				if(grid[r][c] == 1 && grid[r-1][c] == 0) cost = 1;
				dis[r][c] = min(dis[r][c], dis[r-1][c] + cost);
			}
			
			if(c != 0){
				int cost = 0;
				if(grid[r][c] == 1 && grid[r][c-1] == 0) cost = 1;
				dis[r][c] = min(dis[r][c], dis[r][c-1] + cost);
			}
		}
	}
	
	cout << dis[rows-1][cols-1];
	
	
	
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int a,b,n,s;
bool check(int x)
{
	for(int i=a;i<=b;i++)
	{
		if(x/10000+(x/1000)%10+(x/100)%10+(x/10)%10+x%10==i)
			return true;
	}
	return false;
}
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		if(check(i))
			s+=i;
	}
	cout<<s<<endl;
}

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

int main() {
    int i,j,a,b,c,n;
    int count=0;
    int sum=0;
    cin>>n;
    for(i=1; i<=n; i=i+2){
        for(j=1; j<=n; j++){
            if(i%j==0){count++;}
        }
        if(count==8){sum++;}
        count=0;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
var n;
var x = [];
var y = [];
var p = [];
var q = [];

function main(){
	while(true){
		n = scan();
		if(n == 0){
			break;
		}
		rep(n, function(i){
			var s = scan('string').split(',');
			x[i] = +s[0];
			y[i] = +s[1];
		});
		rep(n, function(i){
			for(var j = i + 1; j < n; ++j){
				if(i !== j){
					var dx = x[j] - x[i];
					var dy = y[j] - y[i];
					var d = Math.sqrt(dx * dx + dy * dy);
					if(d < 2){
						dx /= d;
						dy /= d;
						var t = Math.acos(d / 2);
						var a = dx * Math.cos(t) - dy * Math.sin(t);
						var b = dx * Math.sin(t) + dy * Math.cos(t);
						p.push(a + x[i]);
						q.push(b + y[i]);
						a = dx * Math.cos(-t) - dy * Math.sin(-t);
						b = dx * Math.sin(-t) + dy * Math.cos(-t);
						p.push(a + x[i]);
						q.push(b + y[i]);
					}
				}
			}
		});
		var ans = 0;
		rep(p.length, function(i){
			var t = 0;
			rep(n, function(j){
				var dx = p[i] - x[j];
				var dy = q[i] - y[j];
				if(dx * dx + dy * dy < 1 + 1e-9){
					++t;
				}
			});
			ans = Math.max(t, ans);
		});
		print(ans);
	}
}
 
function rep(a, b, c){
	if(c === undefined){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var input = '';
var input_index = 0;
 
function scan(type){
	if(type === 'string'){
		return input[input_index++];
	}
	else{
		return +input[input_index++];
	}
}
 
function print(val){
	console.log(val);
}
 
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.split(/\s+/);
	main();
});

Measured memory_bytes: 18472
A11, A12, A13 = list(map (int, input().split()))
A21, A22, A23 = list(map (int, input().split()))
A31, A32, A33 = list(map (int, input().split()))

called = []
N = int(input())

for i in range(0,N):
  b = int(input())
  called.append(b)
  
if A11 in called and A12 in called and A13 in called:
  print("Yes")
elif A21 in called and A22 in called and A23 in called:
  print("Yes")
elif A31 in called and A32 in called and A33 in called:
  print("Yes")
elif A11 in called and A21 in called and A31 in called:
  print("Yes")
elif A12 in called and A22 in called and A32 in called:
  print("Yes")
elif A13 in called and A23 in called and A33 in called:
  print("Yes")
elif A11 in called and A22 in called and A33 in called:
  print("Yes")
elif A13 in called and A22 in called and A31 in called:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)
max = 10 ** 18

# 0が1個でもあれば結果は0
# 最初に確認しないと [でかい数, ... , でかい数, 0] の形に対応できない
if a_arr.any?{|a| a == 0}
  puts 0
  exit 
end

result = 1
a_arr.each do |a|
  result *= a
  if result > max
    puts -1
    exit
  end
end

puts result


Measured memory_bytes: 23440
n = int(input())
absum = []
for a in range(1,n//2+1):
    b = n-a
    asum = 0
    bsum = 0
    alen = len(str(a))
    blen = len(str(b))
    for j in range(alen):
        a0 = (a//(10**j)) % 10
        asum = asum + a0
    for k in range(blen):
        b0 = (b//(10**k)) % 10
        bsum = bsum + b0
    absum.append(asum+bsum)
print(min(absum))  

Measured memory_bytes: 9208
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <math.h>

const long long MOD = 1000000007;

using namespace std;



int main(void) {

    long long i, j;
    long long n, m;
    long long sum = 0;
    long long temp, temp_b;
    long long min, max;
    string s;
    vector<long long> res;
    vector<long long> h, a, b;
    vector<vector<long long>> graph; 
    bool flag = false;

    cin >> n >> m;
    graph.resize(n);


    for (i = 0; i < n; i++) {
        cin >> temp;
        h.push_back(temp);
    }
    

    for (i = 0; i < m; i++) {
        cin >> temp >> temp_b;
        graph[temp - 1].push_back(temp_b - 1);
        graph[temp_b - 1].push_back(temp - 1);
    }


    for(i = 0; i < n; i++) {
        flag = true;
        if(graph[i].size() == 0) {
            sum++;
            continue;
        }

        for(j = 0; j < graph[i].size(); j++) {
            if (h[i] <= h[graph[i][j]]) {
                flag = false;
                break;
            }
        }
        if (flag == true) {
            sum++;
            flag = false;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 9808
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  set<int> s;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int t,x;
    cin>>t>>x;
    if(t==0) s.emplace(x);
    if(t==0) cout<<s.size()<<endl;
    if(t==1) cout<<s.count(x)<<endl;
    if(t==2) s.erase(x);
    if(t==3){
      int y;
      cin>>y;
      auto latte=s.lower_bound(x);
      while(latte!=s.end()&&*latte<=y) cout<<*latte++<<endl;
    }
  }
  return 0;
}



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

int main() {
    string s;
    cin >> s;
    char r = 'R';
    char u = 'U';
    char d = 'D';
    char l = 'L';
    bool find = true;
    bool found = true;
    for (long long i = 1; i <= s.size(); ++i) {
        if (i % 2 == 0) {
            if (s[i - 1] == l || s[i - 1] == u || s[i - 1] == d) {
                
            }
            else {
                find = false;
            }
        }
        else {
            if (s[i - 1] == r || s[i - 1] == u || s[i - 1] == d) {
    
            }
            else {
                found = false;
            }
        }
    }
    if (find == false || found == false) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<iomanip>

#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair

using namespace std;
using ll=long long int;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long 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(){
    COMinit();
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    ll ans = 0;
    ll tmp=0;
    for(int i=B;i<W;i++){
        tmp=COM(H-A-1+i,i)*COM(A-1+W-1-i,A-1);
        tmp=tmp%MOD;
        ans+=tmp;
    }
    cout << ans%MOD << endl;
    return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
int main()
{
    /* code */
    string N;
    cin >> N;
    string res="No";
    for(int i=0;i<3;i++){
        if(N[i]=='7')res="Yes";
    }
    cout << res << endl;
    return 0;
}


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

using namespace std;

int main(){
	//https://atcoder.jp/contests/dp/tasks/dp_d
	int n, w;
	cin >> n >>w;
	int weight[n+1];
	int val[n+1];
	weight[0] =0;
	val[0] =0;

	for(int i=1;i<=n;i++){
		cin >> weight[i] >> val[i];
	}

	long long int dp[n+1][w+1];
	memset(dp, 0, sizeof(dp));

	// for(int i=0; i<=n;i++){
	// 	dp[j][0] = 1;
	// }
	for(int i=1;i<=n;i++){
		for(int j=1;j<=w;j++){

			long long int op1 = dp[i-1][j];
			long long int op2 = (j < weight[i]) ? 0 : val[i] + dp[i-1][j-weight[i]];


			dp[i][j] = max(op1, op2);
		}
	}
	cout << dp[n][w];
	return 0;
}

Measured memory_bytes: 82472
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
import bisect
mod=998244353
n=int(input())
d=[]
N=1<<(n.bit_length())
t=[-1 for i in range(2*N-1)]

def ud(i,x):
  i+=N-1
  t[i]=x
  while i:
    i=(i-1)>>1
    if t[i*2+1]>t[i*2+2]:t[i]=t[i*2+1]
    else:t[i]=t[i*2+2]
     

def qr(a,b):
    a+=N-1
    b+=N-1
    L = -1
    R = -1
    while a < b:
      if a&1==0:
         if L<t[a]:L = t[a]
      if b&1==0:
         b-=1
         if R<t[b]:R = t[b]
      
      a>>=1
      b>>=1
      
         
    return max(L, R)
 
for i in range(n):
  d.append([int(i) for i in input().split()])
d.sort()
dx=[]
dd=[]
for i,j in d:
  dx.append(i)
  dd.append(j)
for i in range(n)[::-1]:
 tx=dx[i]+dd[i]
 j=bisect.bisect_left(dx,tx)
 tt=qr(i,j)
 if j-1>tt:ud(i,j-1)
 else:ud(i,tt)
dp=[0 for i in range(n+1)]
dp[-1]=1
for i in range(n)[::-1]:
  dp[i]+=dp[i+1]
  dp[i]%=mod
  dp[i]+=dp[t[i+N-1]+1]
  dp[i]%=mod
print(dp[0])

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

int main(){

  int input;
  scanf("%d",&input);
  
  int ans;
  ans = (input*input);
  
  ans = (int)ans;
  
  printf("%d\n",ans);
  
  
  return 0; 
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define     debug       printf("\n<<CameHere<<\n")
#define     mem(x,y)    memset(x, y, sizeof(x))
#define     all(qz)     qz.begin(),qz.end()
#define     rall(qz)    qz.rbegin(),qz.rend()
#define     inf         LLONG_MIN
#define     INF         LLONG_MAX
#define     mod         1000000007
#define     Sqr(x)      ((x)*(x))
#define     ll          long long
#define     mk          make_pair
#define     pb          push_back
#define     pi          acos(-1.0)
#define     cos(a)      cos(a*pi/180)
#define     sin(a)      sin(a*pi/180)
#define     tan(a)      tan(a*pi/180)

ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
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));}
/*---------AL ASAD NUR RIYAD------------*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n;
    cin>>n;
    vector<ll> v(n);
    ll t=0;
    for(ll i=0;i<n;i++){
        cin>>v[i];
        t=t^v[i];
    }
    for(ll i=0;i<n;i++){
        if(i!=n-1) cout<<(v[i]^t)<<" ";
        else cout<<(v[i]^t)<<endl;
    }
    return 0;
}



















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

int main(){
  string W, T;
  int counter = 0;

  cin >> W;
  int index = W.size();
  for ( int i = 0; i < index; i++ ) W[i] = tolower(W[i]);

  while(1){
    cin >> T;
    if ( T == "END_OF_TEXT" ) break;

    int index = T.size();
    for ( int i = 0; i < index; i++ ) T[i] = tolower(T[i]);

    if ( T == W ) counter++;
  }

  cout << counter << endl;

  return 0;
}

    


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    char c;cin>>c;
    switch(c){
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
            cout<<"vowel"<<endl;
            break;
        default:
            cout<<"consonant"<<endl;
            break;
    }
}

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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll N;
    set<string> st;
    cin>>N;
    string s;
    rep(i,N){
        cin>>s;
        st.insert(s);
    }
    ll ans = st.size();
    cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 19248
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int ans = 1000000009;
	for (int j = -100; j <= 100; ++j) {
		int cur = 0;
		for (int i = 0; i < n; ++i) {
			cur += (j - a[i]) * (j - a[i]);
		}
		ans = min(ans, cur);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple> 

using namespace std;

int main() {
	int A, B, C, X;
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> X;

	int patternNum = 0;

	for (int aNum = 0; aNum <= A; aNum++) {
		int aSum = aNum * 500;
		if (aSum > X) {
			break;
		}

		for (int bNum = 0; bNum <= B; bNum++) {
			int bSum = aSum + bNum * 100;
			if (bSum > X) {
				break;
			}

			for (int cNum = 0; cNum <= C; cNum++) {
				int cSum = bSum + cNum * 50;
				if (cSum > X) {
					break;
				}

				if (cSum == X) {
					patternNum++;
				}
			}
		}
	}

	cout << patternNum;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  loop(i,1,10)
    loop(j,1,10)
    cout<< i << "x" << j << "=" << i * j << endl;
}

Measured memory_bytes: 1116
#include<bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int n=s.size();
	int c,f;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='C') c++;
		if(c&&s[i]=='F')
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
const int FIVE = 101010;

//=============================
int N,M,K;
int X;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N>>X;
    A.resize(N);
    rep(i,N){
        cin>>A[i];
    }
}
//=============================
void func(){}
//=============================
void solve()
{
    int used = 0;
    int ans = 0;
    for(auto x : A) {
        used += x;
    }
    ans += N;
    sort(all(A));
    int mcost = A[0];
    ans += (X-used)/mcost;
    cout<<ans<<endl;
    

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

int n, N;
vector<int> even_b, odd_b;

bool check(double x) {
  vector<double> a(2);
  Rep(i, 2) a[i] = (double)even_b[i] / x;
  if ( a[0]*a[1] > (double)odd_b[0] ) return false;  
  else return true;
}

signed main() {  
  while ( cin >> n, n ) {
    N = n * (n+1) / 2;
    even_b.clear();
    odd_b.clear();
    
    Rep(i, N) {
      int b;
      cin >> b;
      if ( b % 2 ) odd_b.pb(b);
      else even_b.pb(b);
    }

    sort(All(even_b));
    sort(All(odd_b));
    
    double l = 1.0, r = (1 << 31)-1;
    int cnt = 100;
    while ( cnt-- ) {
      double mid = (r + l) / 2.0;      
      if ( check(mid) ) r = mid;
      else l = mid;
    }
    
    int ans = (double)r;
        
    cout << ans << endl;
    Rep(i, n) {
      if ( i ) cout << " ";
      cout << even_b[i] / ans;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3148
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long X=stdIn.nextLong();
		long ans=1,key=100;
		while(true){
			if(key>=X){
				System.out.println(ans-1);
				System.exit(0);
			}
			key*=1.01;
			ans++;
		}
	}
}


Measured memory_bytes: 35896
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  const int N = 2e5+3;
  LL fact[N];
  fact[0] = 1;
  for(int i=1;i<N;i++){
    fact[i] = fact[i-1]*i;
    fact[i] %= MOD;
  }
  int n,k;cin >> n >> k;
  LL ans = 0;
  LL mx = n;
  mx = mx*(mx+1)/2;
  for(int i=k;i<=n+1;i++){
    LL here = i-1;
    here = here*(here+1)/2;
    LL ot = n-i;
    ot = ot*(ot+1)/2;
    // cout << ot << endl;
    ot = mx-ot;
    // cout << ot << endl;
    ot = ot - here + 1;
    // cout << i << " " << here << " " << ot << endl;
    ans += ot;
    ans %= MOD;
  }
  cout << ans << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

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


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

if A[0] != 0:
    print(0)
    exit(0)

for k in range(1,N):
    if A[k] == 0:
        print(0)
        exit(0)

B = [0 for k in range(max(A)+1)]
for e in A:
    B[e] += 1

ans = 1
MOD = 998244353
for k in range(len(B)-1):
    ans *= pow(B[k],B[k+1],MOD)
    ans %= MOD
print(ans)



Measured memory_bytes: 56044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define lson root<<1,l,midd
#define rson root<<1|1,midd+1,r
const int M=2e5+5;
const int inf=0x3f3f3f3f;
const ll INF=1e18;
struct Segtree{
    ll tr[M<<2],lz[M<<2];
    void build(int root,int l,int r){
        tr[root]=0,lz[root]=0;
        if(l==r)
            return ;
        int midd=(l+r)>>1;
        build(lson);
        build(rson);
    }
    void pushdown(int root){
        ll c=lz[root];
        tr[root<<1]+=c,tr[root<<1|1]+=c;
        lz[root<<1]+=c,lz[root<<1|1]+=c;
        lz[root]=0;
    }
    void update(int L,int R,ll val,int root,int l,int r){
        if(L<=l&&r<=R){
            tr[root]+=val;
            lz[root]+=val;
            return ;
        }
        if(lz[root])
            pushdown(root);
        int midd=(l+r)>>1;
        if(L<=midd)
            update(L,R,val,lson);
        if(R>midd)
            update(L,R,val,rson);
        tr[root]=min(tr[root<<1],tr[root<<1|1]);
    }
    ll query(int L,int R,int root,int l,int r){
        if(L<=l&&r<=R){
            return tr[root];
        }
        if(lz[root])
            pushdown(root);
        ll res=INF;
        int midd=(l+r)>>1;
        if(L<=midd)
            res=min(res,query(L,R,lson));
        if(R>midd)
            res=min(res,query(L,R,rson));
        return res;
    }
}x,y;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    x.build(1,1,m),y.build(1,1,m);
    for(int i=1;i<=m;i++)
        y.update(i,i,-i,1,1,m);
    for(int i=1;i<=n;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        ///b+1
        x.update(b+1,b+1,min(1ll*(b+1+y.query(1,b,1,1,m))-x.query(b+1,b+1,1,1,m),0ll),1,1,m);
        y.update(b+1,b+1,min(y.query(1,b,1,1,m)-y.query(b+1,b+1,1,1,m),0ll),1,1,m);
        ///a~b
        x.update(a,b,1e9,1,1,m);
        y.update(a,b,1e9,1,1,m);
        ///向下
        x.update(1,m,1,1,1,m);
        y.update(1,m,1,1,1,m);
        ll ans=x.query(1,m,1,1,m);
        if(ans>=1e9)
            puts("-1");
        else
            printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 20240
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long

int main() {
    IO;
    // int n;
    // cin>>n;
    // while(n>0){
    //     int tmp = n/26;
    //     if(tmp>0){
    //         cout<<'a';
    //         n = tmp;
    //     }
    //     else{
    //         cout<<char(n+'a'-1);
    //         break;
    //     }

    // }
    int a,tmp;
    ll ans = 0;
    cin>>a;
    vector<int> v(100005,0);
    for(int i=0;i<a;i++){
        cin>>tmp;
        v[tmp]++;
        ans +=tmp;
    }

    int q;
    cin>>q;
    int b,c;
    vector<ll> qqq(q, 0);
    for(int i=0;i<q;i++){
        cin>>b>>c;
        ans = ans+v[b]*(c-b);

        v[c] += v[b];
        v[b] = 0;
        qqq[i] = ans;

    }

    for(int i = 0; i < q; i++){
        cout << qqq[i] << endl;
    }

    return 0;

}




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

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

    ll a = 0;
    ll b = 0;
    ll c = 0;
    ll n = s.size();
    rep(i, n){
        if (s[i] == 'a'){
            a++;
        }else if (s[i] == 'b'){
            b++;
        }else if (s[i] == 'c'){
            c++;
        }
    }

    ll mi = min(min(a, b), c);
    if (a - mi > 1 || b - mi > 1 || c - mi > 1){
        puts("NO");
        return 0;
    }

    puts("YES");

    return 0;
}


Measured memory_bytes: 3676
import java.util.Scanner;

class Main {

    int[] abc;

    Main(int[] abc) {
        this.abc = abc;
    }

    String solve() {

        final String YES = "YES";
        final String NO = "NO";

        int n5 = 0;
        int n7 = 0;

        for (int i = 0; i < 3; i++) {
            if (abc[i] == 5) {
                n5++;
            } else if (abc[i] == 7) {
                n7++;
            }
        }

        if (n5 == 2 && n7 == 1) {
            return YES;
        } else {
            return NO;
        }
    }

    public static void main(String args[]) {
        // input
        int[] abc = new int[3];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            abc[i] = sc.nextInt();
        }
        sc.close();

        // solve
        String greeting = new Main(abc).solve();

        // display
        System.out.println(greeting);
    }
}

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

int main(void){
	int n,k;
	cin>>n>>k;

	while(k--){
		int x,y;
		cin>>x>>y;

		int width = min(x,n-x+1);
		int hight = min(y,n-y+1);

		if(hight > width){
			cout<<(width - 1) % 3 + 1<<endl;
		}
		else{
			cout<<(hight - 1) % 3 + 1<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    a,b=map(int,input().split())
    if(1<=a<=9 and 1<=b<=9):
        print(a*b)
    else:
        print(-1)
resolve()

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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
int CountAB(string s) {
  int counter = 0;
  auto pos = s.find("AB");
  while(pos != string::npos) {
    ++counter;
    pos = s.find("AB",pos+2);
  }
  return counter;
}
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  string ss[n];
  REP(i,n) {
    cin >> ss[i];
  }
  int inside_count = 0;
  int head_count = 0, tail_count = 0;
  int both_count = 0;
  REP(i,n) {
    string s;
    s = ss[i];
    if(s[0] == 'B' && s[s.size()-1] == 'A') ++both_count;
    else if(s[0] == 'B') ++head_count;
    else if(s[s.size()-1] == 'A') ++tail_count;
    inside_count += CountAB(s);
  }
  if(head_count+tail_count == 0) {
    cout << inside_count + max(0LL, both_count-1);
  } else {
    cout << inside_count + both_count + min(head_count, tail_count);
  }
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 768
def min(a,b); a < b ? a : b; end
INF = 10**12
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@m,@r = gets.split.map(&:to_i)
    @r = gets.split.map(&:to_i).map{ _1 - 1 }
    @g = Array.new(n){ Array.new(n,INF) }
    n.times do |i|
      g[i][i] = 0
    end
    m.times do
      a,b,c = gets.split.map(&:to_i)
      a -= 1
      b -= 1
      g[a][b] = c
      g[b][a] = c
    end
  end

  def rec
    n.times do |k|
      n.times do |i|
        n.times do |j|
          g[i][j] = min(g[i][j], g[i][k] + g[k][j])
        end
      end
    end
  end

  def solve
    rec
    ans = INF
    r.permutation do |a|
      cnt = a.each_cons(2).sum do |i,j|
        g[i][j]
      end
      ans = cnt if cnt < ans
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

Measured memory_bytes: 14684
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int n;
	cin >> n;
	cin.ignore();
	rep(i,n)
	{
		string s;
		getline(cin,s);

		if(s.length() < 6)
		{
			cout << s << endl;
		}
		else
		{
			rep(j,s.length()-6)
			{
				if(s[j] == 'H' && s[j+1] == 'o' && s[j+2] == 's' && s[j+3] == 'h' && s[j+4] == 'i' && s[j+5] == 'n' && s[j+6] == 'o')
				{
					s[j+6] = 'a';
					j += 6;
				}
			}
			cout << s << endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 1208
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	fastio();
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
}


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

int main(){
  vector<int> x(3,0);
  REP(i,3) cin>>x.at(i);
  sort(x.begin(),x.end());
  cout<<x.at(0)+x.at(1);  
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

class Program
{

	static void Main(string[] args)
	{
		int a = int.Parse(Console.ReadLine());

		if (a >= 30)
		{
			Console.WriteLine("Yes");
		}
        else
        {
			Console.WriteLine("No");

        }
    }
}

Measured memory_bytes: 27540
#include <bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
typedef long long ll;
typedef pair <int, int> ii;
#define X first
#define Y second
#define mk make_pair
#define Rep(i, n) for(int i = 0; i < int(n); i ++)
const int MOD = (int) 1e9 + 7;
void MAIN();
int main(){
   //freopen("input.txt", "r", stdin);

   MAIN();
   return 0;
}
//////////////////////////////////////////////////////////////////////////

const int N = (int) 1e5 + 32;

int n, a, b[N], cntb;

void MAIN(){
    scanf("%d", &n);
    int pre = -1;
    Rep(i, n){
        scanf("%d", &a);
        if(a != pre) b[++cntb] = 1;
        else b[cntb] ++;
        pre = 1-a;
    }
    int ans = 0;
    for(int i = 1; i <= cntb; i ++){
        ans = max(ans, b[i] + b[i+1] + b[i+2]);
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1388
// 解説を見なかった

#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <numeric>

using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int cnt[100010];

int main() {
    int N;
    ll dup = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        cnt[a]++;
        if (cnt[a] >= 2) {
            dup++;
        }
    }

    N -= dup;
    if (dup % 2 == 1) N -= 1;

    cout << N << endl;

    return 0;
}

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

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

    int v[n], c[n], ans = 0;
    rep(i, n){
        cin >> v[i];
    }
    rep(i, n){
        cin >> c[i];
    }

    rep(i, n){
        if(v[i] - c[i] > 0)
            ans += v[i] - c[i];
    }

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


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

void solve()
{
    ll l,r,d;
    cin>>l>>r>>d;
    ll c=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
            c++;
    }   
    cout<<c<<endl;
}
int main()
{
        solve();
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
int P(int i) {
    int ten = 1;
    rep(d, i) {
        ten *= 10;
    }
    return ten;
}

int ans = 0;
ll n;
void dfs(int keta, ll nm, int use) {

    for (int i = 3; i <= 7; i += 2) {
        ll number = nm + (double)i * P(keta);
        int U=use;
        if (number > n)
            continue;
        if (i == 3)
            U = U | 0b001;
        else if (i == 5)
            U = U | 0b010;
        else if (i == 7)
            U = U | 0b100;
        //cout << "nm==" << number << " use==" << U << endl;
        if (U == 0b111) {
            ans++;
        }
        dfs(keta + 1, number, U);
    }
}

int main() {
    cin >> n;

    dfs(0, 0, 0);
    cout << ans << endl;

    return 0;
}


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

int int_pow(int a, int x)
{
	int i = 0;
	int r = 1;
	while (i < x)
	{
		r = r*a;
		i++;
	}
	return (r);
}
int main (void)
{
	int n, m;
	scanf("%d %d",&n,&m);
	int *k;
	k = (int *)malloc(sizeof(int)*(m));
	int **s;
	s = (int **)malloc(sizeof(int *)*(m));
	int i = 0;
	int j = 0;
	while (i < m)
	{
		j = 0;
		scanf("%d", &(k[i]));
		s[i] = (int *)malloc(sizeof(int)*(k[i]));
		while (j < k[i])
		{
			scanf("%d",&(s[i][j]));
			j++;
		}
		i++;
	}
	i = 0;
	j = 0;
	int *p;
	int on = 0;
	int l = 0;
	p = (int *)malloc(sizeof(int)*(m));
	while (i < m)
	{
		scanf("%d",&p[i]);
		i++;
	}
	int sum = 0;
	i = 0;
	int dig[10];
	//printf("debug0002000\n");
	while (i < int_pow(2,n))
	{
		j = 0;
		//printf("i:%d, j:%d\n",i,j);
		while (j < 10)
		{
			//printf("debug 00090 j:%d\n",j);
			dig[j] = (i/int_pow(2,j))%2;
			j++;
		}
		j = 0;
		//printf("debug 00100 i:%d, j:%d\n",i,j);
		while (j < m)
		{
			l = 0;
			on = 0;
			while (l < k[j])
			{
				if (dig[s[j][l]-1] == 1 )
					on++;
				l++;
			}
			if(on%2 != p[j])
				break;
			j++;
		}
		if (j == m)
			sum++;
		//printf("sum:%d, i:%d\n",sum,i);
		i++;
	}
	printf("%d\n",sum);
	return (0);
}


Measured memory_bytes: 128
from sys import stdin

A, B, C, K = map(int, stdin.readline().split())

num = 0
if A >= K:
  num = K
  print(num)
else:
  num += A
  K -= A
  if B >= K:
    print(num)
  else:
    K -= B
    num -= K
    print(num)

Measured memory_bytes: 9188
#include<iostream>
using namespace std;
int main() {
	int N,a=0,b=0;
	string S;
	cin >> N >> S;
	for(int i=0; i<N; i++) {
		if(S.at(i) == '#')
			a++;
		else if(S.at(i) == '.' && a>0) {
			b++;
			a--;
		}
	}
	cout << b << endl;
}


Measured memory_bytes: 640
#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() {
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++)
    {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
# O(n^2)解法 サンプルテスト用
def sample():
    cnt = 0
    for i in range(N):
        for j in range(i+1,N+1):
            part = A[i:j]
            if sum(part) % M == 0:
                cnt += 1
    return cnt 

def candidate():
    import itertools
    from collections import Counter
    acc = itertools.accumulate(A)
    acc = [e % M for e in acc]
    cnt_dict = {}
    res = 0
    for e in acc:
        if e == 0:
            res += 1
        if e in cnt_dict:
            cnt_dict[e] += 1
        else:
            cnt_dict[e] = 0
        res += cnt_dict[e]
    return res
    
def run():
    sample_ans = sample()
    candidate_ans = candidate()
    print("sample:",sample_ans,end = ", ")
    print("candidate:",candidate_ans)
    if sample_ans == candidate_ans:
        print("candidateの解法は正しいです")
    else:
        print("candidateの解法は誤りです") 

N,M = map(int,input().split())
A = list(map(int,input().split()))
print(candidate())

Measured memory_bytes: 16556