akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main()
{
   int n;
   cin >> n;
   double ans = 0;
   
   double x;
   string u;
  while(n--){
   cin >> x >> u;
   
   if(u == "BTC"){
       x *= 380000;
       ans += x;
       
   }else{
       ans += x;
   }
   }
   cout << ans << endl;
   
   return 0;
}

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

class Program
{
	//Main
	static void Main(string[] args)
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());

		//商品名を格納する配列
		string[] items = new string[N];

		//ループ処理
		for(int i=0; i<N; i++){
				string S = Console.ReadLine();
				items[i] = S;
		}

		//ソート
		Array.Sort(items, StringComparer.Ordinal);

		//一つ前と違う場合、カウンタをプラス
		int cnt = 1;
		if(N != 1){
				for(int i=1; i<N; i++){
						if(items[i-1] != items[i]){
								cnt ++;
						}
				}
		}

		Console.WriteLine(cnt);

	}
}



Measured memory_bytes: 30812
n = int(input())
h = list(map(int, input().split()))
h = [0] + h

a = [0] * (n+1)
a[1] = 0
a[2] = abs(h[1]-h[2])
for i in range(3, n+1):
    a[i] = min(a[i-2]+abs(h[i-2]-h[i]), a[i-1]+abs(h[i-1]-h[i]))
print(a[n])




Measured memory_bytes: 13928
N = int(input())
A = [int(x) for x in input().split()]

A.sort(reverse=True)
ans = 0
x = 0
y = 0
i = 0

while i in range(len(A) - 1):
    if A[i] == A[i+1]:
        x = A[i]
        A[i] = -1
        A[i+1] = -1
        break

    i += 1

A.sort(reverse=True)
i = 0
while i in range(len(A) - 1):
    if A[i] == A[i+1]:
        y = A[i]
        A[i] = -1
        A[i+1] = -1
        break

    i += 1

if x <= 0 or y <= 0:
    print(0)
else:
    print(x * y)


Measured memory_bytes: 14672
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
sumx,sumy=0,0
mod=10**9+7
for i in range(n):
    sumx+=i*x[i]-(n-i-1)*x[i]
sumx%=mod
for i in range(m):
    sumy+=i*y[i]-(m-i-1)*y[i]
sumy%=mod
print(sumx*sumy%mod)

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

int main() {
  string s;
  cin >> s;
  int n = s.length();
  bool check = true;
  for (int i=0; i<(n-1)/2; i++) {
    if (s[i] == s[(n-1)/2-i-1])
      continue;
    check = false;
    break;
  }
  for (int i=(n+1)/2; i<n; i++) {
    if (s[i] == s[n-i-1])
      continue;
    check = false;
    break;
  }
  if (check)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 2e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
int B[MAXN];

int dp[MAXM][MAXM];

int main()
{
    ll n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int cnta = 0,cntb = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>A[i];
    for(int i=1;i<=m;i++)
        cin>>B[i];

    for(int i=0;i<=n;i++)
        dp[i][0] = 1;

    for(int j=0;j<=m;j++)
        dp[0][j] = 1;

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

            if(A[i]==B[j])dp[i][j] = dp[i-1][j]+dp[i][j-1];
            else dp[i][j] = dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1];
            if(dp[i][j]<0)dp[i][j]+=MOD;
            dp[i][j]%=MOD;
        }

    cout<<dp[n][m]<<"\n";

    return 0;
}


Measured memory_bytes: 16640
N = int(input())
a = list(map(int,input().split()))
ans = 0
x = 10**5
count_list = [0]*(x+1)

for i in a:
    if i > x:
        ans += 1
    else:
        if count_list[i] >= i:
            ans += 1
        else:
            count_list[i] += 1

for j in range(x+1):
    if count_list[j] < j:
        ans += count_list[j]
print(ans)

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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int INF = 2e18;
const ld EPS = 1e-9;
const int NN = 1e5 + 2;

string to_string(string s) {
      return '"' + s + '"';
}
string to_string(const char* s) {
      return to_string((string) s);
}
string to_string(bool b) {
      return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
      return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
      bool first = true;  string res = "{";
      for (const auto &x : v) {
            if (!first) { res += ", "; }
            first = false; res += to_string(x);
      }
      res += "}";	  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
      cerr << " " << to_string(H);
      debug_out(T...);
}

//#define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
//============================================================================

