akhauriyash/Code-Regression huggingface dataset:
/* Atcoder abc167a
 * See tasks at: https://atcoder.jp/contests/abc167/tasks/abc167_a
 */
#include <bits/stdc++.h>

#define until(symbol, max) for (int symbol = 0; (symbol) < (max); (symbol)++)

using namespace std;
using ll = long long;
int main()
{
    string s, t;
    cin >> s >> t;

    if (t.substr(0, t.length() - 1) == s)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    int a[m];
    bool ispay[n+1];
    rep(i, n+1)ispay[i] = false;
    rep(i, m){
        cin >> a[i];
        ispay[a[i]] = true;
    }

    int front, back;
    front = back = 0;
    for(int i = x; i <= n; i++)if(ispay[i])front++;
    for(int i = x; i >= 0; i--)if(ispay[i])back++;

    cout << min(front, back);
}

Measured memory_bytes: 256
import java.io.*;
// import java.math.*;
// import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String S = reader.readLine();
        Boolean flg = false;
        for (int i = 1; i < S.length(); i++) {
            if (S.charAt (i - 1) == S.charAt (i)) {
                flg = true;
                break;
            }
        }
        System.out.println (flg ? "Bad" : "Good");
        return;
    }
}

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

main()
{
  int n,a,b;
  int ans=0;

  cin >> n >> a >> b;
  for(int i=1;i<=n;i++){
    int c=i;
    int add=i;
    int sum=0;
    while(c!=0){
      sum+=c%10;
      c/=10;
    }
    if(sum>=a&&sum<=b)
      ans+=add;
  }

  cout << ans << endl;

  return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n,m;
	cin>>n>>m;

	lli flag[100100];
	lli boal[100100];

	REP(i,0,100100){
		flag[i]=0;
		boal[i]=1;
	}
	flag[0]=1;

	REP(i,0,m){
		lli x,y;
		cin>>x>>y;
		x--;y--;
		if(flag[x]==1) flag[y]=1;
		
		boal[x]--;
		boal[y]++;
		if(boal[x]==0) flag[x]=0;
	}

	lli sum=0;
	REP(i,0,n) sum+=flag[i];
	
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int rank, maisuu, i;
  for(i=0; i<4; i++){
  scanf("%d%d",&rank,&maisuu);
  switch(rank){
  case 1:
    printf("%d\n",maisuu*6000);
    break;
  case 2:
    printf("%d\n",maisuu*4000);
    break;
  case 3:
    printf("%d\n",maisuu*3000);
    break;
  case 4:
    printf("%d\n",maisuu*2000);
    break;
  }
  }
  return 0;
}

Measured memory_bytes: 596
import sys
readline = sys.stdin.readline

import heapq
  
