akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> p;
  for (int i = 2; i <= N; i++){
    bool prime = true;
    for (int j = 2; j * j <= i; j++){
      if (i % j == 0){
        prime = false;
      }
    }
    if (prime){
      int tmp = 0;
      int N2 = N;
      while (N2 > 0){
        tmp += N2 / i;
        N2 /= i;
      }
      p.push_back(tmp);
    }
  }
  int C = p.size();
  int ans = 0;
  for (int i = 0; i < C; i++){
    if (p[i] >= 74){
      ans++;
    }
  }
  for (int i = 0; i < C; i++){
    for (int j = 0; j < C; j++){
      if (i != j){
        if (p[i] >= 24 && p[j] >= 2){
          ans++;
        }
      }
    }
  }
  for (int i = 0; i < C; i++){
    for (int j = 0; j < C; j++){
      if (i != j){
        if (p[i] >= 14 && p[j] >= 4){
          ans++;
        }
      }
    }
  }
  for (int i = 0; i < C; i++){
    for (int j = i + 1; j < C; j++){
      for (int k = 0; k < C; k++){
        if (i != k && j != k){
          if (p[i] >= 4 && p[j] >= 4 && p[k] >= 2){
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    D = [
        [int(a) for a in input().split()]
        for _ in range(N)
    ]

    # N, K = [int(a) for a in input().split()]
    # A = [int(a) for a in input().split()]
    # T1, T2, T3 = [int(a) for a in input().split()]

    flag = False
    for i in range(N - 2):
        d1 = D[i]
        d2 = D[i + 1]
        d3 = D[i + 2]
        if d1[0] == d1[1] and d2[0] == d2[1] and d3[0] == d3[1]:
            flag = True
            break
    if flag:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 68424
#  --*-coding:utf-8-*--

import math

def gcd(n, m):
    while m > 0:
        n, m = m, n%m

    return n


def main():
    A, B = map(int, input().split())
    g = gcd(A, B)

    g2 = int(math.sqrt(g))
    cnt = 1

    if g%2 == 0:
        cnt += 1
        while g%2 == 0:
            g //= 2

    for i in range(3, g2+1, 2):
        if g%i == 0:
            cnt += 1
            while g%i == 0:
                g //= i

    if g > 1:
        cnt += 1
            
    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main
  
import (
    "fmt"
)

func main() {
    var n, k int
    fmt.Scan(&n, &k)

    var s float64
    for i := 1; i <= n; i++ {
        p := 1 / float64(n)
        for j := 1; i*j < k; j *= 2 {
            p /= 2
        }
        s += p
    }
    fmt.Println(s)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<string, int, int> TU;

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    cout << A*B/2;
}


Measured memory_bytes: 3572
import sys
def f(x):
  return [3,3,2,2,2,2,1,1,1,1,1,0][min(11,int(float(x)*10))]

C1=[0]*4
C2=[0]*4
for s in sys.stdin:
  L, R = map(f,s.split())
  C1[L]+=1
  C2[R]+=1
for a,b in zip(C1,C2):
  print a,b

Measured memory_bytes: 4228
n,m=map(int,input().split())
f=sorted([list(map(int,input().split())) for i in range(m)])
if n==1:
  print(f[0][1] if m==1 else -1 if m>=2 else 0)
else:
  for i in range(10**(n-1),10**n):
    d=str(i)
    for b,v in f:
      if int(d[b-1])!=v:break
    else:print(i);exit()
  else:print(-1)

Measured memory_bytes: 3064
#include<cstdio>
using namespace std;
double p[3005],dp[3005][3005];
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	scanf("%lf",&p[i]);
	dp[0][0]=1;
	for (int i=1;i<=n;i++){
		dp[i][0]=dp[i-1][0]*(1-p[i]);
		for (int j=1;j<=i;j++)
		dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
	}
	
	double ans=0;
	for (int i=1;i<=n;i++)
	if (i>n-i) ans+=dp[n][i];
	printf("%.10lf\n",ans);
}

Measured memory_bytes: 68992
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iterator>
#include <deque>
#include <string>
#include <queue>
#include <omp.h>
#include <fstream>   // ifstream, ofstream
typedef int64_t ll;
using namespace std;
const ll INF=1e10;
#include <cstdint>
#include <iostream>
#include <utility>
#include <map>

int64_t gcd(int64_t a,int64_t b){//calc gcd
	if(a==0){
		return b;
	}else if(b==0){
		return a;
	}else if(a>b){
		return gcd(a%b,b);
	}else{
		return gcd(b%a,a);
	}
}
std::pair<int64_t,int64_t> extgcd(int64_t a,int64_t b){//a*(pair->first) + b*(pair->second) = gcd(a,b)
	if(a==0){
		return std::make_pair(0,1);
	}else if(b==0){
		return std::make_pair(1,0);
	}else{
		if(a>b){
			std::pair<int64_t,int64_t> d=extgcd(a%b,b);
			return std::make_pair(d.first,d.second-(a/b)*d.first);
		}else{
			std::pair<int64_t,int64_t> d=extgcd(a,b%a);
			return std::make_pair(d.first-(b/a)*d.second,d.second);
		}
	}

}
int64_t inline normalize_mod(int64_t a,int64_t m){
	return (m+a%m)%m;
}
int64_t mod_inv(int64_t a,int64_t m){//a^-1(mod m),m is a prime number
	int64_t raw=extgcd(a,m).first;
	return normalize_mod(raw,m);;
}
std::map<int64_t,int64_t> factorization(int64_t n){
	std::map<int64_t,int64_t> retval;
	for(int64_t i=2;i*i<=n;i++){
		int64_t counter=0;
		while(n%i==0){
			n=n/i;
			counter++;
		}
		if(counter!=0){
			retval.emplace(i,counter);
		}
	}
	return retval;
}
std::pair<int64_t,int64_t> mod_fact(int64_t n,int64_t m){//n!=first*m^second
	if(n==0){
		return std::make_pair(1,0);
	}else{

		std::pair<int64_t,int64_t> d=mod_fact(n/m,m);
		int64_t second=d.second+n/m;
		int64_t first;
		if((n/m)%2==0){
			first=1;
		}else{
			first=m-1;
		}
		for(int64_t i1=1;i1<=(n%m);i1++){
			first=normalize_mod(first*i1,m);
		}
		return std::make_pair(first,second);
	}
}

int main(){
	ll n,m;
	cin>>n>>m;
	bool *error =new bool[n+1];
	ll *sum = new ll[n+1];
	for(ll i1=0;i1<n+1;i1++){
		error[i1]=false;
		sum[i1]=0;
	}
	for(ll i1=0;i1<m;i1++){
		ll temp;
		cin>>temp;
		error[temp]=true;
	}
	sum[0]=1;
	if(!error[1]){
		sum[1]=1;
	}
	for(ll i1=2;i1<=n;i1++){
		if(!error[i1]){
			sum[i1]=normalize_mod(sum[i1-1]+sum[i1-2],1000000007);
		}
	}
	cout<<sum[n]<<endl;
}


Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    int x; cin >> x;
    for (int i = x; ; i++) {
        string s = to_string(i);
        bool b = true;
        if (count(s.begin(), s.end(), s[0]) == (int)s.size()) {
            cout << s << "\n";
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m = map(int,input().split())
edge_ls = [0] * m
for i in range(m):
    a,b = map(int,input().split())
    edge_ls[i] = [a,b]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        '''
        xとyは-=1して使うのが基本
        '''
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
edge_q = deque(edge_ls)
num_bridge = 0
for i in range(m):
    tar = edge_q.popleft()
    uf = UnionFind(n)
    for a,b in edge_q:
        a -= 1
        b -= 1
        uf.union(a,b)
    if not uf.group_count() == 1:
        num_bridge += 1
    edge_q.append(tar)
print(num_bridge)

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    ll n, k;
    string s;
    cin >> n >> k >> s;

    ll cnt = 0;
    rep(i, s.size()-1) {
        if (s[i] != s[i + 1]) cnt++;
    }
    cnt = max(ll(0), cnt - 2 * k);
    ll ans = n - 1 - cnt;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (std::decay_t<decltype(k)> i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u64 n; std::cin >> n;
    vec<u64> a(n);
    u64 X = 0;
    REP (i, n) {
        u64 x; std::cin >> x;
        X ^= x;
        a.at(i) = x;
    }
    REP (i, n) std::cout << (i ? " " : "") << (X ^ a.at(i));
    std::cout << '\n';
}


Measured memory_bytes: 4728
#include<bits/stdc++.h> 
int n,a[100010];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=100000;++i) a[i]=0;
	for (int x=1;x<=100;x++) for (int y=1;y<=100;y++) for (int z=1;z<=100;z++)
	a[x*x+y*y+z*z+x*y+y*z+z*x]++;	
	for (int i=1;i<=n;++i) printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 4196
#include<stdio.h>
int main(void){
int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(x>=r && y>=r && (x+r)<=W && (y+r)<=H)
 printf("Yes\n");
else
 printf("No\n");

return 0;
}

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

int main(){
    int k;
    cin >> k;
    string s;
    cin >> s;
    int N = s.length();
    if(N <= k){
        cout << s << endl;
    }
    else{
        cout << s.substr(0, k) + "..." << endl;
    }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int n, q, l;
int u[100010], v[100010];
vector<int> C[100010];
int depth[100010], par[20][100010];

void dfs(int v, int p, int d){
    par[0][v] = p;
    depth[v] = d;
    for(auto u : C[v]){
        dfs(u, v, d + 1);
    }
}

void build(){
    dfs(0, -1, 0);
    for(int k = 0; k <= l; k++){
        for(int i = 0; i < n; i++){
            if(par[k][i] == -1) par[k + 1][i] = -1;
            else par[k + 1][i] = par[k][par[k][i]];
        }
    }
}

int lca(int u, int v){
    if(depth[u] < depth[v]) swap(u, v);
    for(int i = 0; i <= l; i++){
        if(((depth[u] - depth[v]) >> i) & 1){
            u = par[i][u];
        }
    }
    if(u == v) return u;
    for(int i = l; i >= 0; i--){
        if(par[i][u] != par[i][v]){
            u = par[i][u];
            v = par[i][v];
        }
    }
    return par[0][u];
}

void solve(){
    build();
    cin >> q;
    for(int i = 0; i < q; i++){
        int u, v;
        cin >> u >> v;
        cout << lca(u, v) << endl;
    }
}

void init(){
    cin >> n;
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int chi;
            cin >> chi;
            C[i].push_back(chi);
        }
    }
    while((1 << l) < n) l++;
}

int main(){
    init();
    solve();
    return 0;
}


Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
int k[2020],f[2000005],a[2000005],g[2000005];
long long sum;
int main()
{
	string s;
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++)
	  a[i+1]=s[i]-'0';
	int l=1;
	for(int i=n;i>=1;i--)
	{
		g[i]=l;
		l*=10;
		l%=2019;
	}
	for(int i=n;i>=1;i--)
	{
		f[i]=(f[i+1]+a[i]*g[i])%2019;
		k[f[i]]++;
	}
	sum=k[0];
	sum+=(k[0]*(k[0]-1)/2);
	for(int i=1;i<=2018;i++)
	  sum+=(k[i]*(k[i]-1)/2);
	cout<<sum;
	return 0;
}

Measured memory_bytes: 6132
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner teclado = new Scanner(System.in);
		int x = teclado.nextInt();
		int a = teclado.nextInt();
		if (x < a) {
			System.out.println("0");
		}
		
		if (x >= a) {
			System.out.println("10");
		}
		teclado.close();
		
	}
}

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

int main(){
    // input
    long long N, ans, a, b;
    cin >> N;

    // calc
    ans = N;
    for( a=1; a<sqrt(N)+1; a++ ){
        b = N / a;
        if( a*b == N ){
            if( ans > a+b-2 ){
                ans = a + b - 2;
            }
        }
    }

    // output
    cout << ans << endl;
} 

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int N,i,sum;
  cin>>N;
  i=N;
  sum=0;
while(N>0){
sum+=N%10;
N/=10;
}
if(i%sum==0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

const int MAX_N = (int)2e5 + 77;

vector<int> g[MAX_N];
ll answ[MAX_N], add[MAX_N];

int n, q;

void dfs(int v, int par)
{
	answ[v] = add[v] + (par == NIL ? 0 : answ[par]);

	for(auto& u: g[v])
	{
		if(u != par)
			dfs(u, v);		
	}
}

void solve()
{
	cin >> n >> q;

	for(int i = 0; i < n - 1; ++i)
	{
		int a, b;
		cin >> a >> b;
		--a, --b;

		g[a].push_back(b);
		g[b].push_back(a);
	}

	for(int i = 0; i < q; ++i)
	{
		int v;
		ll x;

		cin >> v >> x;
		--v;

		add[v] += x;
	}

	dfs(0, NIL);

	for(int v = 0; v < n; ++v)
		cout << answ[v] << " ";

	cout << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 25600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

int main(){
long long a,b;cin>>a>>b;
long long x=__gcd(a,b);
a/=x;b/=x;
cout<<a*b*x;


}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

string s;

int main(){

    cin >> s;

    s[3] = '8';

    cout << s;





}

//g++ -std=c++14 comp.cpp -o b; ./b.exealso

Measured memory_bytes: 256
mod = 998244353
k, n = map(int, input().split())


def inv(a,mod):
    r = [1,0,a]
    w = [0,1,mod]
    while w[2]!=1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = w
        w = r_new
    x,y = w[0],w[1]    # a*x+y*mod = 1
    return (mod+x%mod)%mod

max_num = 2*10**5+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2,max_num):
    fact[i] = fact[i-1] * i % mod

ifact[max_num-1] = inv(fact[max_num-1],mod)

for i in range(2,max_num):
    ifact[max_num-i] = (ifact[max_num-i+1] * (max_num-i+1)) %mod

def comb(x,y):
    if x < 0 or y < 0 or x < y:
        return 0
    else:
        return fact[x] * ifact[y] * ifact[x-y] % mod


if k == 1:
    print(0)
    exit()
elif k == 2:
    print(2)
    print(2)
    print(2)
    exit()

ansl = [0]*(2*k-1)

for ii in range(2, 2*k+1):
    ans = 0
    j = max(1,ii-k)

    if i % 2 == 0:
        pair = ii//2 - j
        mid = 1
    else:
        pair = (ii+1)//2 - j
        mid = 0

    if pair == 0:
        ans += comb(n-1+k-2, k-2) + comb(n+k-2, k-2)
        ans %= mod
    else:
        if mid == 0:
            for i in range(pair+1):
                if k-2*pair+i == 0:
                    continue
                ans += comb(pair, i) * 2**i * comb(n-i + k-2*pair+i-1, k-2*pair+i-1)
                ans %= mod
        else:
            for i in range(pair+1):
                if k-2*pair-mid+i == 0:
                    continue
                ans += comb(pair, i) * 2**i * comb(n-i-1+k-2*pair-mid+i-1,k-2*pair-mid+i-1)
                ans += comb(pair, i) * 2**i * comb(n-i+k-2*pair-mid+i-1,k-2*pair-mid+i-1)
                ans %= mod
    ansl[ii-2] = ans
    if ii == k+1:
        break


for i in range(k-1):
    print(ansl[i])

print(ansl[k-1])

for i in range(k+1,2*k):
    print(ansl[2*k-1-i])


Measured memory_bytes: 64844
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;

//a, a + 1, a + 2, ... , b - 1, bの総和を求める関数(a <= b)。計算量はO(1)
Int Sum(Int a, Int b) {
	if (b < a)return 0;
	if ((b - a + 1) % 2 == 0)return (a + b) * (b - a + 1) / 2;
	else return (a + b) * ((b - a + 1) / 2) + (a + b) / 2;
}

void calc() {

	std::set<std::string> s;
	Int N; std::cin >> N;
	rep(i, N) {
		std::string str; std::cin >> str;
		s.insert(str);
	}

	std::cout << s.size();

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 19204
#include <map>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn=1e5+5;

ll l;int n,m;
map<int,int>good;
char s[maxn],t[maxn];

int read() {
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return x*f;
}

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

int main() {
	n=read(),m=read();
	scanf("%s%s",s,t);
	l=1ll*n*m/gcd(n,m);
	for(int i=0;i<n;i++)
		good[i*(l/n)+1]=s[i];
	for(int i=0;i<m;i++)
		if(good[i*(l/m)+1]&&good[i*(l/m)+1]!=t[i]) {
			puts("-1");exit(0);
		}
	printf("%lld\n",l);
	return 0;
}


Measured memory_bytes: 8192
#define _USE_MATH_DEFINES  

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


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

    std::vector<std::vector<int>> table(n + 1, std::vector<int>(m + 1, 0));

    int buf, sum = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            std::cin >> buf;
            sum += buf;
            table.at(i).at(j) = buf;
            table.at(i).at(m) += buf;
            table.at(n).at(j) += buf;
        }
    }

    table.at(n).at(m) = sum;

    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= m; ++j){
            std::cout << table.at(i).at(j);
            if(m == j){
                std::cout << std::endl;
            }else{
                std::cout << " ";
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3172
module Memoizable
	def memoize(name)
		original = "__original_#{name}__"
		([Class, Module].include?(self.class) ? self : self.class).class_eval {
			alias_method(original, name)
			private(original)
			cache = {}
			define_method(name){|*args|
				cache[args] ||= send(original, *args)
			}
		}
	end 
end
include Memoizable

MOD = 1_000_000_007

def fact(n)
	return 1 if n == 0
	n * fact(n-1)
end

def all_perm(n)
	return 1 if n == 0
	1 + (0..n-1).map {|k| fact(n) / fact(k)}.inject(:+)
end

$save = {}
def f(sizes, k)
	h = { [0, 0] => 1 }
	sizes.reverse.each.with_index do |s, i|
		new_h = Hash.new(0)
		h.each do |(k, l), c|
			new_h[[k, l]] += c
			new_h[[k+1, l+s]] += c
		end
		h = new_h
		$save[k] = Marshal.load(Marshal.dump(h)) if i == sizes.size - 2
	end

	s = 0
	h.each do |(k, l), c|
		s += (10 ** l) * c * fact(k) * all_perm(sizes.size - k)
	end
	s
end

memoize :fact
memoize :all_perm
memoize :f

n = gets.to_i
cards = (1..n).map { gets.to_i }.sort
sum = 0

size_count = Hash.new(0)
sum_per_size = Hash.new(0)
cards.each do |x|
	k = x.to_s.size
	size_count[k] += 1
	sum_per_size[k] += x
end

(1..4).each do |i|
	sizes = (1..4).map {|j| [j] * [size_count[j] - (j == i ? 1 : 0), 0].max}.flatten
	sum += sum_per_size[i] * f(sizes, i)
end

if cards[0] > 0 || n == 1
	puts sum % MOD
	exit
end

n -= 1
(1..4).each do |i|
	next if size_count[i] == 0
	($save[i] || []).each do |(k, l), c|
		sum -= (sum_per_size[i] * 10 ** l) * c * fact(k) * all_perm(n - 1 - k)
	end
end

puts sum % MOD

Measured memory_bytes: 63040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();

		if (a <= 8 && b <= 8)
			System.out.println("Yay!");
		else
			System.out.println(":(");

	}
}

Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var AB = ReadLine().Split().Select(int.Parse).ToArray();
        int A = AB[0];
        int B = AB[1];
        var P = ReadLine().Split().Select(int.Parse).ToArray();
        int low = P.Count(_ => _ <= A);
        int mid = P.Count(_ => A < _ && _ <= B);
        int high = P.Count(_ => B < _);
        WriteLine(Min(low,Min(mid,high)));
    }
}


