akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << 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...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int dp[55][55][3000];
signed main(){
    int n,x;cin >>n >> x;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    dp[0][0][0] = 1;
    rep(i,n)rep(k,n+1)rep(j,3000){
        if(j+a[i] < 3000)dp[i+1][k+1][j+a[i]] += dp[i][k][j];
        dp[i+1][k][j] += dp[i][k][j];
    }
    int ret = 0;
    for(int i = 1;i <= n;i++){
        ret += dp[n][i][x*i];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 64632
from functools import reduce

try:
    from math import gcd
except:
    from fractions import gcd


def gcm(a, b):
    return a * b // gcd(a, b)


N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
ans = reduce(gcm, T, 1)
print(ans)


Measured memory_bytes: 5124
#include <iostream>
#include <set>
using namespace std;
const int MOD = 1000000000 + 7;
set<int> bad;
bool isValid(int n) {
	do {
		int d = n % 10;
		n /= 10;
		if (bad.find(d) != bad.end()) {
			return false;
		}
	}
	while(n);
	return true;
}
int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < k; ++i) {
		int d;
		cin >> d;
		bad.insert(d);
	}
	int curr = n;
	while(!isValid(curr)) {
		++curr;
	}
	cout << curr;
}

Measured memory_bytes: 256
class SegTree:
    def __init__(self,arr,func,unit):
        self.func = func
        self.unit = unit
        n = 1
        while n < len(arr):
            n *= 2
        self.n = n
        nodes = [unit]*(2*n-1)
        nodes[n-1:n-1+len(arr)] = arr
        for i in range(n-2,-1,-1):
            nodes[i] = func(nodes[2*i+1],nodes[2*i+2])
        self.nodes = nodes

    def update(self,i,val):
        i += self.n-1
        self.nodes[i] = val
        while i >= 0:
            i = (i - 1) // 2
            self.nodes[i] = self.func(self.nodes[2*i+1], self.nodes[2*i+2])

    def query(self,l,r):
        l += self.n
        r += self.n
        s = self.unit
        while l < r:
            if r & 1:
                r -= 1
                s = self.func(self.nodes[r-1], s)
            if l & 1:
                s = self.func(s, self.nodes[l-1])
                l += 1
            l >>= 1
            r >>= 1
        return s

n, k = map(int, input().split())
A = [int(input()) for i in range(n)]

MAX = 300001

segt = SegTree([0] * MAX, lambda x, y: max(x, y), 0)
for a in A:
    l = max(0, a - k)
    r = min(MAX, a + k + 1)
    m = segt.query(l, r)
    segt.update(a, m + 1)

print(segt.query(0, MAX))


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