T = int(readline())
for t in range(T):
  N,A,B,C,D = map(int,readline().split())
  q = [(0,N)]
  heapq.heapify(q)
  seen = set()
  while q:
    cost,n = heapq.heappop(q)
    if n in seen:
      continue
    if n == 0:
      print(cost)
      break
    seen.add(n)
    heapq.heappush(q, (cost + n * D, 0))
    if n % 2 == 0:
      heapq.heappush(q, (cost + A, n // 2))
    else:
      heapq.heappush(q, (cost + D + A, (n + 1) // 2))
      heapq.heappush(q, (cost + D + A, (n - 1) // 2))
      
    if n % 3 == 0:
      heapq.heappush(q, (cost + B, n // 3))
    else:
      rest = n % 3
      heapq.heappush(q, (cost + rest * D + B, (n - rest) // 3))
      heapq.heappush(q, (cost + (3 - rest) * D + B, (n + (3 - rest)) // 3))
      
    if n % 5 == 0:
      heapq.heappush(q, (cost + C, n // 5))
    else:
      rest = n % 5
      heapq.heappush(q, (cost + rest * D + C, (n - rest) // 5))
      heapq.heappush(q, (cost + (5 - rest) * D + C, (n + (5 - rest)) // 5))


Measured memory_bytes: 12840
using System;
using System.Collections.Generic;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		var hs=new Dictionary<long,long>();
		for(int i=0;i<s[0];i++){
			long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
			if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
			else{hs.Add(q[0],q[1]);}
		}
		List<long> kl=new List<long>(hs.Keys);
		kl.Sort();
		foreach(long k in kl){
			s[1]-=hs[k];
			if(s[1]<1){Console.WriteLine("{0}",k);break;}
		}
	}
}

Measured memory_bytes: 19652
n=int(input())
test="abcdefghijklmnopqrstuvwxyz"
c=[[0for i in range(n)]for j in range(26)]
for j in range(n):
  s=input()
  for i in range(26):
    c[i][j]+=list(s).count(test[i])
minl=[]
for i in range(26):
  minl.append(min(c[i]))
outp=""
#print(minl)
for i in range(26):
  outp+=test[i]*minl[i]
print(outp)

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

int main(){
  int n, l, s = 0, m = (int)1e9;
  cin >> n >> l;
  rep(i, n) {
    s += l + i;
    if(abs(m) > abs(l + i)) m = l + i;
  }
  cout << s - m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, M;
    cin >> N;
    set<pair<int,int>> R;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        R.insert({x,y});
    }
    set<pair<int,int>> B;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        B.insert({x,y});
    }
/*
    for (auto x : R) {
        printf("%d,%d\n", x.first, x.second);
    }
    cout << endl;
    for (auto x : B) {
        printf("%d,%d\n", x.first, x.second);
    }
*/
   int res = 0;
   for (auto a : B) { 
       bool hit = false;
       pair<int,int> ma = {-1, -1}; // max abcd is 2N = 200
       for (auto b : R) {
           if (a.first <= b.first) break;
           if (a.second > b.second) if (b.second > ma.second) {ma = b; hit = true;} 
       }
       if (hit) {
        R.erase(ma);
        res++;
       }
   }
   cout << res << endl;
}

Measured memory_bytes: 256
import sys
N, K = map(int, input().split())
d = list(map(str, input().split()))
D = set(d)
for i in range(N, 1000000):
    S = set(str(i))
    T = True
    for s in S:
        if s in D:
            T = False
            break
    if T:
        print(i)
        break

Measured memory_bytes: 9016
#include<stdio.h>
int main(){

  double r;
  scanf("%lf", &r);

  double s,l,pi;

  pi = 3.141592653589793238;

  s = pi * r * r;
  
  l = pi * r * 2;
  
  printf("%.8lf %.8lf\n", s, l);

  return 0;

}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int k;
    cin>>k;
    long long int p=100,s=0;
  while(p<k){
    p+=(p/100);
    s++;
  }
  cout<<s<<"\n";
    return 0;
}

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif

ll culc(ll a, ll b)
{
	ll c = a % b;
	while (c) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}

int main()
{
	CIN(int, N);
	CIN(ll, T);
	ll res = T;
	rep(i, N-1) {
		cin >> T;
		res = (res / culc(res, T)) * T;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
import copy
import time

N, A, B = map(int, input().split(' '))

trouts_org = [(i + 1) for i in range(N)]


cond = 0 # Aliceの先攻
cont = True # ゲームを続ける
start = time.time() # スタート時間

while cont:
    trouts_now = copy.deepcopy(trouts_org)
    trouts_now.remove(A)
    trouts_now.remove(B)
    
    if cond == 0:
        if (B - A - 1) == 0:
            if (A - 1) in trouts_now:
                A -= 1
            else:
                print('Borys')
                cont = False            
        
        elif (B - A - 1) % 2 == 1:
            if (A + 1) in trouts_now:
                A += 1
            elif (A - 1) in trouts_now:
                A -= 1
            else:
                print('Borys')
                cont = False
                
        elif (B - A - 1) % 2 == 0:
            if (A - 1) in trouts_now:
                A -= 1
            elif (A + 1) in trouts_now:
                A += 1
            else:
                print('Borys')
                cont = False
        
        cond = 1
    
    else:
        if (B - A - 1) == 0:
            if (B + 1) in trouts_now:
                B += 1
            else:
                print('Alice')
                cont = False 
                
        elif (B - A - 1) % 2 == 1:
            if (B - 1) in trouts_now:
                B -= 1
            elif (B + 1) in trouts_now:
                B += 1
            else:
                print('Alice')
                cont = False
                
        elif (B - A - 1) % 2 == 0:
            if (B + 1) in trouts_now:
                B += 1
            elif (B - 1) in trouts_now:
                B -= 1
            else:
                print('Alice')
                cont = False
                
        cond = 0
        
    
    now = time.time()
    if now - start > 5:
        print('Draw')
        cont = False

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

#define UNFAIR 1000000000000000000

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

    if(K % 2 == 0){
        if(A - B > UNFAIR)
            cout << "unfair" << endl;
        else 
            cout << A - B << endl;
    }else{
        if(B - A > UNFAIR)
            cout << "unfair" << endl;
        else
            cout << B - A << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	string S;
	int i;
	for (i = 0; i < 3; i++)cin >> S[i];
	if (S[0] == 'S' && S[1] == 'S' && S[2] == 'S') { cout << 0 << endl; }
	else if (S[0] == 'S'&& S[1] == 'S'&& S[2] == 'R') { cout<<1<<endl; }
	else if (S[0] == 'S' && S[1] == 'R' && S[2] == 'S') { cout<<1<<endl; }
	else if (S[0] == 'S' && S[1] == 'R' && S[2] == 'R') { cout<<2<<endl; }
	else if (S[0] == 'R' && S[1] == 'S' && S[2] == 'S') { cout<<1<<endl; }
	else if (S[0] == 'R' && S[1] == 'S' && S[2] == 'R') { cout<<1<<endl; }
	else if (S[0] == 'R' && S[1] == 'R' && S[2] == 'S') { cout<<2<<endl; }
	else if (S[0] == 'R' && S[1] == 'R' && S[2] == 'R') { cout<<3<<endl; }
	
	

	return 0;
}

Measured memory_bytes: 3620
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S, T;
    cin >> S >> T;

    REP(i, S.size()) {

        bool f_tmp = true;

        REP(j, S.size() - i) {
            if (S[i + j] != T[j]) f_tmp = false;
        }

        REP(j, i) {
            if (S[j] != T[S.size() - i + j]) f_tmp = false;
        }

        if (f_tmp) {
            print("Yes");
            return 0;
        }
    }

    print("No");

}


Measured memory_bytes: 256
import java.util.*;

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

        if (a>8 || b>8)
            System.out.println(":(");
        else
            System.out.println("Yay!");
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <memory.h>
using namespace std;

int h,w;
string s[2005];
int a[2005][2005];
int ht[2005][2005];
int l[2005],r[2005];

int main(){
	scanf("%d %d",&h,&w);
	for(int i=0;i<h;i++) cin>>s[i];
	for(int i=0;i<h-1;i++){
		for(int j=0;j<w-1;j++){
			int sum=0;
			for(int x=0;x<2;x++){
				for(int y=0;y<2;y++){
					sum+=s[i+y][j+x]=='#'?1:0;
				}
			}
			if(sum%2==0) a[i][j]=1;
		}
	}
	for(int i=0;i<h-1;i++){
		for(int j=0;j<w-1;j++){
			if(a[i][j]==1){
				if(i>0) ht[i][j]=ht[i-1][j]+1;
				else if(i==0) ht[i][j]=1;
			}
		}
	}
	int maxt=max(h,w);
	for(int i=0;i<h-1;i++){
		stack<int> stk1;
		for(int j=0;j<w-1;j++){
			while(!stk1.empty()&&ht[i][stk1.top()]>=ht[i][j]) stk1.pop();
			if(stk1.empty()) l[j]=0;
			else l[j]=stk1.top()+1;
			stk1.push(j);
		}
		stack<int> stk2;
		for(int j=w-2;j>=0;j--){
			while(!stk2.empty()&&ht[i][stk2.top()]>=ht[i][j]) stk2.pop();
			if(stk2.empty()) r[j]=w-2;
			else r[j]=stk2.top()-1;
			stk2.push(j);
		}
		for(int j=0;j<w-1;j++){
			maxt=max(maxt,(ht[i][j]+1)*(r[j]-l[j]+2));
		}
	}
	printf("%d\n",maxt);
return 0;
}

Measured memory_bytes: 35712
#include<stdio.h>
int main()
{
int a,b,c,max,mid,min;
scanf("%d %d %d",&a,&b,&c);

if(c>=a&&a>=b){
max=c;
mid=a;
min=b;
}
else if(a>=c&&c>=b){
max =a;
mid =c;
min =b;
}

else if(a>=b&&b>=c){
max=a;
mid=b;
min=c;
}

else if(c>=b&&b>=a){
max=c;
mid=b;
min=a;
}

else if(b>=c&&c>=a){
max =b;
mid =c;
min =a;
}

else if(b>=a&&a>=c){
max=b;
mid=a;
min=c;
}
 printf("%d %d %d\n",min,mid,max);
}

Measured memory_bytes: 1780
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN=3e3+1;
void solve(){
   vector<int> v(3);int n;
   for(auto &it:v)cin>>it;
   cin>>n;
   int cnt=0;
   //use O(n^2) searching 
   for(int i=0;i<MAXN;i++){
	   for(int j=0;j<MAXN;j++){
		     int val=i*v[0]+j*v[1];
		     if(n>=val and (n-val)%v[2]==0)cnt++;
		  } 
	   	 }
   cout<<cnt<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	string s, t;
	cin >> s >> t;
	if (s == t.substr(0, t.size() - 1)) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

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


Measured memory_bytes: 3644
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;

int main(){
	const int M=1000000007;
	int N,W;
	scanf("%d%d",&N,&W);
	vector<int>w(N+1);
	vector<vector<int> >bag(N+1);
	bag[0].resize(W+1);bag[0][0]=1;
	for(int i=0;i<N;i++){
		scanf("%d",&w[i]);
		bag[i+1].resize(W+1);
	}
	sort(w.begin(),w.end(),greater<int>());
	for(int i=0;i<N;i++){
		for(int j=W;j>=0;j--)bag[i+1][j]=(bag[i][j]+(j>=w[i]?bag[i][j-w[i]]:0))%M;
	}
	int s=0,r=0;
	for(int i=N-1;i>=0;s+=w[i--])for(int j=max(0,W-s-w[i]+1);j<=W-s-w[i+1];j++){
		r=(r+bag[i+1][j])%M;
	}
	printf("%d\n",r);
}

Measured memory_bytes: 8660
#![allow(non_snake_case)]

use std::collections::{BTreeMap, BinaryHeap};
use std::io::Read;
use std::ops::AddAssign;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let S: Vec<i32> = (0..(1 << n))
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();
    let mut counter = BTreeMap::new();

    for s in S {
        counter.entry(s).or_insert(0).add_assign(1);
    }

    let mut ranges = BinaryHeap::new();
    ranges.push(n);
    for key in counter.keys().rev() {
        let &count = counter.get(key).unwrap();
        if count > ranges.len() {
            println!("No");
            return;
        } else {
            let mut tmp = vec![];
            for _ in 0..count {
                let v = ranges.pop().unwrap();
                for i in 0..v {
                    tmp.push(i);
                }
            }
            ranges.extend(tmp);
        }
    }
    println!("Yes");
}


Measured memory_bytes: 16632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

int n,k;
int h[100010];
int f[100010];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&h[i]);
		f[i]=1e9;
	}
	f[1]=0;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			if(i-j>0)
			{
				f[i]=min(f[i],f[i-j]+abs(h[i]-h[i-j]));
			}
		}
	}
	printf("%d",f[n]);
	return 0;
}





Measured memory_bytes: 1024
n = int(input())
h = list(map(int, input().split()))
ans = [0]+[abs(h[0] - h[1])]+[float('inf')] * (n - 2)
for i in range(2, n):
    ans[i] =  min(ans[i], ans[i-1] + abs(h[i] - h[i - 1]))
    ans[i] =  min(ans[i], ans[i-2] + abs(h[i] - h[i - 2]))
print(ans[-1])

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

int cmp(const void *a, const void *b) {
	int x = *(float*)a;
	int y = *(float*)b;
	if(x > y) return 1;
	else if(x < y) return -1;
	else return 0;
}

int main(int argc, char const* argv[])
{
	int n, i;
	float a[50];
	scanf("%d",&n);
	for(i=0; i<n; i++) {
		scanf("%f",a+i);
	}
	qsort(a, n, sizeof(float), cmp);
	for(i=0; i<n-1; i++) {
		a[i+1] = (a[i] + a[i+1])/2;
	}
	printf("%f", a[n-1]);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define l long long
int main()
{
    l a,b,c,k,ans;
    cin>>a>>b>>c>>k;
    ans+=min(a,k);
    k=k-(a+b);
    if(k>0)
        ans-=k;
    cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
//#define MOD 1000000007
const int INF = 1LL<<30;

int main() {
    double n,m,d;
    cin>>n>>m>>d;
    double x;
    if(d==0) x=n;
    else x=2*(n-d);
    double ans=(x/(n*n))*(m-1);

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

}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <iomanip>
using namespace std;
#define sL(i) i << 1
#define sR(i) i << 1 | 1
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>, int> ppi;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;

int h, w;
char grid[55][55];
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> grid[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(grid[i][j] == '.') continue;
            bool good = false;
            good |= i > 0 && grid[i-1][j] == '#';
            good |= i + 1 < h && grid[i+1][j] == '#';
            good |= j > 0 && grid[i][j-1] == '#';
            good |= j + 1 < w && grid[i][j+1] == '#';
            if(!good){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='+')c++;
        else c--;
    }
    cout<<c<<endl;
    return 0;
}


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

int dig(int n){
    int ans[10],i = 0;
    while(n > 0){
        ans[i] = n % 10;
        i++;
        n /= 10;
    }
}

int main(void){
    int n,ans[3], i = 0;
    cin >> n;
    while(n > 0){
        ans[i] = (n%10);
        if(ans[i] == 1){
            ans[i] = 9;
        }else if(ans[i] == 9){
            ans[i] = 1;
        }
        n /= 10;
        i++;
    }
    cout << ans[2]<<ans[1]<<ans[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    for i in range(K):
        dm = [0]*(N+1)
        for x in range(N):
            dm[max(x - A[x],0)]+=1
            dm[min(x+A[x]+1,N)]-=1
        for j in range(1,N+1):
            dm[j]+=dm[j-1]
        if A[:] == dm[:N]:
            break
        A[:] = dm[:N]
    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()


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

int main(){
    string S; cin >> S;
    bool ans=true;
    int c_count = 0;
    if (S[0]!='A') ans = false;
    for (int i=1;i<S.size();i++){
        if (islower(S[i])) continue;
        else if (S[i]=='C'&&i!=1&&i!=S.size()-1){
            if (c_count) ans=false;
            else  c_count++; 
        }
        else ans = false;
    }
    cout << ((ans&&c_count)? "AC" : "WA") << endl;
}

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

using namespace std;

typedef long long ll;

int n ;
ll  b , a;
ll  h[100001],c[100001];

ll cel(int a , int b){
	return a/b + (a%b != 0);
}
bool check(ll mid){
	for (int i = 0; i < n; ++i){
		c[i] = h[i] - mid * b;
	}
	ll rem = mid;
	for (int i = 0; i < n; ++i){
		if(c[i] > 0){
			ll need = min(rem,cel(c[i],a));
			c[i] -= need * 1ll* a;
			rem -= need;
		}
		if(c[i] > 0)
			return 0;
	}
	return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	scanf("%d%lld%lld",&n,&a,&b);
	for (int i = 0; i < n; ++i){
		scanf("%lld",&h[i]);
	}
	a-= b;
	ll lo = 0 , hi = 1e9;
	ll best = -1;
	while(lo <= hi){
		ll mid = (lo + hi)/2;
		if(check(mid)){
			best = mid;
			hi = mid -1;
		}else{
			lo = mid + 1;
		}
	}
	cout << best << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define dbg(x) cerr << ">>> " << x << endl
#define _ << ", " <<

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  std::string str;
  std::cin >> str;
  int cnt = 0;
  long long ans = 0;
  for(auto c : str) {
    if(c == 'B') {
      cnt++;
    } else {
      ans += cnt;
    }
  }
  std::cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s << "[";
    for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i];
    s << "]";
    return s;
}

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

struct UnionFind {
    vector<int> parent;
    int set_num;

    UnionFind(int n) {
        parent.resize(n, -1);
        set_num = n;
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);

        if (x != y) {
            if (size(x) < size(y)) swap(x, y);
            parent[x] += parent[y];
            parent[y] = x;
            set_num--;
        }
    }

    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    int find(int x) {
        if (parent[x] < 0) {
            return x;
        }
        return parent[x] = find(parent[x]);
    }

    int size(int x) {
        return -parent[find(x)];
    }

    int size() {
        return set_num;
    }
};

int main() {
    const int MAXN = 400;
    static ll a[MAXN][MAXN], dist[MAXN][MAXN];
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> a[i][j];
            dist[i][j] = a[i][j];
        }
    }

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (dist[i][j] != a[i][j]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    vector<tuple<ll, int, int>> edges;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            edges.push_back(make_tuple(dist[i][j], i, j));
        }
    }
    sort(ALL(edges));
    ll sum = 0;
    for (int i = 0; i < edges.size(); i++) {
        ll cost;
        int u, v;
        tie(cost, u, v) = edges[i];

        bool flag = false;
        for (int k = 0; k < N; k++) {
            if (k == u or k == v) continue;
            if (dist[u][v] == dist[u][k] + dist[k][v]) {
                flag = true;
                break;
            }
        }
        if (flag) continue;
        sum += cost;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3320
n,m,k = map(int,input().split())
cut = [[] for i in range(n)]

par = [i for i in range(n)]
rank = [0]*n
size = [1]*n

def find(x, par):
    if x == par[x]:
        return x
    else:
        x = par[x]
        return find(x, par)
def unite(x, y, par, rank, size):
    x = find(x, par)
    y = find(y, par)
    if x != y:
        if rank[x] < rank[y]:
            par[x] = y
            size[y] += size[x]
        else:
            par[y] = x
            size[x] += size[y]
            if rank[x] == rank[y]:
                rank[x] += 1

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a, b, par, rank, size)
    cut[a].append(b)
    cut[b].append(a)
for i in range(k):
    c,d = map(int,input().split())
    c -= 1
    d -= 1
    if find(c, par) == find(d, par):
        cut[c].append(d)
        cut[d].append(c)
ans = []
for i in range(n):
    ans.append(size[find(i,par)]-len(cut[i])-1)
print(' '.join(map(str,ans)))


Measured memory_bytes: 42852
#!/usr/bin/env python3

def solve(x):
    if x == 1:
        return 1
    f = 2
    l = [1]
    while f * f <= x:
        d = f
        while d <= x:
            l.append(d)
            d *= f
        f += 1
    return max(l)



def main():
    X = int(input())
    print(solve(X))
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  string S, T;
  cin >> S >> T;
  int count = 0;
  REP(i, 3) {
    if (S[i] == T[i]) count++;
  }
  cout << count << '\n';
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  map<ll,ll>M;
  rep(i,n)M[a[i]]++;
  ll sum=0;
  for(auto p:M){
    sum+=p.second*(p.second-1)/2;
  }
  rep(i,n){
    cout<<sum-M[a[i]]*(M[a[i]]-1)/2+(M[a[i]]-2)*(M[a[i]]-1)/2<<endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    bool judge = false;
    for(int i = 1; i < 10; i++){
        for(int j = i; j < 10; j++){
            if(i * j == n){
                judge = true;
                break;
            }
        }
    }
    if(judge) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int seisu1,seisu2,i;//?????°?????????
	for(i=1;i<=3000;i++){//??\?????¨??¨?????????????????????
		scanf("%d%d",&seisu1,&seisu2);
		if(seisu1==0&&seisu2==0){
			break;
		}
		if(seisu1>seisu2){
			printf("%d %d\n",seisu2,seisu1);
		}else{
			printf("%d %d\n",seisu1,seisu2);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main() {
    
    int n;
    int count = 0;
    
    cin >> n;
    
    int a[n];
    
    for (int h = 0; h < n; h ++) {
        
        cin >> a[h];
    
    }
    
    for (int i = 0; i < n; i ++) {
        
        int minj = i;
        
        for (int j = i; j < n; j ++) {
            
            if (a[j] < a[minj]) {
                
                minj = j;
                
            }
        }
        
        int k = a[i];
        
        a[i] = a[minj];
        
        a[minj] = k;
        
        if (i != minj) {
            
            count += 1;
            
        }
        
    }
    
    for (int j = 0; j < n; j ++) {
        
        if (j == n-1) {
            
            cout << a[j] << endl;
            
        } else {
            
            cout << a[j] << " ";
            
        }
        
    }
        
        cout << count << endl;
        
    
    
    return 0;

}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int N;
  int a,b,c;
  int p[]={3,5,7,11,13};
  int ans=0;
  cin >> N;
  LOOP(i,5){
    FOR(j,i+1,5){
      FOR(k,j+1,5){
        if(p[i]*p[j]*p[k] <= N) ans++;
        else          break;
      }
    }
  }
	if(3*3*3*5 <= N)ans++;
	if(3*3*3*7 <= N)ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC103.B
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            var s = sc.Next();
            var t = sc.Next();
            for (int i = 0; i < s.Length; i++)
            {
                s = s[s.Length - 1] + s.Substring(0, s.Length - 1);
                if (s == t)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
    class Scanner
    {
        string[] s;
        long i;

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

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

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

        public int Nextint()
        {
            return int.Parse(Next());
        }
        public int[] Arrayint(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Nextint() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

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

        public double NextDouble()
        {
            return double.Parse(Next());
        }

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

        public decimal NextDecimal()
        {
            return decimal.Parse(Next());
        }

        public decimal[] ArrayDecimal(long N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDecimal();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{ 
     long int n;
      scanf("%ld",&n);
     long int i,ans=0,num=0;
  for(i=n;i>=1;--i)
  {
     ans=sqrt(i);
     if((ans*ans)==i)
     { num=i;
        break;
     }
  }
  
  printf("%ld",num);
                
}

Measured memory_bytes: 256
//Robs Code
#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define all(x) x.begin(),x.end()
#define ed cout<<"\n";
#define pb push_back
#define pii pair<int,int>
#define _1 first
#define _2 second
#define maxi 100000007
/**********************************************************/
using namespace std;
int i,j,k,n,m,q,t,a,b,cnt,sum,tot;
signed main() 
{
    speed;
    cin>>a>>b;
    if(a==b){
        cout<<2*a;
    }else{
        cout<<2*max(a,b)-1;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int N;
set <int> s;
int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    s.insert(a);
  }
  cout << s.size();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int n,Z[50];
int kansu(int a,int b){
  if(b==0) return 1;
  if( a >= n) return 0;
  int res = kansu(a+1,b) || kansu(a+1,b-Z[a]);
  return res;
}
int main(){
  int i,j,k;

  scanf("%d",&n);
  for(i=0;i <n;i++){
    scanf("%d",&Z[i]);
  }
  scanf("%d",&j);
  for(i=0; i < j; i++){
    scanf("%d",&k);
    if(kansu(0,k))printf("yes\n");
    else printf("no\n");

    
  }
  return 0;
}



Measured memory_bytes: 2104
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = float("inf")
for i in range(1,2**n):
    l = [j for j in range(n) if i>>j&1]
    if l[0] != 0 or len(l) != k:
        continue
    m = 0
    s = 0
    for j in range(n):
        if (j in l) and (a[j] <= m):
            s += m+1-a[j]
            m += 1
        m = max(m,a[j])
    #print(l,s)
    ans = min(ans,s)

print(ans)

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

namespace Distance_II
{
    class Program
    {
        static void Main(string[] args)
        {
            int times = int.Parse(Console.ReadLine());
            string[] line1 = Console.ReadLine().Split(' ');
            string[] line2 = Console.ReadLine().Split(' ');
            double[] nums1 = new double[times];
            double[] nums2 = new double[times];


            for (int i = 0; i < times; i++)
            {
                nums1[i] = double.Parse(line1[i]);
                nums2[i] = double.Parse(line2[i]);
            }

            double[] diff = nums1.Select((x, index) => Math.Abs(x - nums2[index])).ToArray();

            double r1 = diff.Sum();
            double r2 = Math.Sqrt(diff.Sum(x => Math.Pow(x, 2)));
            double r3 = Math.Pow(diff.Sum(x => Math.Pow(x, 3)), 1 / 3d);
            double r4 = diff.Max();

            Console.WriteLine("{0:f6}",r1);
            Console.WriteLine("{0:f6}",r2);
            Console.WriteLine("{0:f6}",r3);
            Console.WriteLine("{0:f6}",r4);


        }
    }
}



Measured memory_bytes: 20616
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;

int main() {
	
	string str;
	int cnt = 1;
	cin >> str;

	for (char x : str) {
		if(cnt%2 != 0 && (x == 'R' || x == 'U' || x == 'D')){
			if (cnt == str.size()) {
				cout << "Yes" << endl;
				break;
			}
			else {
				cnt++;
				continue;
			}
		}
		if (cnt % 2 == 0 && (x == 'L' || x == 'U' || x == 'D')) {
			if (cnt == str.size()) {
				cout << "Yes" << endl;
				break;
			}
			else {
				cnt++;
				continue;
			}
		}
		else {
			cout << "No" << endl;
			break;
		}
	}

	return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

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

    rep(i,3){
        if(s[i]=='1'){
            s[i]='9';
        }
        else {
            s[i]='1';
        }
    }
    cout<<s<<endl;

}


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

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  
  for(int i = 0; i < k; i++) {
    if(i%2 == 0) {
      if(a%2 == 1) {
        a--;
      }
      b += a/2;
      a -= a/2;
    } else {
      if(b%2 == 1) {
        b--;
      }
      a += b/2;
      b -= b/2;
    }
  }
  
  cout << a <<  " " << b << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> hs = new HashSet<>();
        for(int i = 0; i < n; i++){
            hs.add(sc.next());
        }
        if(hs.size() == 3){
            System.out.println("Three");
        }else{
            System.out.println("Four");
        }
    }
}

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

int main()
{
    int k, x;
    cin >> k >> x;
    cout << x-k+1;
    for(int i=1; i<2*k-1; i++){
        cout << ' ' << x-k+1+i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Code Author: ADITYA SHETH (^_^)
*/
#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 t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long // remove when constraints are tight.
/*-------------------------------------------------------------------------------------------------------------------------------------*/
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
/* An element Z[i] of Z array stores length of the longest substring 
 * starting from str[i] which is also a prefix of str[0..n-1]. The first
 * entry of Z array is meaning less as complete string is always prefix of itself.*/

int transform(string &s)
{
	int n=s.length();
	int ans=0;
	for(int i=1;i<n;i++)
	{
		if(s[i]==s[i-1])
		{
			s[i]='*';
			ans++;
		}
	}
	return ans;
}
int32_t main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	string s;
	int k;
	cin>>s>>k;
	if(k<=100)
	{
		string tmp=s;
		for(int i=1;i<k;i++)
		{
			s+=tmp;
		}
		cout<<transform(s);
		return 0;
	}	
	int com=100;
	string tmp=s;
	for(int i=1;i<100;i++)
	{
		s+=tmp;
	}
	int waste=transform(s);
	vector<int> z=z_function(s);
	
	int rep=0;
	for(int i=tmp.size();i<z.size();i+=tmp.size())
	{
		if(z[i]==i)
		{
			rep=i/tmp.size();
			break;
		}
	}
	if(rep==0)
	{
		int ans=0;
		for(int i=0;i<tmp.size();i++)
		{
			if(s[i]=='*')
			{
				ans++;
			}
		}
		for(int i=tmp.size();i<2*tmp.size();i++)
		{
			if(s[i]=='*')
			{
				ans+=k-1;
			}
		}
		cout<<ans<<endl;
		return 0;
	}

	int ans=0;
	int left=k%rep;
	for(int i=0;i<rep*tmp.size();i++)
	{
		if(s[i]=='*')
		{
			ans++;
		}
	}
	ans*=k/rep;
	for(int i=0;i<left*tmp.size();i++)
	{
		if(s[i]=='*')
		{
			ans++;
		}
	}
	cout<<ans<<endl;
}


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

string s;
int cap = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        int digit = s[i] - 48;
        cap = (cap + digit) % 9;
    }
    if (cap == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <__msvc_all_public_headers.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
 
typedef long long  ll;

#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<"\n"; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define halt {cout<<"NO"; return 0;}

const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const int N = 5010;
const int INF = 1e8;
const ll LL_INF=1e18;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
int divide(int a, int b)
{
          return (a+b-1)/b;
}
int main()
{
    #if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int questions=1;
 // cin>>questions;
 while(questions--)
 {
        int n;
        cin>>n;
        vector<int> v(n);
        forn cin>>v[i];
        int ans=0;
        forn
        {
                  for(int j=i+1;j<n;j++)
                  {
                            for(int k=j+1;k<n;k++) 
                            {
                                      if(v[i]<v[j]+v[k] && v[j]<v[i]+v[k] && v[k]<v[i]+v[j] && v[i]!=v[j] && v[i]!=v[k] && v[j]!=v[k]) ans++;
                            }
                  }
        }
        cout<<ans;
         
 }
 
 
 
 
 // !!! LOOK AT NUMBER OF QUESTIONS IN A PROBLEM !!! (cin>>questions)
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

Measured memory_bytes: 3660
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int n,x;
	cin>>n;
	string s;
	cin>>s;
	for0(i,s.size()){
		x = s[i] - 'A';
		x = (x+n)%26;
		pf("%c",x+'A');
		}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
s = [list(input()) for i in range(N)]

count = 0
appeared = {}

for ss in s:
  sss = "".join(sorted(ss))
  if sss in appeared.keys():
    count += appeared[sss]
    appeared[sss] += 1
  else:
    appeared[sss] = 1

print(count)

Measured memory_bytes: 39040