void solve() {
      int i = 0, j = 0, k = 0, n = 0, m = 0; 
      cin >> n;
      vi A(n), B(n);
      fr(i, 0, n) {
            cin >> A[i] >> B[i];
      }
      sort(all(A));
      sort(all(B));
      if(n & 1) {
            cout << (B[n/2] - A[n/2] + 1) << el;
      }
      else {
            k = B[n/2 - 1] - A[n/2 - 1] + B[n/2] - A[n/2] + 1;
            debug(A, B, n/2);
            cout << k << el;
      }
}

int32_t main() {
      ios::sync_with_stdio(false); cin.tie(0); 
      int T = 1; 
      // cin >> T;
      for(int tc = 1; tc <= T; tc++) {
            solve();
       }
      return 0;
}

Measured memory_bytes: 6348
my_list = list(input())
sum = 0
n = len(my_list) - 1
for i in range(2**n):
    tmp = [""]*n
    for j in range(n):
        if 1&(i>>j):
            tmp[n-1-j] = "+"
    formula = ""
    for p,q in zip(tmp+[""],my_list):
        formula += str(q) + p
    sum += eval(formula)

print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include <algorithm>
#include<string>

using namespace std;
int main() {
    int a1,a2,a3;
    cin>>a1>>a2>>a3;
    if(a1+a2+a3>=22)cout<<"bust"<<endl;
    else{
        cout<<"win"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


ll gcd(ll x, ll y)
{    return y ? gcd(y, x % y) : x;	}

ll lcm(ll x, ll y)
{    return x * y / gcd(x, y);		}

int main()
{
    int n;
    while(cin >> n && n)
    {
		vint D(n), V(n);
		
		rep(i, n)
		{
			cin >> D[i] >> V[i];
			
			int gd = gcd(D[i], V[i]);
			D[i] /= gd;
			V[i] /= gd;
		}
    
		ll gd = V[0], lm = D[0];
		REP(i, 1, n)
		{
			lm = lcm(lm, D[i]);
			gd = gcd(gd, V[i]);
		}
		
		rep(i, n) cout << lm * V[i] / gd / D[i] << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

//I can't understand,so I imitated yutaka watabe's book.
//I think this problem has 5 star rank difficulty.

void calc(char X[],char Y[]){
	int X_length=0,Y_length=0;
	int table[1001][1001];
	for(int i = 0; i < 1001; i++){
		for(int k = 0; k < 1001; k++)table[i][k] = 0;
	}
	for(int i = 0; X[i] != '\0'; i++)X_length++;
	for(int i = 0; Y[i] != '\0'; i++)Y_length++;
	int max_succeed = 0;
	for(int i = 0; i < X_length; i++){
		for(int k = 0; k < Y_length; k++){
			if(X[i] == Y[k]){
				table[i+1][k+1] = table[i][k] + 1;
			}else{
				table[i+1][k+1] = max(table[i+1][k],table[i][k+1]);
			}
			max_succeed = max(max_succeed,table[i+1][k+1]);
		}
	}
	printf("%d\n",max_succeed);
}

int main(){
	int q;
	char X[1001],Y[1001];
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%s %s",X,Y);
		calc(X,Y);
	}
    return 0;
}

Measured memory_bytes: 7132
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

ll dp[22][1<<22+1];

int main(){
    int n;
    int a[22][22];
    cin >> n;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }

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

    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k < 1<<n; k++){
                if(k >> j & 1) continue;
                dp[i+1][k+(1<<j)] += dp[i][k]*a[i][j] %MOD;
            }
        }
    }

    cout << dp[n][(1<<n)-1]%MOD << endl;

    return 0;
}

Measured memory_bytes: 405760
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pair<ll,ll> >   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pair<int,int> >   vpi;
typedef    vector<pair<double,double> >   vpd;
typedef    pair<double,double>   pd;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}

ll memo[21][(1<<21)];
vi a[21];
int n;
int ok;

int c=0;

ll solve(int i,int mask)
{c++;
	if(i==n&&mask==ok)
	return 1;
	
	if(i==n&&mask!=ok)
	return 0;
	
	if(memo[i][mask]!=-1)
	return memo[i][mask];

    ll res=0;
	int siz=a[i].size();	
	for(int p=0;p<siz;p++)
	{int j=a[i][p];
		if(mask&(1<<j)) continue; 
		res=madd(res,solve(i+1,mask|(1<<j)));
		
	}
	return memo[i][mask]=res;
}

int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
memset(memo,-1,sizeof(memo));

cin>>n;

for(int i=0;i<n;i++)
{
	for(int j=0;j<n;j++)
	{
		int x;
		cin>>x;
		if(x==1)
		a[j].pb(i);
	}
}


ok=(1<<n)-1;

cout<<solve(0,0);

}return 0;}