Measured memory_bytes: 28120
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define foreach(elements) for()

struct Node {
    vector<int> to;
    int score;
};

void dfs(int vertex, vector<Node> &nodes, int parent = -1){
    Node current = nodes[vertex];
    for(vector<int>::iterator i = nodes[vertex].to.begin(); i != nodes[vertex].to.end(); i++){
        if (*i == parent){
            continue;
        }
        nodes[*i].score += current.score;
        dfs(*i, nodes, vertex);
    }
}

int main(){
    int N,Q;
    int a,b;
    cin >> N >> Q;
    vector<Node> nodes(N);
    rep(i, N-1){
        cin >> a >> b;
        a--;
        b--;
        nodes[a].to.push_back(b);
        nodes[b].to.push_back(a);
    }
    rep(i, Q){
        cin >> a >> b;
        a--;
        nodes[a].score += b;
    }

    dfs(0, nodes);

    rep(i, N){
        cout << nodes[i].score << " ";
    }

}

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

int main() {
	ll n,a,t;
	cin>>n>>t>>a;;
	ll height[n];
	ll tempd[n];
	ll c=2000000000;
	ll index =0;
	for (int i=0;i<n;i++){
		cin>>height[i];
	}
	for(int j=0;j<n;j++){
		if(abs((t*1000-height[j]*6)-a*1000)<c){
		c=abs((t*1000-height[j]*6)-a*1000);
		index=j;}
	}
	cout<<index+1;
}

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