int main(){
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> a(M);
    for(size_t i = 0; i < M; i++)
    {
        cin >> a[i];
    }
    int left = 0;
    int right = 0;
    for(size_t i = 0; i < M; i++)
    {
        if (a[i] < X)
            left++;
        else
            right++;
    }
    cout << min(left, right) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int fanc(int x){
    int ans = 0;

    while(1){
        if(x%100 == 0){
            x /= 100;
            ans++;
        }else break;
    }
    return ans;
    
}

int main(){
    int d,n,count = 0;
    cin >> d >> n;

    for(int i = 1;;i++){
        if(fanc(i) == d)count++;
        if(count == n){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
def main() -> None:
    N, M = map(int, input().split())
    PYT = [tuple(map(int, input().split())) for _ in range(M)]
    PYTS = sorted(PYT)

    before = 0
    tmp = {}
    for py in PYTS:
        if before != py[0]:
            # 初期化する
            before = py[0]
            count = 0
        count += 1
        tmp[py] = count

    for py in PYT:
        print("{:06}{:06}".format(py[0], tmp[py]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29348
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;

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

int main() {
	int N, K, a;
	cin >> N >> K;
	vector<int> count(N+1);
	for (int i = 0; i < N; i++) {
		cin >> a;
		count[a]++;
	}
	sort(count.begin(),count.end(), greater<int>());
	ll ans = 0;
	for (int i = K; i <= N; i++) {
		ans += count[i];
	}
	print(ans);

}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long 
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((ll)(1e15+100))
#define ARRS ((ll)(1e6+100))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)

ll n,a,b,m,k,p,q,h;

int main(){
	ios::sync_with_stdio(0);
	cin>>n>>a>>b;
	if(a*b<n||a+b-1>n){
		cout<<-1;
		return 0;
	}
	else {
		while(a*(b-1)>=n){
			cout<<n--<<" ";
			b--;
		}
		//n--;
		while(n){
			//cout<<n<<" "<<(n-1)%a+1<<endl;
			for(int i=n-((n-1)%a+1)+1; i<=n; i++)
				cout<<i<<" ";
			n=n-((n-1)%a+1);
		}
	}
	
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int n,a[100010],dp[100010];
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	dp[1]=0;
	dp[2]=abs(a[1]-a[2]);
	for(int i=3;i<=n;++i){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
n=gets.to_i
dp=Array.new(100010){[0]*3}
point=[]
n.times.each do
    point<<gets.split.map(&:to_i)
end

for i in 0..n-1
    for j in 0..2
        for k in 0..2
        dp_each=[]
       if j==k
        next
        else
       dp[i+1][j]=[dp[i][k]+point[i][j],dp[i+1][j]].max
        end
       end
    end
end

#p dp[0..5]
p dp[n].max

Measured memory_bytes: 27716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
static const ll mod = 1;

ll calc_comb(int n, int r) {
  ll num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main() {
  int N, A, B; cin >> N >> A >> B;
  vector<ll> v(N);
  rep(i, N) cin >> v[i];
  sort(all(v));
  reverse(all(v));

  ll sum = v[0];
  int last_idx = 0;
  for (int i = 1; i < A; i++) {
    sum += v[i];
    if (v[i] != v[i-1]) last_idx = i;
  }

  int first_idx = A - 1;
  for (int i = A; i < N; i++) {
    if (v[i] != v[i-1]) {
      break;
    }
    first_idx = i;
  }

  int same_cnt = first_idx - last_idx + 1;
  ll ans_comb = 0LL;
  if (last_idx == 0) {
    for (int i = A; i <= min(B, first_idx+1); i++) {
      ans_comb += calc_comb(first_idx+1, i);
    }
  } else {
    ans_comb = calc_comb(same_cnt, A-last_idx);
  }


  double ans_sum = (double)sum / A;
  printf("%.10f\n",ans_sum);
  cout << ans_comb << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &out, std::vector<T> const &cont) {
    for (auto &i : cont) {
        out << i << ' ';
    }
    return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, std::pair<T1, T2> const &p) {
    out << '{' << p.first << ", " << p.second << "}";
    return out;
}
#define imie(...) __debug_print(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __debug_print(const char *name, Arg1 &&arg1) {
#ifdef LOCAL
    cerr << "[" << name << ": " << arg1 << "]" << endl;
#endif
}
template <typename Arg1, typename... Args>
void __debug_print(const char *names, Arg1 &&arg1, Args &&... args) {
#ifdef LOCAL
    const char *comma = strchr(names + 1, ',');
    cerr << "[";
    cerr.write(names, comma - names) << ": " << arg1 << "],  ";
    __debug_print(comma + 2, args...);
#endif
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K;
    cin >> N >> K;
    int arr[N];
    for (int &i : arr)
        cin >> i;
    bool DP[K + 1];
    memset(DP, 0, sizeof DP);
    DP[0] = false;
    for (int k = arr[0]; k <= K; ++k) {
        bool set = false;
        for (int i = 0; i < N; ++i) {
            if (k >= arr[i] && !DP[k - arr[i]]) {
                set = true;
                DP[k] = true;
                break;
            }
        }
        if (!set) {
            DP[k] = false;
        }
    }
    if (DP[K])
        cout << "First" << endl;
    else
        cout << "Second" << endl;
}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <list>
#include <cstdlib>

const int MAX_N = 100;

struct Node {
  int v;
  int firstVisitedTime;
  int lastVisitedTime;
  bool visited;
};

void visit(int *count, int n, std::vector<std::list<int> *> *graph, std::vector<struct Node *> *nodes) {
  (*count)++;
  
  struct Node *node = nodes->at(n);

  if (!node->visited) {
    node->firstVisitedTime = *count;
    node->visited = true;
  }  

  //  std::cout << (*count) << " = " << n << std::endl;

  std::list<int> *neighbors = graph->at(n);

  while (!neighbors->empty()) {
    int v = neighbors->front();
    neighbors->pop_front();
    
    if (!nodes->at(v)->visited) {
      visit(count, v, graph, nodes);
    }
  }

  (*count)++;
  node->lastVisitedTime = (*count);

  //  std::cout << (*count) << " = " << n << std::endl;
}

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

  int n = 0;
  std::cin >> n;

  std::vector<std::list<int> *> *graph = new std::vector<std::list<int> *>(n + 1);
  std::vector<struct Node *> *nodes = new std::vector<struct Node *>(n + 1);
  
  for (int i = 1; i <= n; i++) {
    int v = 0;
    std::cin >> v;

    int k = 0;
    std::cin >> k;

    std::list<int> *neighbors = new std::list<int>();

    for (int i = 0; i < k; i++) {
      int a = 0;
      std::cin >> a;

      neighbors->push_back(a);
    }

    graph->at(i) = neighbors;

    struct Node *node = (struct Node *) std::malloc(sizeof(struct Node));

    node->v = i;
    node->firstVisitedTime = 0;
    node->lastVisitedTime = 0;
    node->visited = false;
    
    nodes->at(i) = node;
  }

  int count = 0;

  for (std::vector<struct Node *>::iterator iterator = nodes->begin() + 1; iterator != nodes->end(); ++iterator) {
    struct Node *node = *iterator;
    
    if (!node->visited) {
      visit(&count, node->v, graph, nodes);
    }
  }

  for (std::vector<struct Node *>::iterator iterator = nodes->begin() + 1; iterator != nodes->end(); ++iterator) {
    struct Node *node = *iterator;
        
    std::cout << node->v << " " << node->firstVisitedTime << " " << node->lastVisitedTime << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1224
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		int[]R = new int[N];
		int[]G = new int[N];
		int[]B = new int[N];	
		int r = 0;
		int g = 0;
		int b = 0;
		int[]S = new int[N];
		for(var i=N-1;i>=0;i--){
			if(s.Substring(i,1)=="R"){
				S[i]=1;
				r++;
			} else if(s.Substring(i,1)=="G"){
				S[i]=2;
				g++;
			} else if(s.Substring(i,1)=="B"){
				S[i]=3;
				b++;
			}
			R[i]=r;
			G[i]=g;
			B[i]=b;
		}
		long ans = 0;
		for(var i=0;i<N;i++){
			for(var j=i+1;j<N;j++){
				long a1 = 0;
				if(j<N-1){
					if(S[i]*S[j]==2){
						a1 = B[j+1];
						if(j+j-i<N && S[j+j-i]==3){
							a1--;
						}
					}
					if(S[i]*S[j]==3){
						a1 = G[j+1];
						if(j+j-i<N && S[j+j-i]==2){
							a1--;
						}
					}
					if(S[i]*S[j]==6){
						a1 = R[j+1];
						if(j+j-i<N && S[j+j-i]==1){
							a1--;
						}
					}
				}
				ans += a1;
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17792
#include<bits/stdc++.h>
#define fi first
#define se second
typedef long long ll;
using namespace std;

pair<int,int> dp[2][200001];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  while(cin>>n,n){
    int a[201];
    fill(a,a+201,0);
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    for(int i=0;i<=200000;i++)dp[0][i]=make_pair(-1,0);
    dp[0][0]=make_pair(0,0);
    for(int i=0;i<n;i++){
      for(int j=0;j<=200000;j++)dp[(i+1)&1][j]=make_pair(-1,0);
      for(int j=0;j<=200000;j++){
        if(dp[i&1][j].fi==-1)continue;
        int tmp=a[i]%1000;
        if(tmp<=500 && tmp>=1)
          dp[(i+1)&1][j+500-tmp]=max(make_pair(dp[i&1][j].fi+1,dp[i&1][j].se-a[i]),dp[(i+1)&1][j+500-tmp]);
        else{
          int pay=(tmp+500)%1000;
          dp[(i+1)&1][j]=max(dp[(i+1)&1][j],dp[i&1][j]);
          if(pay<=j)
            dp[(i+1)&1][j-pay]=max(make_pair(dp[i&1][j].fi+1,dp[i&1][j].se-a[i]),dp[(i+1)&1][j-pay]);
          int pay2=(1000-tmp)%1000;
          dp[(i+1)&1][j+pay2]=max(make_pair(dp[i&1][j].fi,dp[i&1][j].se-a[i]),dp[(i+1)&1][j+pay2]);
        }
      }
    }
    pair<int,int> ans=make_pair(0,0);
    for(int i=0;i<=200000;i++){
      ans=max(ans,dp[n&1][i]);
    }
    cout<<ans.fi<<" "<<-ans.se<<endl;
  }
  return 0;
}


Measured memory_bytes: 6240
program ABC085B
    implicit none
    integer(8)::N,i,dim
    integer(8)::result=0
    integer(8),allocatable,dimension(:)::D
    read(5,*)N
    allocate(D(N))
    read(5,*)(D(i),i=1,N)

    D=iqsort(D)
    D=D(N:1:-1)

    do i=1,N
        if(i==1 .or. dim/=D(i))then
            dim=D(i)
            result=result+1
        end if
    end do

    print'(i0)',result

contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program ABC085B

Measured memory_bytes: 384
/**
 *   created: 07 September 2019  17:28:19
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

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

int main()
{
    optimizeIO();
    int tt=1;
    //cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vi a(n),b(n),c(n-1);
        rep(i,0,n)
            cin>>a[i];

        rep(i,0,n)
            cin>>b[i];
        rep(i,0,n-1)
            cin>>c[i];
        int res = 0;
        set<int> s;
        rep(i,0,n){
            int ind = a[i]-1;
            res += b[ind];
            if(i>0 && a[i]==a[i-1]+1)
                res += c[ind-1];
            // trace2(res,i);
        }
        cout<<res;
    }
    return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
//#define endl '\n'

int32_t main()
{
    IOS
    int n,k;
    cin>>n>>k;
    if (k==1) cout<<0<<endl;
    else cout<<(n-k+1)-1<<endl;
}



Measured memory_bytes: 892
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int N,A,B,C; cin>>N>>A>>B>>C;
    int l[10];
    for(int i=0;i<N;i++) cin >> l[i];

    int ans = 1001001001;
    for(int i=0;i<(1 << 2*N);i++){
        vector<int> a,b,c;
        for(int j=0;j<2*N;j+=2){
            int t = (i >> j) & 0b11;
            if(t == 1) a.push_back(l[j/2]);
            else if(t == 2) b.push_back(l[j/2]);
            else if(t == 3) c.push_back(l[j/2]); 
        }
        if((int)a.size() < 1 || (int)b.size() < 1 || (int)c.size() < 1) continue;

        int sum_a = 0;
        int sum_b = 0;
        int sum_c = 0;
        for(int d:a) sum_a += d;
        for(int d:b) sum_b += d;
        for(int d:c) sum_c += d;
        int cost_a = abs(sum_a - A) + 10*((int)a.size() - 1);
        int cost_b = abs(sum_b - B) + 10*((int)b.size() - 1);
        int cost_c = abs(sum_c - C) + 10*((int)c.size() - 1);

        ans = min(ans, cost_a + cost_b + cost_c);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  string ans = "Yes";
  if (A != B || A != C || B != C) {
    ans = "No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,t,t1,t2;
long long sum;
main(){
    cin>>n>>t>>t1;
    for(int i=0;i<n-1;i++){
        cin>>t2;
        if(t2-t1>=t)sum+=t;
        else sum+=t2-t1;
        t1=t2;
    }
    cout<<sum+t<<endl;
}

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

int main() {
  int n;
  string s, t, r;
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++) {
    r += s.at(i);
    r += t.at(i);
  }
  cout << r << endl;
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

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

        sc.close();

        System.out.println(lcm(2, n));

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

//#define DEBUG

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

const int N = 1e5+5;
priority_queue<pair<int, int>> all;
priority_queue<pair<int, int>> rep;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>> > sol;

int vis[N];

int main()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a, b, res = 0;
	cin >> a >> b;
	res = max(a, b);
	res += max(max(a, b)-1, min(a, b));
	cout << res;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <string>
#include <cmath>
#include <math.h>
using namespace std;

class Dice{
public:
	int face[6];
	Dice(){}
	void north(){
		int t=face[0];
		face[0]=face[1];
		face[1]=face[5];
		face[5]=face[4];
		face[4]=t;
	}
	void south(){
		int t=face[0];
		face[0]=face[4];
		face[4]=face[5];
		face[5]=face[1];
		face[1]=t;
	}
	void east(){
		int t=face[0];
		face[0]=face[3];
		face[3]=face[5];
		face[5]=face[2];
		face[2]=t;
	}
	void west(){
		int t=face[0];
		face[0]=face[2];
		face[2]=face[5];
		face[5]=face[3];
		face[3]=t;
	}
	void spin(){
		int t=face[1];
		face[1]=face[2];
		face[2]=face[4];
		face[4]=face[3];
		face[3]=t;
	}
};

bool equal(Dice d1, Dice d2){
	for(int i=0; i<6; i++){
		for(int j=0; j<4; j++){
			if(d1.face[0]==d2.face[0] 
			&& d1.face[1]==d2.face[1] 
			&& d1.face[2]==d2.face[2] 
			&& d1.face[3]==d2.face[3] 
			&& d1.face[4]==d2.face[4] 
			&& d1.face[5]==d2.face[5]) return true;
			d1.spin();
		}
		if(i%2==0) d1.north();
		else d1.east();
	}
	return false;
}

int getRight(Dice d, int top, int front){
	for(int i=0; i<6; i++){
		for(int j=0; j<4; j++){
			if(d.face[0]==top && d.face[1]==front) return d.face[2];
			d.spin();
		}
		if(i%2==0) d.north();
		else d.east();
	}
	return -1;
}

int main(){
	int nums[6];
	Dice dice1 = Dice();
	for(int i=0; i<6; i++){
		cin >> dice1.face[i];
	}
	Dice dice2 = Dice();
	for(int i=0; i<6; i++){
		cin >> dice2.face[i];
	}
	if(equal(dice1,dice2)){
		cout << "Yes" <<endl;
	}else{
		cout << "No" <<endl;
	}
	//printf("%d\n",getRight(dice,t,f));	
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef tuple<int,int,int> TP;

int main(){ 
    int X, Y, Z; cin >> X >> Y >> Z;

    swap(X,Y);
    swap(X,Z);

    cout << X << " " << Y << " " << Z << endl;
}

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

using namespace std;

inline bool dabs(double x) {
	if (x < (double)0) {
		return -x;
	} else {
		return x;
	}
}

inline bool isclose(double x, double y) {
	return dabs(x - y) < 1e-9;
}

int main() {

	double w, h, x, y;

	cin >> w >> h >> x >> y;

	if (isclose(x, w / (double)2) && isclose(y, h / (double)2) ) {
		cout << fixed << (w * h) / (double)2 << " 1\n";
	} else {
		cout << fixed << (w * h) / (double)2 << " 0\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<pair<ll, ll>> p(n);
	rep(i, n) cin >> p[i].first >> p[i].second;
	sort(all(p));
	ll tmp = 0;
	ll ans = 0;
	rep(i, n) {
		if (tmp + p[i].second >= m) {
			while (tmp < m) {
				ans += p[i].first;
				tmp++;
			}
		}
		else {
			ans += p[i].second * p[i].first;
			tmp += p[i].second;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = sc.nextInt();
        
        // onair[i][j]: チャンネルiの時刻jが放送中ならtrue
        boolean[][] onair = new boolean[c][100005];
        for (int i = 0; i < n; i++) {
            int start = sc.nextInt();
            int end = sc.nextInt();
            int ch = sc.nextInt() - 1;
            
            for (int j = start; j <= end; j++) {
                onair[ch][j] = true;
            }
        }
        
        // ans: 同時放送チャンネル数
        int ans = 0;
        for (int i = 0; i < 100005; i++) {
            int count = 0;
            for (int ch = 0; ch < c; ch++) {
                if (onair[ch][i]) {
                    count++;
                }
            }
            
            ans = Math.max(ans, count);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 101092
// http://www.igaris.com/math/c.pdf

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define NEXTP(x) next_permutation(x.begin(),x.end())
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

class comb{
	public:
	vector<ll> f,fr;
	ll MOD;
	//a^(p-1) = 1 (mod p)(p->Prime numbers)
	//a^(p-2) = a^(-1)
	ll calc(ll a,ll b,ll p){//a^(b) mod p   
		if(b==0)return 1;
		ll y = calc(a,b/2,p);y=(y*y)%p;
		if(b & 1) y = (y * a) % p;
		return y;
	}
	void init(ll n,ll mod){//input max_n
		MOD = mod;
		f.resize(n+1);
		fr.resize(n+1);
		f[0]=fr[0]=1;
		for(ll i=1;i<n+1;i++){
			f[i] = (f[i-1] * i) % mod;
			fr[i] = calc(f[i],mod-2,mod);
		}
	}
	ll nCr(ll n,ll r){
		return f[n] * fr[r] % MOD * fr[n-r] % MOD;
	}
};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k;
	cin >> n >> k;
	comb co;
	co.init(n+k,MOD);
	ll ans = 0;
	FOR(i,1,k+1){
		ans += co.calc(-1,k-i,MOD)*co.nCr(k,i)%MOD*co.calc(i,n,MOD)%MOD;
		ans %= MOD;
	}
	if(ans<0)ans+=MOD;
	cout << ans << endl;
}


Measured memory_bytes: 3212
N = int(input())

if N < 105:
    print(0)
elif N >= 105 and N < 135:
    print(1)
elif N >= 135 and N < 165:
    print(2)
elif N >= 165 and N < 189:
    print(3)
elif N >= 189 and N < 195:
    print(4)
else:
    print(5)


Measured memory_bytes: 2940
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
//#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)

int N,M;
int L[200000],R[200000],D[200000];
vector<P> el[100000],er[100000];
ll X[100000];

bool dfs(int id,ll a){
	if(X[id]==-1){
		X[id]=a;
		rep(i,el[id].size()){
			if(!dfs(el[id][i].fr,a-el[id][i].sc)) return 0;
		}
		rep(i,er[id].size()){
			if(!dfs(er[id][i].fr,a+er[id][i].sc)) return 0;
		}
		return 1;
	}
	else {
		if(X[id]!=a) return 0;
		if(X[id]==a) return 1;
	}
}

int main()
{
	cin>>N>>M;
	memset(X,-1,sizeof(X));
	rep(i,M){
		cin>>L[i]>>R[i]>>D[i];
		L[i]--;
		R[i]--;
		el[R[i]].pb(P(L[i],D[i]));
		er[L[i]].pb(P(R[i],D[i]));
	}
	rep(i,N){
		if(X[i]==-1&&!dfs(i,1e+10)){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 17920
import numpy as np 

A = np.ones([3,3])

for i in range(3):
    A[i,:] = [int(i) for i in input().split()]
    
N = int(input())

b = np.ones(N)

for i in range(N):
    b[i] = int(input())
    
    
sheet  = np.zeros([3,3])

for i in range(N):
    for j in range(3):
        for k in range(3):
            if A[j,k] == b[i]:
                sheet[j,k] +=1
dummy = 0
for i in range(3):
    if all([j>0 for j in sheet[:,i]]):
        dummy+= 1
    elif all([j>0 for j in sheet[i,:]]):
        dummy += 1
if (sheet[0,0] >0) & (sheet[1,1] >0) & (sheet[2,2] >0):
    dummy += 1
if (sheet[2,0] >0) & (sheet[1,1] >0) & (sheet[0,2] >0):
    dummy += 1
        
if dummy >0 :
    print("Yes")
else:
    print("No")
        
        
        
        

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

using namespace std;

const int maxn = 3e3+10;

double dp[maxn];

double p[maxn];

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

	for (int i = 1; i <= n; i++)
		cin >> p[i];

	dp[0] = 1.00;
	for (int i = 1; i <= n; i++)
	{	
		for (int j = n; j >= 1; j--)
			dp[j] = (dp[j]*(1.00-p[i])+dp[j-1]*p[i]);

		dp[0] *= (1.00-p[i]);
	}

	double ans = 0.00;
	for (int i = (n+1)/2; i <= n; i++)
		ans += dp[i];

	printf("%.12lf\n", ans);
}

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

void solve() {
    int N, K;
    cin >> N >> K;
    if (K <= (N + 1) / 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i,n) for(unsigned int i=0;i<n;++i)
#define RREP(i,n) for(unsigned int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define INF 1000000001
#define MOD 1000000007

using namespace std;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int s = 0,a=0;
	stack<int> l;
	stack<pair<int,int> > v;
	string c;
	int i = 0;
	cin >> c;
	REP(i, c.size()) {
		if (c[i] == '\\') {
			l.push(i);
		}
		else if (c[i] == '/' && !l.empty()) {
		
			s = i - l.top();
			a += s;
			while (!v.empty() && v.top().second > l.top()) {
				s += v.top().first;
				v.pop();
			}	
			v.push(MP(s, l.top()));
			s = 0;
			l.pop();
		}
	}
	int k = v.size();
	cout << a << endl;
	cout << k;
	stack<int> res;
	REP(i, k) {
		int a = v.top().first;
		v.pop();
		res.push(a);
	}
	REP(i, k) {
		cout << " " << res.top();
		res.pop();
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3252
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<math.h>
using namespace std;
#define MAX 500005
#define MOD 1000000007
#define EPS 0.00000000001
#define INF 2000000000000000000
long long int fact[MAX+1],fact_inv[MAX+1];
long long int gcd(long long int a,long long int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
long long int egcd(long long int a, long long int b, long long int & x, long long int & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    long long int x1, y1;
    long long int d = egcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
long long int ModuloInverse(long long int a,long long int n)
{
    long long int x,y;
    x=gcd(a,n);
    a=a/x;
    n=n/x;
    long long int res = egcd(a,n,x,y);
    x=(x%n+n)%n;
    return x;
}
void precal()
{
    int i;
    fact[0]=fact_inv[0]=1;
    for(i=1;i<=MAX;i++)
    {
        fact[i]=(fact[i-1]*i)%MOD;
        fact_inv[i]=ModuloInverse(fact[i],MOD);
    }
}
long long int C(long long int n,long long int r)
{
    long long int res=fact[n];
    res=(res*fact_inv[n-r])%MOD;
    res=(res*fact_inv[r])%MOD;
    return res;
}

int main()
{
    precal();
    int n,m,i;
    scanf("%d %d",&n,&m);
    long long temp,ans=C(m,n);
    ans=(ans*fact[n])%MOD;
    ans=(ans*ans)%MOD;
    for(i=1;i<=n;i++)
    {
        temp=C(m,n);
        temp=(temp*fact[n])%MOD;
        temp=(temp*C(n,i))%MOD;
        temp=(temp*fact[n-i])%MOD;
        temp=(temp*C(m-i,n-i))%MOD;
        if(i%2==0) temp=-temp;
        ans=(ans-temp+MOD)%MOD;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 11644
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <set>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

ll modinv(ll x, ll m = mod) {
  ll b = m;
  ll u = 1;
  ll v = 0;
  ll tmp;
  while (b) {
    ll t = x / b;
    x -= t * b;
    tmp = x;
    x = b;
    b = tmp;
    u -= t * v;
    tmp = u;
    u = v;
    v = tmp;
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

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

  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (auto &x: a) cin >> x;

  k--;
  sort(a.begin(), a.end());

  vector<ll> factorial(n*2+2);
  factorial[0] = 1;
  for (int i = 1; i < 2 * n; i++) factorial[i] = (factorial[i-1] * i) % mod;
  vector<ll> nck(n*2+2);
  nck[k] = 1;
  for (int i = k+1; i < 2 * n; i++) nck[i] = (factorial[i] * modinv((factorial[k] * factorial[i-k]) % mod)) % mod;

  vector<ll> maxfactor(n);
  for (int i = 0; i < n; i++) {
    maxfactor[i] = nck[i];
  }
  vector<ll> minfactor = maxfactor;
  reverse(minfactor.begin(), minfactor.end());

  ll mintotal = 0;
  ll maxtotal = 0;
  for (int i = 0; i < n; i++) {
    mintotal = (mintotal + (a[i] * minfactor[i]) % mod) % mod;
    maxtotal = (maxtotal + (a[i] * maxfactor[i]) % mod) % mod;
  }

  ll ans = (maxtotal - mintotal) % mod;
  if (ans < 0) ans += mod;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    if(s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba")
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    return 0;
}

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

public class Don
{
    public Don() { }
    private Reader r = new Reader();

    public void Solve()
    {
        var A = r.nextInt();
        var B = r.nextInt();
        var C = r.nextInt();
        var D = r.nextInt();

        if (A * B >= C * D)
        {
            Console.WriteLine(A * B);
        } else
        {
            Console.WriteLine(C * D);
        }


    }

    public static void Main(string[] args)
    {
        new Don().Solve();
    }

}

class Reader
{
    string[] s;
    int i;
    char[] cs = new char[] { ' ' };

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

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

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Measured memory_bytes: 2776
fun main(args: Array<String>) {
  val N = readInt()
  val A = readInts().sortedDescending()
  val B = readInts().sorted()
  val C = readInts().sorted()

  var sum = 0L
  B.forEach { b ->
    val aNum = A.size - A.myBinarySearch { a -> a < b }
    val cNum = C.size - C.myBinarySearch { c -> b < c }
    sum += aNum.toLong() * cNum
  }
  println(sum)
}

fun myBinarySearch(begin: Int, end: Int, isOk: (key: Int) -> Boolean): Int {
  var ng = begin - 1
  var ok = end

  while (Math.abs(ok - ng) > 1) {
    val mid = (ok + ng) / 2
    if (isOk(mid)) {
      ok = mid
    } else {
      ng = mid
    }
  }

  return ok
}

fun <T> List<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(0, size) { index -> isOk(get(index)) }
}

fun <T> Array<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(0, size) { index -> isOk(get(index)) }
}


fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 108948
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <bitset>
#include <random>
#include <stack>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <ctime>

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define sc second
#define fs first
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template<class T> T sqr(T x) { return x*x; }
ld pi = 3.1415926535897932384626433832795;
ll mod = 1e9 + 7;
const int N = 1e6 + 10;

typedef vector<vector<ll> > mtrx;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

vector<int> g[N];
bool is_toN[N];
int n, m;

int main(){
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
		if(v == n)
			is_toN[u] = 1;
		if (u == n)
			is_toN[v] = 1;
	}
	bool can = 0;
	for (int i = 0; i < g[1].size(); i++) {
		can |= is_toN[g[1][i]];
	}
	if (!can) cout << "IM";
	cout << "POSSIBLE";
	return 0;
}

Measured memory_bytes: 30960
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')
const N = lines[0] - 0
const c = lines[1].split('')

let rm = []
for (let i = 0; i < N; i++) {
    if (c[i] === 'R') {
        rm.push(i)
    }
}
const r = rm.length
const w = N - r

let count = 0
for (let i = 0; i < r; i++) {
    if (c[i] === 'W') {
        count++
    }
}
console.log(count)


Measured memory_bytes: 39524
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;

void input() {
  cin >> n;
}

void solve() {
  int ans = 1;

  while (ans <= n)
    ans *= 2;

  cout << ans / 2 << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 4;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


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

#define endl '\n'

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long double L, volume;
    cin >> L;
    long double edge = L / 3;
    volume = edge * edge * edge;
    cout << fixed << setprecision(7) <<  volume << endl;
    return 0;
}

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

int gcd(int a, int b){
    int t = a % b;
    if(t == 0) return b;
    else return gcd(b, t);
}

int main(){
    int K;
    cin >> K;
    int64_t sum = 0;
    for(int i=1; i<=K; i++){
        for(int j=1; j<=K; j++){
            for(int k=1; k<=K; k++){
                sum += gcd(gcd(i, j), k);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+100;
int prime[N];
int vis[N];
int  tot=1;
queue<int>q;
void oula()
{
    for(int i=2;i<=N;i++){
         if(!vis[i]) prime[tot++]=i;
         for(int j=1;j<=tot;j++){
            if(i*prime[j]>N) break;
            vis[i*prime[j]]=1;
            if(i%prime[j]==0) break;
         }
    }
}
int main()
{
    oula();
    tot--;
    ll n;cin>>n;
    ll ans=0;
    for(int i=1;i<=tot;i++){
            int k=0;
            if(n%prime[i]!=0) continue;
        while(n%prime[i]==0){
            k++;
            n/=prime[i];
        }
        q.push(k);
    }
    if(n>N) q.push(1);
    while(q.size()){
        int v=q.front();q.pop();
        int k=1;
        while(v>=k){
        v-=k;
        k++;
        ans++;
           }
        }
        cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 7848
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

N, M, X = read_ints()
C, *A = read_col(N)


def ret_each_exp(p):
    exps = [0] * M
    money = 0
    # print(p)
    for i, pp in enu(p):
        if pp == 0:
            continue
        for m in range(M):
            exps[m] += A[m][i]
        money += C[i]
    return exps, money


def is_valid(exps):
    for e in exps:
        if e < X:
            return False
    return True


ans = INF
for p in product(range(2), repeat=N):
    exps, money = ret_each_exp(p)
    if is_valid(exps):
        ans = min(ans, money)
print(ans if ans != INF else -1)


Measured memory_bytes: 69184
n,m=map(int,input().split())
a=[list(map(int,input().split(" "))) for i in range(n)]

for i in range(n):
    print(*a[i],sum(a[i]))

c=[0]*m
for i in range(m):
    for j in range(n):
        c[i]=a[j][i]+c[i]
print(*c,sum(c))



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

int main(){
    int n, A[100], c = 0;
    cin >> n;
    for ( int i = 0; i < n; i++) cin >> A[i];

    bool flag = 1;
    for ( int i = 0; flag; i++ ){
        flag = 0;
        for( int j = n-1; j > i; j--){
            if ( A[j-1] > A[j] ){
                swap(A[j-1], A[j]);
                c++;
                flag = 1;
            }
        }
    }

    for ( int i = 0; i < n; i++){
        if ( i ) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 3108
//__n1colai__
#include <bits/stdc++.h>
#include<stdint.h>
using namespace std;
#define vi vector<int>
#define pb emplace_back
#define w(t)   int t;cin>>t;while(t--)
#define show(ar) for(int i=0;i<ar.size();i++) cout<<ar[i]<<" "; cout<<endl;
#define mod 1e9+7
#define ff first
#define ss second
#define fio ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define all(x) (x.begin(),x.end())
#define inf 1e9+7
#define MAX 90000000
#define ll long long

vi inp(int n)
{
	vi v; int x;
	for(int i=0;i<n;i++) {
		cin>>x; v.pb(x);
	}
	return v;
}


int main()
{
	fio
	ll n; cin>>n;
	vi ar;
	while(n>0){
		ar.pb(n%26);
		if(n%26==0) n--;
		n/=26;
	}
	string ans="";
	for(int i=0;i<ar.size();i++){
	//	cout<<ar[i]<<" ";
		if(ar[i]==0) ar[i]=26;
		ans+=ar[i]+'a'-1;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main(void){
   long long N,M;
   cin>>N>>M;
   long long temp=min(N,M/2);
   long long count=temp+(M-temp*2)/4;
   cout<<count<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int dp[3001][3001];
int main(void)
{
	int i,j,n,t,s,a[3001],b[3001],max;
	scanf("%d %d %d",&n,&t,&s);
	for(i=1;i<=n;i++) scanf("%d %d",&a[i],&b[i]);
	for(i=0;i<=n;i++){
		for(j=0;j<=t;j++) dp[i][j]=-1;
	}
	dp[0][0]=0;
	for(i=0;i<n;i++){
		for(j=0;j<=t;j++){
			if(dp[i][j]!=-1){
				if(dp[i][j]>dp[i+1][j]) dp[i+1][j]=dp[i][j];
				if(j>=s||j+b[i+1]<=s){
					if(j+b[i+1]<=t&&dp[i][j]+a[i+1]>dp[i+1][j+b[i+1]]&&j+b[i+1]<=t){
						dp[i+1][j+b[i+1]]=dp[i][j]+a[i+1];
					}	
				}
				else if(s+b[i+1]<=t&&dp[i][j]+a[i+1]>dp[i+1][s+b[i+1]]){
					dp[i+1][s+b[i+1]]=dp[i][j]+a[i+1];
				}
			}
		}
	}
	max=0;
	for(j=0;j<=t;j++){
		if(max<dp[n][j]) max=dp[n][j];
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 35804
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a,b,ss;
    cin>>n;
    ss=0;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        ss+=b-a+1;
    }
    cout<<ss<<endl;

    return 0;
}



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

int main(){
  
  string S;
  long long Sum=0, N;
  cin>>S;
  N=S.size();
  
  for(int i=0; i<N; i++){
    Sum+=(long long)(S[i]-'0');

  }
  if(Sum%9==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3752
#include<stdio.h>
#include<limits.h>
#define MAX 100
int ar[MAX][MAX],color[MAX],d[MAX],pi[MAX];
void dijkstra(int,int);
int main(){
  int n,m,i,j,s,t,num;
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
      ar[i][j]=1000000;
    }
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&num,&m);
    for(j=0;j<m;j++){
      scanf("%d %d",&s,&t);
      ar[i][s]=t;
    }
  }

  dijkstra(n,0);
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
    
  }
  
  
}
void dijkstra(int w,int s){
  int i,j,mincost,u;
  for(i=0;i<w;i++){
    d[i]=INT_MAX;
    pi[i]=-1;
    color[i]=0;
  }
  d[s]=0;
  while(1){
    mincost=INT_MAX;
    for(i=0;i<w;i++){
      if(color[i]!=1&&d[i]<mincost){
	mincost=d[i];
	u=i;
	
      }
    }
    if(mincost==INT_MAX){
      break;
    }
    color[u]=1;
    for(j=0;j<w;j++){
      if(color[j]!=1&&(d[u]+ar[u][j])<d[j]){
	pi[j]=u;
	d[j]=d[u]+ar[u][j];
	
      }
    }

  }
}



Measured memory_bytes: 2060