Measured memory_bytes: 344448
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  vector<ll> monsters(n); ll mini = 1e9 + 1;
  rep(i, n) {
      cin >> monsters[i];
  }
  
  // minimum power of monsters == GCD
  ll ans = monsters[0];
  rep(i, n) {
      ans = gcd(ans, monsters[i]);
  }
  
  /* debug */
//   rep(i, n+1) {
//       cout << sum[i] << endl;
//   }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int L,R;
  cin >> L >> R;
  if (R-L+1>=2019){
    cout << 0 <<endl;
    return 0;
  }
  int x=L%2019;
  int y=R%2019;
  if(x>y){
    cout << 0 <<endl;
    return 0;
  }
  int ans=-1;
  for(int i=x; i<=y; i++){
    for(int j=x; j<i; j++){
      int temp=(i*j)%2019;
      if(ans==-1) ans=temp;
      else ans=min(ans,temp);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
numbers=list(map(int,input().split()))
m=lcm(*numbers)-1
ans=0
for i in range(n):
    ans+=m%numbers[i]
print(ans)

Measured memory_bytes: 5344
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

int main()
{
	std::string S;
	std::cin >> S;

	if ((S[0] == S[1]) && (S[0] == S[2])) {
		std::cout << "No" << std::endl;
		return 0;
	}

	std::cout << "Yes" << std::endl;

	return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = 1000000007

def smax(a,b):
    if a>b:
        return a
    else:
        return b

def smin(a,b):
    if a<b:
        return a
    else:
        return b


def main():
    N,K = list(map(int,readline().split()))
    DP = [0]*(K+1)
    ans = 0
    pow_list = [pow(i,N,MOD) for i in range(1,K+1)]
    for i in range(K):
        x = K-i
        DP[x] = pow_list[int(K/x)-1]
    #print(DP)
    for s in range(K):
        i = K-s
        x = int(K/i)
        #checked = [False]*x
        val = DP[i]
        #print(ans,i)
        for j in range(1,x):
            val += MOD - DP[i*(j+1)]
            val %= MOD
            """
            if checked[j]==False:
                ans += MOD - (DP[i*(j+1)]*i)%MOD
                ans %= MOD
                #print(ans,j,checked)
                k = j+1
                while k < x+1:
                    if checked[k-1]:
                        print(k)
                        ans += DP[i*k]*i
                        ans %= MOD
                    checked[k-1] = True
                    k += j+1
            """
        ans += val*i
        ans %= MOD
        DP[i] = val
    print(ans)
        

if __name__ == '__main__':
    main()

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

struct UnionFind{
    vector<int> d;
    UnionFind(int n = 0) : d(n, -1){}
    int find(int x){
        if(d[x]<0)
            return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y)
            return false;
        //size(x) < size(y)
        if(d[x] > d[y])
            swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
    int size(int x){
        return -d[find(x)];
    }
};

int deg[100005];
vector<int> to[100005];

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        --a, --b;
        deg[a]++;
        deg[b]++;
        uf.unite(a, b);
    }
    rep(i,k){
        int a, b;
        cin >> a >> b;
        --a, --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,n){
        int ans = uf.size(i) - 1 - deg[i];
        for(int u: to[i]){
            if(uf.same(i,u))
                --ans;
        }
        printf("%d%c", ans, i == n - 1 ? '\n' : ' ');
    }
    return 0;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b;
    if(a * b % 2 == 1 || a * b == 1 || a * b * 3 == 1) cout << "Yes" << endl;
    else cout << "No" << endl;


}

Measured memory_bytes: 256
S=gets.chomp

black_start_count=0
white_start_count=0

S.each_char.each_with_index do |s,i|
    if s=="0"
        white_start_count+=1 if i%2==0
        black_start_count+=1 if i%2==1
    else
        white_start_count+=1 if i%2==1
        black_start_count+=1 if i%2==0
    end
end

puts (black_start_count<white_start_count ? black_start_count : white_start_count)

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

int main()
{
	string a;
	cin>>a;
	for(int i=0;i<a.length()/2;i++){
		char tmp=a[i];
		a[i]=a[a.length()-i-1];
		a[a.length()-i-1]=tmp;
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#define for1(a,b,i) for(int i=a;i<=b;++i)
#define FOR2(a,b,i) for(int i=a;i>=b;--i)
using namespace std;
typedef long long ll;

#define M 2005
int n;
char a[M][M];
int f[M][M],l[M][M],r[M][M];

int main () {
	//freopen("a.in","r",stdin);
	scanf("%d",&n);
	for1(1,n,i) scanf("%s",a[i]+1);
	
	ll ans=0;
	FOR2(n,1,i) FOR2(n,1,j) 
		if(isdigit(a[i][j])) {
			bool t[2]={isdigit(a[i+1][j]),isdigit(a[i][j+1])};
			if(!t[0]&&!t[1]) {
				l[i][j]=r[i][j]=j;
				for1(i+1,n,k) l[k][j]=n+1,r[k][j]=0;
			}
			else if(!t[0]) {
				f[i][j]=f[i][j+1];
				l[i][j]=j,r[i][j]=r[i][j+1];
				for1(i+1,n,k) l[k][j]=l[k][j+1],r[k][j]=r[k][j+1];
			}
			else if(!t[1]) {
				f[i][j]=f[i+1][j];
				l[i][j]=r[i][j]=j;
			}
			else {
				int las=0;
				int tot=f[i+1][j]+f[i][j+1];
				l[i][j]=j,r[i][j]=r[i][j+1];
				
				for1(i+1,n,k) {
					if(l[k][j+1]<=r[k][j]&&l[k][j+1]>las) tot-=f[k][l[k][j+1]];
					las=max(las,r[k][j]);
					l[k][j]=min(l[k][j],l[k][j+1]);
					r[k][j]=max(r[k][j],r[k][j+1]); 
				}
				f[i][j]=tot;
			}
			ans+=f[i][j]*(a[i][j]-'0');
			f[i][j]+=a[i][j]-'0';
		}
		else l[i][j]=n+1,r[i][j]=0;
	cout<<ans<<endl;
}

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


int main() {
  string s,t;
  
  cin >> s >> t;
  
  int flag = 0;
  
  for(int i=0; i<s.size(); i++){
    if(s.at(i) == t.at(i))
      flag++;
  }
  
  cout << flag;
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,L,MOD=1e9+7,N,ans;
vector<ll>v;
int main(void){
    cin>>n>>k;
    for(ll i=1;i*i<=n;i++){
        if(i*i==n){
            v.push_back(i);
            break;
        }
       v.push_back(i);
       v.push_back(n/i);
    }
    sort(v.begin(),v.end());
    //for(auto x:v)cout<<x<<endl;
    N=v.size();
    ll vv[N];
    L=0;
    for(int i=0;i<N;i++){
        vv[i]=v[i]-L;
        L=v[i];
    }
    ll dp[k+1][N];
    ll a[N+1];
    for(int i=0;i<k+1;i++)for(int j=0;j<N;j++)dp[i][j]=0;
    for(int i=1;i<=k;i++){
        if(i==1)a[0]=1;
        else a[0]=0;
        for(int j=0;j<N;j++){
            a[j+1]=a[j]+dp[i-1][j];
            a[j+1]%=MOD;
        }
        for(int j=0;j<N;j++){
            //cout<<a[N-j]<<vv[j]<<"W"<<endl;
            dp[i][j]=a[N-j]*vv[j];
            dp[i][j]%=MOD;
        }
    }
    for(int i=0;i<N;i++){ans+=dp[k][i];ans%=MOD;}
    cout<<ans<<endl;
}


Measured memory_bytes: 51704
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
const int MOD = 1e9+7;
//const auto INF = 0x3f3f3f3f;
const int N = 1e2+5;

char maps[2][N];
int n;
LL dp[N][5][5];

LL dfs(int u, int a, int b) {
    if(u == n)
        return 1;
    if(u > n)
        return 0;
    if(dp[u][a][b] != -1)
        return dp[u][a][b];
    LL ans = 0;
    if(maps[0][u] == maps[1][u]) {
        for(int i=1; i<=3; i++) {
            if(i != a && i != b) {
                ans += dfs(u+1, i, i);
                ans %= MOD;
            }
        }
    } else {
        for(int i=1; i<=3; i++) {
            if(i == a)
                continue;
            for(int j=1; j<=3; j++) {
                if(i == j || j == b)
                    continue;
                ans += dfs(u+2, i, j);
                ans %= MOD;
            }
        }
    }
    return dp[u][a][b] = ans;
}

int main() {
    memset(dp, -1, sizeof(dp));
    scanf("%d", &n);
    scanf("%s", maps[0]);
    scanf("%s", maps[1]);
    printf("%lld\n", dfs(0, 0, 0));
}



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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N; cin >> N;
    long double ans = 0.0;
    for (int i = 0; i < N; i++) {
        long double a;
        cin >> a;
        ans += 1/a;
    }
    printf("%.10Lf\n",1/ans);
}

Measured memory_bytes: 3764
import math
N = int(input())
 
N_0 = math.ceil(N / 1.08)
M = 10
N_l = [N_0 - M + P for P in range(M*2)]
N_l_tax = [math.floor(1.08*x) for x in N_l]
 
N_l_out = []
 
for i in range(len(N_l_tax)):
  if N_l_tax[i] == N:
    N_l_out.append(N_l[i]) 
 
if len(N_l_out) != 0:
  for j in N_l_out:
    print(j)
else:
  print(':(')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct choice{int x,t;};
long long n,m,a[100000],j,k,cnt,ans,g; 
choice var[100000];
bool cmp(const choice &z,const choice &y){return z.x>y.x;}
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		ans+=a[i];
	}
	sort(a,a+n);
	for(int i=0;i<m;i++){
		cin>>var[i].t>>var[i].x;
		cnt+=var[i].t;
	}
	sort(var,var+m,cmp);
	while(j<min(n,cnt)&&(g<n&&var[j].x>a[g])){
		ans+=var[j].x-a[g];
		g++;
		k++;
		if(k==var[j].t){
			k=0;
			j++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
  string S,T;
  cin >> S >> T;
  bool flag;
  for(int i=0;i<S.size();i++){
    flag=true;
    for(int j=0;j<S.size();j++){
      if(i+j<S.size()){
        if(S.at(i+j)!=T.at(j))  flag=false;
      }
      else if(i+j>=S.size()){
        if(S.at(i+j-S.size())!=T.at(j)) flag=false;
      }
    }
    if(flag)  break;
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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




int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	char s[52];
	scanf("%s", s);
	s[k - 1] = s[k - 1] + 32;
	printf("%s", s);
	return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
const ll inf = 1000000007;
int main() {
  ll n; cin >>n;
  vector<ll>  t(n);
  rep(i,n) cin >>t[i];
  ll ans=t[0];
  rep(i,n-1){
    ans=ans/__gcd(ans,t[i+1])*t[i+1];
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
from itertools import product
n=int(input())
cnt=0
suuji=[3,5,7]
set_s=set(suuji)
kazu=[]
for i in range(len(str(n))+1):
    kumiawase=list(product(suuji, repeat=i))
    for kumi in kumiawase:
        if set(kumi)==set_s and n >=int(''.join(list(map(str,kumi)))):
            cnt+=1
print(cnt)

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

ll gcd(ll a, ll b){
  if(a<b) swap(a,b);
  ll r;
  while(b){
    r=a%b;
    a=b;
    b=r;
  }
  return a;
}

int main(){
  int N,X; cin>>N>>X;
  ll A[N];
  rep(i,N){
    cin>>A[i];
    A[i]=abs(A[i]-X);
  }
  ll ans=A[0];
  rep(i,N-1){
    ans=gcd(ans,A[i+1]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
string s,t;
int cnt=1000,n,ans;
main(){
    cin>>n>>s>>t;
    for(int i=0;i<n;i++){
        bool can=1;
        for(int j=0;j<n-i;j++){
            if(s[j+i]!=t[j])can=0;
        }
        if(can){
            ans=n+i;
            if(cnt>ans)cnt=ans;
        }
    }
    cout<<(cnt==1000?n*2:cnt)<<endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define SORT(v) sort(v.begin(),v.end())
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define M 1000000007
#define deb(x) cout<< #x << " " << x << endl;

double pi=3.14159265358979323846;

typedef pair<int,int> pii;
typedef pair<long long int, long long int>pll;
typedef vector<int>vi;
typedef vector<long long int>vl;
#define MAXN 10000001

int main ()
{
    ll T;
    T=1;
    //cin>>T;
    while(T--)
    {
   
   int n;
   cin>>n;
   vi a(n);
   fori(i,0,n)cin>>a[i];
   //int ans=0;
   SORT(a);
  
   int x=a.back();
 //  deb(x)
   vector<int> h(x+1,0);
   for(int i=0;i<n;i++){
   	for(int j=a[i];j<=x;j+=a[i]){
   		h[j]++;
   	}
   }
   int ans=0;
   for(int i=0;i<n;i++){
   	if(h[a[i]]<2)ans++;
   }
   cout<<ans<<endl;
    }
   
    	
    
    	
    	
    
    return 0;
}


Measured memory_bytes: 7856
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define int long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int a[100010];
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=n-1;i>=1;i--){
		if(a[i]>a[i+1])a[i]--;
	}
	for(int i=1;i<n;i++)if(a[i]>a[i+1]){
		puts("No");
		return 0;
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 1024
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 100100;

    void solve() {
        ll n; double x, sum = 0; string s;
        cin >> n;
        rep(i, n) cin >> x >> s, sum += (s == "JPY" ? x : x*380000);
        printf("%.9f\n", sum);
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      /*
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
     */
      //te
      solve();
      return 0;
    } 

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

using namespace std;

struct I{
    I(){
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
}cww;

typedef long long LL;
namespace BIT_{
    const int SZ=300000;
    LL mem[SZ];
};

class BIT{
private:LL *t;int n;int mod;
public:
    BIT(int n,int  mod):t(BIT_::mem),n(n),mod(mod){
        fill(t,t+BIT_::SZ,0);
    }
    LL sum(int i){
        LL s=0;
        while(i>0){
            s+=t[i];
            i-=i&-i;
        }
        return s%mod;
    }
    LL sum(int lb,int ub){
        return (mod+sum(ub)-sum(lb-1))%mod;
    }
    void add(int i,LL x){
        while(i<=n){
            (t[i]+=x)%=mod;
            i+=i&-i;
        }
    }
};

int main(){
    for(int A,B,P;cin>>A>>B>>P,A+B+P;){
        int D=B-A;
        BIT bit(D+10,P);
        using T=tuple<int,int,string>;
        vector<T> num(D+1);
        for(int i=0;i<=D;i++){
            num[i]=T(i,-1,to_string(A+i));
        }
        sort(num.begin(),num.end(),[&](T &l,T &r){return get<2>(l)<get<2>(r);});
        for(int i=0;i<=D;i++){
            int id=get<0>(num[i]);
            num[i]=T(id,i+1,string());
        }
        sort(num.begin(),num.end());
        
        for(auto &it:num){
            int id=get<1>(it);
            bit.add(id,bit.sum(id-1)+1);
        }
        cout<<bit.sum(D+5)<<endl;
    }

    return 0;
}

Measured memory_bytes: 11652
#include <stdio.h>

main(){
  int n, data[10], syurui, i, j;

  while(1){
    scanf("%d", &n);
    if(n==0) break;

    for(i=0;i<10;i++){
      data[i]=0;
    }

    for(i=0;i<n;i++){
      scanf("%d", &syurui);
      data[syurui]++;
    }

    for(i=0;i<10;i++){
      if(data[i]==0){
	printf("-\n");
	continue;
      }
      for(j=0;j<data[i];j++){
	printf("*");
      }
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, x[100010], y[100010];
bool used[2][100010];
vector<int> vec[2][100010];
int s, t;
void func(int a, int b) {
	used[a][b] = true;
	if (!a)s++;
	else t++;
	for (int i : vec[a][b]) {
		if (!used[!a][i])func(!a, i);
	}
}
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> x[i] >> y[i];
		vec[0][x[i]].push_back(y[i]);
		vec[1][y[i]].push_back(x[i]);
	}
	int ans = 0;
	rep(i, n) {
		if (!used[0][x[i]]) {
			s = 0; t = 0;
			func(0, x[i]);
			ans += s * t;
		}
	}
	cout << ans - n << endl;
	return 0;
}

Measured memory_bytes: 14464
import java.util.*;
import java.io.*;

public class Main{
	final static int MOD = 1000000007;
	final static int INF = 1000000000;

	public static void main(String[] args) throws IOException{
		//final double PI = 3.14159265;
		NScanner sc = new NScanner(System.in);
		for(;;){
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(H == 0 && W == 0)
				break;
			for(int i = 0; i < H; ++i){
				for(int j = 0; j < W; ++j){
					if(i == 0 || i == H - 1 || j == 0 || j == W - 1)
						System.out.print("#");
					else
						System.out.print(".");
				}
				System.out.println();
			}
			System.out.println();

		}
		/*int n = sc.nextInt();
		long sum = 0;minv = INF, maxv = -INF;
		for(int i = 0; i < n; ++i){
			int a = sc.nextInt();
			sum += a;
			minv = Math.min(minv, a);
			maxv = Math.max(maxv, a);
		}
		System.out.printf("%d %d %d\n", minv, maxv, sum);*/
	}

}

class NScanner{

	private BufferedReader br;
	private StringTokenizer tok;

	public NScanner(InputStream is) throws IOException{
		br = new BufferedReader(new InputStreamReader(is));
		getLine();
	}

	private void getLine() throws IOException{
		while(tok == null || !hasNext()){
			tok = new StringTokenizer(br.readLine());
		}
	}

	private boolean hasNext(){
		return tok.hasMoreTokens();
	}

	public String next() throws IOException{
		if(hasNext()){
			return tok.nextToken();
		}else{
			getLine();
			return tok.nextToken();
		}
	}

	public int nextInt() throws IOException{
		if(hasNext()){
			return Integer.parseInt(tok.nextToken());
		}else{
			getLine();
			return Integer.parseInt(tok.nextToken());
		}
	}

	public long nextLong() throws IOException{
		if(hasNext()){
			return Long.parseLong(tok.nextToken());
		}else{
			getLine();
			return Long.parseLong(tok.nextToken());
		}
	}

	public double nextDouble() throws IOException{
		if(hasNext()){
			return Double.parseDouble(tok.nextToken());
		}else{
			getLine();
			return Double.parseDouble(tok.nextToken());
		}
	}
}


Measured memory_bytes: 33288
n, m = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
if n >= m:
    print(0)
else:
    Y = []
    for i in range(m - 1):
        Y.append(X[i + 1] - X[i])
    Y.sort(reverse = True)
    ans = X[m - 1] - X[0]
    for i in range(n - 1):
        ans -= Y[i]
    print(ans)


Measured memory_bytes: 13964
#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>

using namespace std;
#define endl "\n"
#define FILEIO freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define LL long long 
#define mod 1000000007LL
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
//#define p push
#define I insert
#define bg begin()
#define ed end()
#define sz size()
#define all(v) v.begin(),v.end()
typedef vector<LL> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef map<LL ,LL > mii;
//typedef priority_queue<int> pq;
typedef queue<int>que;
typedef stack<int>stk;
#define Inf 100000005LL
#define f first
#define s second





vi vect_2pow;
void pow_of_2(){
    vect_2pow.assign(32,0);
      for(int i=0;i<=32;i++){
           LL y = 1<<i;
           vect_2pow[i]=y;
      }
}
bool Ispalindrome(string str){
        LL len = str.size();
		bool flag;
		for(int i=0;i<len/2;i++){
				if(str[i]==str[len-i-1])
				     {
						 flag=0;
						 continue;
					 }
					 else 
					    {
							flag=1;
							break;
						}
			}
		if (flag==1)
		  return false;
		else return true;  
		
}
vector<LL> prime_check;
mii get_high_prime;
int high_prime_factor(){
	//cout<<"ecd";
	LL max_prime=0;
	for(int i=2;i<100000;i++)
	{
		LL n=i;
		
		while(n%2==0)
		{
			max_prime=2;
			n>>=1;
		}
		for(int j=3;j<=sqrt(n);j++)
		{
			while(n%j==0){
				max_prime=j;
				n/=j;
			}
		}
		if(n>2)
		  max_prime=n;
		  
		//prime_check.pb(max_prime);
		get_high_prime[i]=max_prime;
	}
	
			
}
vi vect[2000001];
LL ans=0;
bool flag=0;
mii check;
vi store;
void dfs(LL k,LL par){
    
	for(auto x:vect[k])
	  {
		  check[x]++;
		  if(check[x]==2){
		       store[x]=ans;
		  }
		  if(x==par){
			  flag=1;
		  }
		  if(flag==0)
		       dfs(x,par);
	  }

	  ans++;

}
void dfs1(LL k)
{
	for(auto x:vect[k])
	    check[x]=0;
}
int main(){

  
	  double n;
	  cin>>n;
	  cout<< 2 * 3.14*n;

   
}

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

int main() {
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s[0]==s[1]&&s[1]!=s[2]&&s[2]==s[3])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define N 1e5 + 10
struct res
{
	string name;
	ll score;
	ll index;
};
bool cmp(res a,res b)
{
	if(a.name<b.name)
		return true;
	else if(a.name>b.name)
		return false;
	else
	{
		if(a.score>b.score)
			return true;
		else
			return false;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	cout<<min(b/a,c);
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define stop exit(0)
#define dd double
#define po pop_back
#define pb push_back
#define ub upper_bound
#define lb lower_bound
int main(){
    vector <long long> v;
    ll c,d=0,e=0,f=0,g=0,i,j,k=1,l=1,r=1,n,m[300001],z[400001],h[600001],p[600001];
    string s,t,x,y[1001];
    dd q,u,w;
    double a,b;
    cin>>a;
    printf("%.10f",3.14159265359*a*2);
}

Measured memory_bytes: 3848
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	ll N, K;
	cin >> N >> K;
	vector<ll> A(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	map<ll, int> m;
	vector<ll> list;
	m[0] = 1;
	list.push_back(0);
	auto left = 0;
	auto num = 0ll;
	auto sum = 0;
	for (auto right = 0; right < N; ++right)
	{
		if (right + 1 - left >= K)
		{
			--m[list[left]];
			++left;
		}

		sum = (sum + A[right]) % K;
		auto temp = (((sum - right - 1) % K) + K) % K;
		num += m[temp];

		++m[temp];
		list.push_back(temp);
	}

	cout << num << endl;

	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;

const ld pi=3.1415926535897932384626433;
const int mod = 1000000007;
const ll inf=3e18;
// 92DTG

int main ()
{
   bolt;
   string s;
   string t;
   cin>>s>>t;
   if (s.size()>=t.size())
   {
      cout<<"No";
      return 0;
   }
   ll ans=0;
   for (ll i=0;i<s.size();i++)
   {
      if (s[i]==t[i])
      {
         ans++;
      }
   }
  
   if (ans==s.size() and ans+1==t.size())
      cout<<"Yes";
   else
      cout<<"No";
}


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	s := readString()
	b := []byte(s)

	var ans int
	for i := 1; i < len(b); i++ {
		if b[i-1] != b[i] {
			ans++
		}
	}
	println(ans)
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;

const ll mod=1e9+7;
ll qmi(ll a,ll b,ll mod){
    ll res=1;
    while(b){
        if(b&1) res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
int main(){
    ll n;
    scanf("%lld",&n);
    if(n==1) printf("0");
    else {
        ll ans=1;
        ans=((qmi(10,n,mod)-2*qmi(9,n,mod)%mod+qmi(8,n,mod))%mod+mod)%mod;
        printf("%lld",ans);
    }
}


Measured memory_bytes: 3796
//abc153_a.cpp
//Sat Feb 22 18:01:27 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	cout << (n+m-1)/m << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
        long n,m;
        while(cin>>n>>m)
        {
            long a[100100],s=0,x,y,i;

            fr(i,n)
            cin>>a[i];

            for(i=1;i<n;i++)
            {
                x=a[i]+a[i-1];
                y=x-m;
                if(y>0)
                {
                    s+=y;
                    a[i]=a[i]-y;
                    a[i]=max(a[i],long(0));
                }
            }
            cout<<s<<"\n";
        }

        return 0;

}




Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int b, r, g, c, s, t;

 while(scanf("%d%d%d%d%d%d", &b, &r, &g, &c, &s, &t) && b + r + g + c + s + t)
    printf("%d\n", 100 + b * 95 + r * 63 + g * 7 + c * 2 + s * 3 - t * 3);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

#define N 21
#define PN (1 << N)
#define MOD 1'000'000'007

uint32_t bitcnt(uint32_t n) {
  n = (n & 0x55555555) + ((n >> 1) & 0x55555555);
  n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
  n = (n & 0x0f0f0f0f) + ((n >> 4) & 0x0f0f0f0f);
  n = (n & 0x00ff00ff) + ((n >> 8) & 0x00ff00ff);
  n = (n & 0x0000ffff) + ((n >> 16) & 0x0000ffff);
  return n;
}

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

  auto a = new uint32_t[N][N];
  for (int32_t i = 0; i < n; ++i) {
    for (int32_t j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }

  int32_t pn = 1 << n;
  auto dp = new uint32_t[PN];
  dp[0] = 1;
  for (uint32_t i = 1; i < pn; ++i) {
    auto b = bitcnt(i) - 1;
    dp[i] = 0;
    for (uint32_t j = 0; j < n; ++j) {
      auto pj = 1 << j;
      if ((i & pj) != 0) {
        dp[i] = (dp[i] + dp[i & (~pj)] * a[b][j]) % MOD;
      }
    }
  }

  cout << dp[pn-1] << endl;
}


Measured memory_bytes: 8448
import sys
input=sys.stdin.readline
n=int(input())
a_list=list(map(int,input().split()))
b_list=list(map(int,input().split()))
ans=0
for i in range(n):
    if b_list[i]<=a_list[i]:
        ans+=b_list[i]
    else:
        ans+=a_list[i]
        b=b_list[i]-a_list[i]
        if b<=a_list[i+1]:
            ans+=b
            a_list[i+1]-=b
        else:
            ans+=a_list[i+1]
            a_list[i+1]=0
print(ans)
    

        



Measured memory_bytes: 73316
from collections import Counter
from string import ascii_lowercase

s=""
while 1:
    try:s+=input().lower()
    except EOFError : break

dic=Counter(s)

for x in ascii_lowercase:
    if x in dic:
        print("{} : {}".format(x,dic[x]))
    else :
        print("{} : 0".format(x))



Measured memory_bytes: 6680
a, b, c = map(int, input().split())
k = int(input())

ans = 0
for i in range(k+1):
    for j in range(k+1):
        if i+j <= k:
            ans = max(ans, a*2**i+b*2**j+c*2**(k-i-j))

print(ans)


Measured memory_bytes: 2940