int main()
{
	while (1){
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0)break;
		int j;
		int w[1100] = {};
		for (int i = 0; i < n; i++)
			for (int k = 0; k < m; k++){
			cin >> j; w[k] += j;
			}
		j = 0;
		for (int i = 0; i < m; i++){
			for (int k = 0; k < m; k++)
			{
				if (w[j] < w[k])j = k;
			}
			cout << j + 1; if (i != m - 1)cout << " ";
			w[j] = -1;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1164
// Problem : D - Banned K
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int arr[maxN];
ll ile[maxN], ans;

int main() {
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	REP(i, n) {
		cin >> arr[i];
		ile[arr[i]]++;
	}
	RI(i, n) ans += (ile[i] * (ile[i] - 1)) / 2;
	REP(i, n) {
		cout << ans - ile[arr[i]] + 1 << "\n";
	}
	return 0;
}
 


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, ll> Pil;

int N, M;

struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) : par(N), rank(N) {
        for(int i = 0; i < N; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void merge(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (rank[rx] < rank[ry]) swap(rx, ry);
        if (rank[rx] == rank[ry]) rank[rx]++;
        par[ry] = rx;
    }

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


int main() {
    cin >> N >> M;
    UnionFind tree(N);
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        tree.merge(A-1, B-1);
    }

    set<int> roots;
    for (int i = 0; i < N; i++) {
        roots.insert(tree.root(i));
    }

    cout << roots.size() - 1 << endl;

    return 0; 
}


Measured memory_bytes: 7784
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AXORCircle solver = new AXORCircle();
        solver.solve(1, in, out);
        out.close();
    }

    static class AXORCircle {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = in.nextInt();

            HashMap<Integer, Integer> count = new HashMap<>();
            for (int x : a) {
                count.put(x, count.getOrDefault(x, 0) + 1);
            }

            boolean answer = true;
            answer &= count.size() <= 3;

            int xor = 0;
            for (int x : a)
                xor ^= x;
            answer &= xor == 0;

            TreeSet<Integer> distinct = new TreeSet<>();
            for (int c : count.values()) {
                distinct.add(c);
            }
            answer &= (count.size() == 3 && distinct.size() == 1) || (count.size() == 2 && distinct.first() * 2 == distinct.last()) || (count.size() == 1);

            out.println(answer ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 44304
n = int(input())
A = [int(i) for i in input().split()]
q = int(input())
M = [int(i) for i in input().split()]


def set_possible_m(depth: int, sum: int):
    possible_m[sum] = True

    if depth == n:
        return

    set_possible_m(depth + 1, sum)
    if sum + A[depth] < 2000:
        set_possible_m(depth + 1, sum + A[depth])


possible_m = [False] * 2000
set_possible_m(0, 0)

for mi in M:
    if possible_m[mi]:
        print('yes')
    else:
        print('no')




Measured memory_bytes: 5644
// ABC171C.cpp
#include <iostream>
using ll = long long;
#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
using namespace std;
int main()
{
    ll n;
    cin >> n;
    char dit[20] = {};
    int i = 0;
    while (n > 0)
    {
        n--;
        dit[i] = (n % 26)+'a';
        n = n / 26;
        i++;
    }
    for (int j = 19; j >= 0; j--) {
        if (dit[j] >= '0') cout << dit[j];
    }
    cout << endl;
}


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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N;
vector<int> C;
vector<int> S;
vector<int> F;

int main(void) {
    cin >> N;
    rep(i, N - 1) {
        int c, s, f;
        cin >> c >> s >> f;
        C.push_back(c);
        S.push_back(s);
        F.push_back(f);
    }

    for(int i = 0; i < N - 1; ++i) {
        ll t = 0;
        for (int k = i; k < N - 1; ++k) {
            // 発車時刻前なら待つ
            if (t < S[k]) {
                t = S[k];
            }

            ll fmod = t % F[k];
            if (fmod > 0) {
                t += F[k] - fmod;
            }

            t += C[k];
        }

        cout << t << endl;

    }

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

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

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n);
        for (int i = 0; i < n; i ++) {
                scanf("%d", &a[i]);
        }
        int ans = pow(3, n);
        int res = 1;
        for (int i = 0; i < n; i ++) {
                if (a[i] % 2 == 0) {
                        res *= 2;
                }
        }
        printf("%d\n", ans - res);
        return 0;
}



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

#define vi vector<int>
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++) 
#define all(x) (x).begin(), (x).end()

using namespace std;

signed main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> data(n * 2);
    rep(i, n) {
        int l, r;
        cin >> l >> r;
        data[i*2] = {l, 1};
        data[i*2+1] = {r+1, -1};
    }
    sort(all(data));
    
    rep(i, data.size()) {
        //cout << data[i].first << " " << data[i].second << endl;
        if (i) {
            data[i].second += data[i-1].second;
        }
    }
    /*
    rep(i, data.size()) {
        cout << data[i].first << " " << data[i].second << endl;
    }
    */
    int mx = -1;
    rep(i, data.size()) {
        if (mx < data[i].second) mx = data[i].second;
    }

    if (mx % 2) {
        int ans = 0;
        for (int i = data.size()-1; i >= 0; i--) {
            if (data[ans].second < data[i].second) {
                ans = i;
            }
        }
        cout << (mx-1) * m + (data[ans+1].first-1) << endl;
    } else {
        int ans = data.size()-1;
        rep(i, data.size()) {
            if (data[ans].second < data[i].second) {
                ans = i;
            }
        }
        //cout << data[ans].first << " " << data[ans].second << endl;
        cout << (mx-1) * m + (m - data[ans].first) << endl;
    }


    return 0;
}



Measured memory_bytes: 9076
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

ll n,m;
vector<ll> adj[N];

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

    cin>>n>>m;
    for(ll i=0;i<m;++i){
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    int vis[n+1]={0};
    queue<ll> q;
    vector<ll> p(n+1,-1);
    q.push(1);
    vis[1]=1;
    while(!q.empty()){
        ll v=q.front();
        q.pop();
        for(auto u:adj[v]){
            if(vis[u]==0){
                vis[u]=1;
                q.push(u);
                p[u]=v;
            }
        }
    }
    int f=1;
    for(ll i=2;i<=n;++i){
        if(p[i]==-1){f=0;break;}
    }
    if(f){
        cout<<"Yes"<<endl;
        for(ll i=2;i<=n;++i){
            cout<<p[i]<<endl;
        }
    }
    else{
        cout<<"No";
    }

    return (0);
}


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

int main() {
  string N;
  cin >> N;
 
  int amari = 0;
  
  for(int i =0;i < N.size(); i++){
    amari += N.at(i)-3;
  }
  amari = amari % 9;
    
    
  if(amari % 9 == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  
}


Measured memory_bytes: 3744
#include <algorithm>
#include <iostream>

using namespace std;

int num_ops(int a, int b, int c, int x) {
  return (3 * x - (a + b + c)) / 2;
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  const int sum = a + b + c;
  const int m = max({a, b, c});
  int ans = num_ops(a, b, c, m);
  if ((3 * m) % 2 != sum % 2) {
    ans = num_ops(a, b, c, m + 1);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int K, X;
  	cin >> K >> X;
  	if(500*K>=X) cout << "Yes" <<endl;
  	else cout << "No" <<endl;
    
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
	#define debug(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(...) 42
#endif

#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

inline string getString(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string getLine(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
typedef long long ll;

const ll inf=1e18;
const int S=100100;
int main()
{
	int n,k;
	while(~sf("%d %d",&n,&k))
	{
		int P[n+5];
		for(int i=1;i<=n;i++)sf("%d",&P[i]);

		int C[n+5];
		for(int i=1;i<=n;i++)sf("%d",&C[i]);

		ll ans=-inf;
		for(int i=1;i<=n;i++)
		{
			ll siz,sum,mx;
			auto Cal = [&](int to) 
			{
				int cycleSize=0;
				ll cycleSum=0;
				ll curmx=-inf;
				int x=i;
				while(true)
				{
					cycleSum+=C[x];
					curmx=max(curmx,cycleSum);
					cycleSize++;
					x=P[x];
					if(cycleSize==to || x==i)break;
				}
				siz=cycleSize;
				sum=cycleSum;
				mx=curmx;
			};

			ll cur=-inf;
			Cal(k);
			if(siz>=k || sum<=0)
			{
				cur=mx;
			}
			else
			{
				ll full=k/siz;
				ll half=k%siz;
				
				ll sum1=(sum*(full-1))+mx;
				ll sum2=(sum*full);
				if(half>0)
				{
					Cal(half);
					if(mx>0)sum2+=mx;
				}
				cur=max(sum1,sum2);
			}
			ans=max(ans,cur);
		}
		pf("%lld\n",ans);
	}
    return 0;
}



































Measured memory_bytes: 3860
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int N;
    string S;
	cin >> N >> S;
    int count = 0;
	for (int i=0; i < N-2; i++) {
        if (S.substr(i, 3) == (string)"ABC") {
            count++;
        }
    }
	cout << count << "\n";
	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int h, w; cin >> h >> w;
    int d[10][10];
    // rep(i,10) rep(j,10) d[i][j] = INF;
    rep(i,10){
        rep(j,10){
            cin >> d[i][j];
        }
    }

    rep(k,10){
        rep(i,10){
            rep(j,10){
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }


    int ans = 0;
    rep(_,h) rep(_,w){
        int i; cin >> i;
        if(i != -1) ans += d[i][1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000+7
using namespace std;
typedef long long ll;

int main(){
  int N;  cin >> N;
  ll ans;
  ll T = 1, A = 1;
  rep(i, 0, N){
    ll t, a; cin >> t >> a;
    ll n = max((T+t-1)/t, (A+a-1)/a);
    T = n*t;
    A = n*a;
  }
  cout << T+A << endl;
  return 0;
}


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

typedef pair<ll,ll> pl;
const ll INF = 1e9;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) cin >> b[i];
    vector<vector<ll>> dp((1<<n)+1, vector<ll>(55, INF));
    dp[0][0] = 0;
    for(int bit = 0; bit < (1<<n); bit++) {
        ll con = 0;
        for(int i = 0; i < n; i++) if(bit & (1<<i)) con++;
        vector<pl> ords;
        int iter = con;
        for(int i = 0; i < n; i++) if(!(bit & (1<<i))) ords.emplace_back(i, iter++);
        for(int s = 0; s <= 50; s++){
            if(dp[bit][s] >= INF) continue;
            for(auto p : ords) {
                ll ns = -1;
                if(abs(p.first - con) % 2 == 0) ns = a[p.first];
                else ns = b[p.first];
                if(ns >= s) dp[bit | (1<<p.first)][ns] =  min(dp[bit | (1<<p.first)][ns], dp[bit][s] + abs(p.second - con));
            }
        }
    }
    ll ans = INF;
    for(int s = 0; s <= 50; s++) ans = min(ans, dp[(1<<n)-1][s]);
    cerr << ans << endl;
    if(ans < INF) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 124136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int M = 1e7;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

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

  rep(i,t.size()) if (t[i] == '?') t[i] = 'D';
  cout << t << endl;

  return 0;
}


Measured memory_bytes: 3724
#include <iostream>

int main()
{
	int h, w;
	for (;;) {
		std::cin >> h >> w;
		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) std::cout << '#';
				else if (j!=0 && j!=w-1) std::cout << '.';
				else std::cout << '#';
			}
			std::cout << '\n';
		}
		std::cout << '\n';
	}
}

Measured memory_bytes: 3072
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

fn calulate_unvisited_neighbors(now: usize, edges: &Vec<Vec<bool>>, visited: &Vec<usize>) -> Vec<usize> {
    let mut neighbors: Vec<usize> = Vec::new();
    for (neighbor, &edge) in edges[now].iter().enumerate() {
        if edge && !visited.contains(&neighbor) {
            neighbors.push(neighbor);
        }
    }
    neighbors
}

fn traversal(now: usize, edges: &Vec<Vec<bool>>, visited: &Vec<usize>) -> i64 {
    let mut visited = visited.clone();
    visited.push(now);
    let neighbors = calulate_unvisited_neighbors(now, edges, &visited);
    let mut counter = 0;
    if neighbors.is_empty() {
        if visited.len() == edges.len() - 1 {
            return 1
        } else {
            return 0
        }
    }
    for &neighbor in neighbors.iter() {
        let now = neighbor;
        counter += traversal(now, edges, &visited);
    }
    counter
}

fn main() {
    let (n, m) = input!(usize, usize);
    let mut edges = vec![vec![false; n+1]; n+1];
    for _ in 0..m {
        let (a, b) = input!(usize, usize);
        edges[a][b] = true;
        edges[b][a] = true;
    }
    println!("{:?}", traversal(1, &edges, &vec![]));
}


Measured memory_bytes: 4352
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			int ans = 0;
			for (int i = 1; i <= n; i++) {
				if (i % 2 == 0) {
					continue;
				}
 
				int cnt = 0;
				for (int j = 1; j <= i; j++) {
					if (i % j == 0) {
						++cnt;
					}
				}
 
				if (cnt == 8) {
					++ans;
				}
			}
 
			Console.WriteLine(ans);
		}
	}
 
	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;
 
		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}
 
		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}
 
			string st = reader_();
			while (st == "") {
				st = reader_();
			}
 
			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}
 
			index_ = 0;
			return buf_[index_++];
		}
 
		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());
 
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}
 
		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}
 
		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
 
		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}
 
			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 11092
package main

import "fmt"

func main() {
	var (
		n, q int
		s    string
	)
	fmt.Scan(&n, &q, &s)
	xs := make([]int, n)
	var sum int
	for i := range s[:len(xs)-1] {
		if s[i] == 'A' && s[i+1] == 'C' {
			sum++
		}
		xs[i+1] = sum
	}

	var l, r int
	for i := 0; i < q; i++ {
		fmt.Scan(&l, &r)
		fmt.Println(xs[r-1] - xs[l-1])
	}
}


Measured memory_bytes: 6144