akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	VVL dp1(n + 1, VL(4, 0));
	VVL dp2(n + 1, VL(4, 0));
	VVL dp3(n + 1, VL(4, 0));
	VVL dp4(n + 1, VL(4, 0));
	VVL dp5(n + 1, VL(4, 0));
	VVL dp6(n + 1, VL(4, 0));
	dp1[0][0] = 1;
	dp2[0][0] = 1;
	dp3[0][0] = 1;
	dp4[0][0] = 1;
	dp5[0][0] = 1;
	dp6[0][0] = 1;
	rep(i, n) {
		rep(j, 4) {
			dp1[i + 1][j] += dp1[i][j];
		}
		if (s[i] == 'R') dp1[i + 1][1] += dp1[i][0];
		if (s[i] == 'G') dp1[i + 1][2] += dp1[i][1];
		if (s[i] == 'B') dp1[i + 1][3] += dp1[i][2];
	}
	rep(i, n) {
		rep(j, 4) {
			dp2[i + 1][j] += dp2[i][j];
		}
		if (s[i] == 'R') dp2[i + 1][1] += dp2[i][0];
		if (s[i] == 'B') dp2[i + 1][2] += dp2[i][1];
		if (s[i] == 'G') dp2[i + 1][3] += dp2[i][2];
	}
	rep(i, n) {
		rep(j, 4) {
			dp3[i + 1][j] += dp3[i][j];
		}
		if (s[i] == 'G') dp3[i + 1][1] += dp3[i][0];
		if (s[i] == 'R') dp3[i + 1][2] += dp3[i][1];
		if (s[i] == 'B') dp3[i + 1][3] += dp3[i][2];
	}
	rep(i, n) {
		rep(j, 4) {
			dp4[i + 1][j] += dp4[i][j];
		}
		if (s[i] == 'G') dp4[i + 1][1] += dp4[i][0];
		if (s[i] == 'B') dp4[i + 1][2] += dp4[i][1];
		if (s[i] == 'R') dp4[i + 1][3] += dp4[i][2];
	}
	rep(i, n) {
		rep(j, 4) {
			dp5[i + 1][j] += dp5[i][j];
		}
		if (s[i] == 'B') dp5[i + 1][1] += dp5[i][0];
		if (s[i] == 'R') dp5[i + 1][2] += dp5[i][1];
		if (s[i] == 'G') dp5[i + 1][3] += dp5[i][2];
	}
	rep(i, n) {
		rep(j, 4) {
			dp6[i + 1][j] += dp6[i][j];
		}
		if (s[i] == 'B') dp6[i + 1][1] += dp6[i][0];
		if (s[i] == 'G') dp6[i + 1][2] += dp6[i][1];
		if (s[i] == 'R') dp6[i + 1][3] += dp6[i][2];
	}
	ll ans = 0;
	ans += dp1[n][3];
	ans += dp2[n][3];
	ans += dp3[n][3];
	ans += dp4[n][3];
	ans += dp5[n][3];
	ans += dp6[n][3];
	rep(i, n) rep1(j, (n / 2) + 1) {
		if (i + j + j >= n) continue;
		if (s[i] != s[i + j] && s[i + j] != s[i + j + j] && s[i] != s[i + j + j]) ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5332
s = list(map(int, input().split("/")))
if s[0] < 2019:
    print("Heisei")
elif s[0] == 2019 and s[1] < 4:
    print("Heisei")
elif s[0] == 2019 and s[1] == 4 and s[2] <= 30:
    print("Heisei")
else:
    print("TBD")

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL s;cin >> s;
    set<LL> st;
    inc(i, 1, 10000000){
        if(st.find(s) != st.end()){
            cout << i << endl;
            break;
        }
        st.insert(s);
        s = s%2 == 0 ? s/2 : 3*s+1;
    }
    return 0;
}


Measured memory_bytes: 256
(function (input) {
    var inputs = input.replace(/\r/g, '').split("\n"), n, spare, count;
    while(true) {
        count = 0;
        n = parseInt(inputs.shift());
        if(n === 0) {
            break;
        }
        spare = 1000 - n;
        while(spare != 0) {
            if(spare % 500 == 0) {
                spare -= 500;
            } else if(spare % 100 == 0) {
                spare -= 100;
            } else if(spare % 50 == 0) {
                spare -= 50;
            } else if(spare % 10 == 0) {
                spare -= 10;
            } else if(spare % 5 == 0) {
                spare -= 5;
            } else if(spare % 1 == 0) {
                spare -= 1;
            }
            count++;
        }
        console.log(count);
    }
})(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7648
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

// head

int main(){

  ll n = in();
  ll m = in();
  in();
  vector<string> s(n);
  REP(i, n){
    s[i] = stin();
  }
  vector<vector<ll>> ans(n, vector<ll>(m));
  ll cnt = 0;
  using pl = pair<ll, ll>;
  vector<pl> cur(0);
  REP(j, m){
    vector<pl> p(0);
    REP(i, n){
      if(s[i][j] == '#'){
        p.pb(i, cnt++);
      }
    }
    if(!p.empty()){
      if(cur.empty()){
        cur = p;
        REP(l, j){
          REP(k, n){
            ll ind = 0;
            REP(k, n){
              if(ind < SZ(cur) && cur[ind].first == k){
                ind++;
              }
              ll rind = max(0LL, ind - 1);
              ans[k][l] = cur[rind].second;
            }
          }
        }
      }
      cur = p;
    }
    if(!cur.empty()){
      ll ind = 0;
      REP(k, n){
        if(ind < SZ(cur) && cur[ind].first == k){
          ind++;
        }
        ll rind = max(0LL, ind - 1);
        ans[k][j] = cur[rind].second;
      }
    }
  }

  REP(i, n){
    REP(j, m){
      if(j != 0){
        printf(" ");
      }
      printf("%lld", ans[i][j] + 1);
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner
import kotlin.math.min

fun main() {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val m = scn.nextInt()
	val x = scn.nextInt()
	val b = Array(n){ Pair(scn.nextInt(), IntArray(m){scn.nextInt()}) }
	var minC = Integer.MAX_VALUE
	for (bit in 1 until (1 shl n)) {
		var cost = 0
		val sumA = IntArray(m)
		for (i in 0 until n){
			val buy = (bit and (1 shl i)) shr i
			if (buy==1){
				cost += b[i].first
				for (j in 0 until m){
					sumA[j] += b[i].second[j]
				}
			}
		}
		if (sumA.all{it>=x}) minC = min(minC, cost)
	}
	println(if (minC==Integer.MAX_VALUE) -1 else minC)
}

Measured memory_bytes: 38696
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    for(int i=0;i<n-k;i++){
        sum+=a[i];
    }
    cout << sum<<endl;
    return 0;
}


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

typedef long long unsigned ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

//map<int,int> mmap;


int main(){

    //freopen("test.in","r",stdin);

    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c >=22) cout<<"bust\n";
    else cout<<"win\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)


int main(){
    vector<vector<int>>A(3,vector<int>(3));
    vector<vector<bool>>fla(3,vector<bool>(3));

    for(int i = 0;i < 3;i++)
        for(int j = 0;j < 3;j++)
            fla.at(i).at(j) = false;

    for(int i = 0;i < 3;i++)
        for(int j = 0;j < 3;j++)
            cin >> A.at(i).at(j);

    int N;
    cin >> N;
    vector<int>b(N);

    for(int i = 0;i < N;i++)
        cin >> b.at(i);

    for(int i = 0;i < N;i++){
        for(int j = 0;j < 3;j++)
            for(int k = 0;k < 3;k++){
                if(b.at(i) == A.at(j).at(k)){
                    fla.at(j).at(k) = true;
                    break;
                }
            }
    }

    if(fla.at(0).at(0)==true and fla.at(0).at(1)== true and fla.at(0).at(2)==true)
        cout << "Yes" << endl;
    else if(fla.at(1).at(0)==true and fla.at(1).at(1)== true and fla.at(1).at(2)==true)
        cout << "Yes" << endl;
    else if(fla.at(2).at(0)==true and fla.at(2).at(1)== true and fla.at(2).at(2)==true)
        cout << "Yes" << endl;
    else if(fla.at(0).at(0)==true and fla.at(1).at(0)== true and fla.at(2).at(0)==true)
        cout << "Yes" << endl;
    else if(fla.at(0).at(1)==true and fla.at(1).at(1)== true and fla.at(2).at(1)==true)
        cout << "Yes" << endl;
    else if(fla.at(0).at(2)==true and fla.at(1).at(2)== true and fla.at(2).at(2)==true)
        cout << "Yes" << endl;
    else if(fla.at(0).at(0)==true and fla.at(1).at(1)== true and fla.at(2).at(2)==true)
        cout << "Yes" << endl;
    else if(fla.at(0).at(2)==true and fla.at(1).at(1)== true and fla.at(2).at(0)==true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3580
n,k = map(int, input().split())
a = [int(x)-1 for x in input().split()]

visited = [False]*n

p = 0
visited[0] = True

cnt = 0
while True:
    if visited[a[p]]:
        rp = a[p]
        cnt += 1
        break
    else:
        visited[a[p]] = True
        p = a[p]
        cnt += 1
    if cnt == k:
        print(p+1)
        exit()

rpcnt = 0
visited = [False]*n
p = rp
visited[p] = True
v = [p]
while True:
    if visited[a[p]]:
        rpcnt += 1
        break
    else:
        visited[a[p]] = True
        v.append(a[p])
        p = a[p]
        rpcnt += 1

first = cnt-rpcnt

print(v[(k-first)%rpcnt]+1)

Measured memory_bytes: 95848
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod=1000000007;
int ncr(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
    for (int i = 1; i <= n; i++) 
    { 
        for (int j = min(i, r); j > 0; j--) 
  
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
}
int main() {
    // your code goes here
    
    int n,k,q;
    cin>>n>>k>>q;
    int arr[n+1];
    for(int i=1;i<=n;i++)arr[i]=k-q;
    while(q--)
    {
        int a;
        cin>>a;
        arr[a]++;
    }
    for(int i=1;i<=n;i++)
    {

        if(arr[i]<=0)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
from collections import deque
N,M=map(int,input().split())
table=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    table[a].append(b)
    table[b].append(a)
H=deque()
H.append(0)
S=set()
S.add(0)
flag=True
while flag:
    flag=False
    x=H[-1]
    for a in table[x]:
        if a not in S:
            flag=True
            S.add(a)
            H.append(a)
            break
flag=True
while flag:
    flag=False
    x=H[0]
    for a in table[x]:
        if a not in S:
            flag=True
            S.add(a)
            H.appendleft(a)
            break
print(len(H))
print(' '.join(map(str,[h+1 for h in H])))



Measured memory_bytes: 78768
#include <stdio.h>
//#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  char s[55], t[55];
  scanf("%s%s", s, t);
  int n = strlen(s), m = strlen(t);
  for (int i=n-m; i>=0; i--) {
    bool check = true;
    for (int j=0; j<m; j++) {
      if (s[i+j] == '?' || s[i+j] == t[j])
        continue;
      else {
        check = false;
        break;
      }
    }
    if (check) {
      for (int j=0; j<m; j++)
        s[i+j] = t[j];
      for (int j=0; j<n; j++)
        if (s[j] == '?')
          s[j] = 'a';
      printf("%s\n", s);
      return 0;
    }
  }
  printf("UNRESTORABLE\n");
  return 0;
}


Measured memory_bytes: 128
cc=list(map(int, input().split()))

NumDig = len(str(cc[0]))

# if odd, print 1. if even print 0
counter = 0

if (NumDig % 2 == 0):
  for idx in range(1, NumDig, 2):
    if idx == 1:
      counter = counter + 10**(idx)-1
    else:
      counter = counter + 10**(idx) - 10**(idx-1)
  #counter = counter + cc[0] - 10**(NumDig-1) + 1
      
if (NumDig % 2 != 0 ):
  for idx in range(1, NumDig, 2):
    if idx == 1:
      counter = counter + 10**(idx)-1
    else:
      counter = counter + 10**(idx)- 10**(idx-1)  
  counter = counter + cc[0] - 10**(NumDig-1) + 1
  
print(counter)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

class FF
{
public:
  struct edge{int to,cap,rev;};
  vector<vector<edge>>G;
  vector<bool> used;
  FF(int maxv)
  {
    G.resize(maxv);
    used.resize(maxv);
  }
  void add_edge(int from,int to,int cap,bool directed=1)
  {
    G[from].push_back({to,cap,(int)G[to].size()});
    G[to].push_back({from,cap*(!directed),(int)G[from].size()-1});
  }
  int dfs(int v,int t,int f)
  {
    if(v==t)return f;
    used[v]=1;
    for(auto &nv:G[v])
    {
      if(!used[nv.to] && nv.cap>0)
      {
        int d=dfs(nv.to,t,min(f,nv.cap));
        if(d>0)
        {
          nv.cap-=d;
          G[nv.to][nv.rev].cap+=d;
          return d;
        }
      }
    }
    return 0;
  }
  int solve(int s,int t)
  {
    int res=0;
    while(1)
    {
      for(int i=0;i<used.size();i++)used[i]=0;
      int f=dfs(s,t,(1<<30)-1);
      if(f==0)break;
      res+=f;
    }
    return res;
  }
};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<pair<int,int>>re(n),bl(n);
  rep(i,n)
  {
    int a,b;
    cin>>a>>b;
    re[i]={a,b};

  }
  rep(i,n)
  {
    int a,b;
    cin>>a>>b;
    bl[i]={a,b};
  }
  FF ff(2*n+2);
  int s=0,t=2*n+1;
  auto check=[](pair<int,int> a,pair<int,int> b){return (a.first<b.first&&a.second<b.second); };
  rep(i,n)
  {
    rep(j,n)
    {
      if(check(re[i],bl[j]))
      {
        ff.add_edge(i+1,j+n+1,1);
      }
    }
  }
  rep(i,n)
  {
    ff.add_edge(s,i+1, 1);
    ff.add_edge(i+n+1,t,1);
  }
  cout<<ff.solve(s,t)<<endl;
  return 0;

}


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

/*
1≤N≤2×105
0≤K≤2×105
1≤Hi≤109
All values in input are integers.
Input
Input is given from Standard Input in the following format:

N K
H1 … HN

*/
unsigned long Fennec_fight(vector<int>& monsters, int& K)
{
   if(monsters.size()<=K) return 0;
   sort(monsters.begin(),monsters.end(),[](int& A, int& B){ return A>B;});
   unsigned long strikes=0;
   for(int i=K; i<monsters.size();i++) 
   {
   		strikes+=monsters[i];
   }
   return strikes;
   
}

int main()
{
   int K, N,m;
   vector<int> monsters(N);
   cin>> N >> K;
   for(int i=0; i<N;i++) 
   {
   	cin>>m;
   	monsters.push_back(m);
   }
   
  cout<< (unsigned long)Fennec_fight(monsters,K)<<endl;
  return 0;

}


Measured memory_bytes: 34944
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = list(input())
cnt = 0
for i in range(k):
    if t[i] == 'r':
        cnt += p
    elif t[i] == 's':
        cnt += r
    else:
        cnt += s
 
for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            cnt += p
        elif t[i] == 's':
            cnt += r
        else:
            cnt += s
    else:
        t[i] = ''
 
print(cnt)

Measured memory_bytes: 4084
def d_756(N):
    def exponential_list(n):
        # ret[k]: nを素因数分解したときのkの指数
        ret = [0] * (n + 1)
        for j in range(2, n + 1):
            current = j
            for k in range(2, j + 1):
                while current % k == 0:
                    ret[k] += 1
                    current //= k
        return ret

    def num(m):
        # Nを素因数分解したときの指数のリスト(e)について、
        # 要素の値がm-1より大きなものの個数
        return len(list(filter(lambda x: x >= m - 1, e)))

    e = exponential_list(N)
    # 素因数のうち、指数が74以上の数を1つ選ぶ。約数の個数の性質より、
    # その数の約数の個数は75以上であるから、約数の個数がちょうど75の数が得られる
    ans = num(75)
    # 指数が24以上の数と3以上の数を1つずつ選ぶと、約数の個数の性質より、
    # それらの数の積における約数の個数は75以上である
    # -1しているのは、指数が2以上の素因数のうち1つを指数が24以上の素因数として
    # (それが存在するならば)選んでいるから
    ans += num(25) * (num(3) - 1)
    ans += num(15) * (num(5) - 1)  # 同上
    # 指数が4以上の素因数を重複して数えている(p^4q^4=q^4p^4)ため、2で割る
    ans += num(5) * (num(5) - 1) * (num(3) - 2) // 2
    return ans

N = int(input())
print(d_756(N))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define Rep(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define Repr(i, b, e) for(int (i) = (b) - 1; (i) >= (e); --(i))
#define Print(x) cout << (x) << endl 
#define Min2(a, b) ((a) < (b)) ? (a) : (b)
#define Max2(a, b) ((a) > (b)) ? (a) : (b)

typedef long long ll;

using namespace std;

int main(){
    int N, sum = 0;
    int V[20], C[20];
    cin >> N;
    Rep(i, 0, N) cin >> V[i];
    Rep(i, 0, N) cin >> C[i];
    Rep(i, 0, N) sum += Max2(V[i] - C[i], 0);
    Print(sum);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        int count = 0;
        for(int i = 0; i < S.length(); i++) {
            if(S.charAt(i) == '1') {
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 22356
while True:
    try:
        n = int(input())
        nums = list(range(n + 1))
        nums[1] = 0
        for i in range(n):
            if nums[i] > n ** 0.5:
                break
            if nums[i] == 0:
                continue
            for j in range(nums[i] * 2, n + 1, nums[i]):
                nums[j] = 0
        print(n + 1 - nums.count(0))
    except:
        break

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const ll MS = 2;
const ll mods[] = {999999937ll, 1000000007ll}, base = 9973;
struct rolling_hash {
    int n;
    vector<ll> hs[MS], pw[MS];
    rolling_hash(){}
    rolling_hash(const vector<ll> &s) {
        n = s.size();
        for (int i = 0; i < MS; i++) {
            hs[i].assign(n+1,0);
            pw[i].assign(n+1,0);
            hs[i][0] = 0;
            pw[i][0] = 1;
            for (int j = 0; j < n; j++) {
                pw[i][j+1] = pw[i][j]*base%mods[i];
                hs[i][j+1] = (hs[i][j]*base+s[j])%mods[i];
            }
        }
    }

    // hash number of segment [l, r)
    ll hash(int l, int r, int i) { return ((hs[i][r]-hs[i][l]*pw[i][r-l])%mods[i]+mods[i])%mods[i]; }

    bool match(int l1, int r1, int l2, int r2) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l1,r1,i)==hash(l2,r2,i);
        return ret;
    }

    bool match(int l, int r, ll h[]) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l,r,i)==h[i];
        return ret;
    }
};

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

    ll N;
    cin >> N;
    vector<ll> a(N), b(N);
    REP(i, N) cin >> a[i];
    REP(i, N) cin >> b[i];

    vector<ll> c(N), d(N);
    REP(i, N) c[i] = (a[i]^a[(i+1)%N]);
    REP(i, N) d[i] = (b[i]^b[(i+1)%N]);

    //cout << c << endl;
    //cout << d << endl;

    rolling_hash rc(c), rd(d);
    vector<pll> res;
    REP(i, N){
        bool ok = true;
        REP(j, 2){
            if(rc.hash(i, N, j) != rd.hash(0, N-i, j) || rc.hash(0, i, j) != rd.hash(N-i, N, j)) ok =false;
        }
        if(ok){
            //cout << N-i << " " << (a[N-i]^b[0]) << endl;
            res.push_back({i, a[i]^b[0]});
        }
    }
    sort(res.begin(), res.end());
    REP(i, res.size()){
        cout << res[i].first << " " << res[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 26348
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ppi pair<int, pii>
#define vpi vector<pii>
#define vpl vector<pll>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;

struct cmp{
    bool operator() (pii a, pii b){
        if(a.F == b.F) return a.S < b.S;
        return a.F > b.F;
    }
};

ll power(ll x, ll p){
    ll r = 1ll;
    x = x % mod;
    while(p > 0){
        if(p & 1) r = (r * x) % mod;
        p = p >> 1;
        x = (x * x) % mod;
    }
    return r;
}

void solve(){
    int n;
    cin >> n;
    vi a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                if(a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) continue;
                if(a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]){
                    ans++;
                }
            }
        }
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3660
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }

int main() {

	long res = 0;
	long N, K; cin >> N >> K;

	string s; cin >> s;

	long slen = s.length();

	for (int i = 0; i < slen - 1; i++) if (s[i] == 'R') if (s[i + 1] == 'R') res++;
	for (int i = 1; i < slen; i++) if (s[i] == 'L') if (s[i - 1] == 'L') res++;

	cout << min(N - 1,res + K * 2) << endl;
}

Measured memory_bytes: 512
#include <stdio.h>


int main()
{
	long long  r, D, x;
	int i;
	scanf("%lld %lld %lld", &r, &D, &x);
	for (i = 0; i < 10; i++) {
		x = r * x - D;
		printf("%lld\n", x);
	}
    return 0;
}

Measured memory_bytes: 128
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, d = Is()

print(ceil(n/(2*d+1)))

Measured memory_bytes: 38384
# bit全探索

n = int(input())
eigyou = [list(map(int, input().split())) for _ in range(n)]
profits = [list(map(int, input().split())) for _ in range(n)]
# 全休業を除く = 0を除外して、1〜1023まで回す
# 10 = 0000001010 ならば、木曜午前と金曜午前に営業することを示す

ans = -(10 ** 7) * 100 - 10
for i in range(1, 2**10):
    eigyou_here = [-1] * 10
    temp = 0
    for digit in range(10):
        eigyou_here[10 - 1 - digit] = int(i & (2 ** digit) > 0)
    for j_shop in range(n):
        coincide_time = 0
        for time in range(10):
            coincide_time += eigyou[j_shop][time] * eigyou_here[time]
        temp += profits[j_shop][coincide_time]

    ans = max(ans, temp)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
    int n,a,b; cin >> n >> a >> b;
    for(int i = a ; i <= b; i  ++)
    {
        if(i % n == 0)
        {
            puts("OK");
            return 0;
        }
    }
    puts("NG");
    return 0;
}

Measured memory_bytes: 3604
class SegmentTree():
    """
    update, get を提供するSegmentTree

    Attributes
    ----------
    __n : int
        葉の数。2 ^ i - 1
    __dot :
        Segment function
    __e: int
        単位元
    __node: list
        Segment Tree
    """
    def __init__(self, A, dot, e):
        """
        Parameters
        ----------
        A : list
            対象の配列
        dot :
            Segment function
        e : int
            単位元
        """
        # n = 2 ** (len(A) - 1).bit_length()
        n = A
        self.__n = n
        self.__dot = dot
        self.__e = e
        self.__node = [e] * (2 * n)
        # for i in range(len(A)):
        #     self.__node[i + n] = A[i]
        # for i in range(n - 1, 0, -1):
        #     self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])
    
    def update(self, i, c):
        i += self.__n
        node = self.__node
        node[i] = c
        while i > 1:
            i //= 2
            node[i] = self.__dot(node[2 * i], node[2 * i + 1])

    def get(self, l, r):
        vl, vr = self.__e, self.__e
        l += self.__n
        r += self.__n
        while (l < r):
            if l & 1:
                vl = self.__dot(vl, self.__node[l])
                l += 1
            l //= 2
            if r & 1:
                r -= 1
                vr = self.__dot(vr, self.__node[r])
            r //= 2
        return self.__dot(vl, vr)


def solve():
    N = int(input())
    P = map(int, input().split())
    plist = []
    for i, p in enumerate(P):
        plist.append((p, i))
    plist.sort(reverse=True)

    maxSeg = SegmentTree(N, max, -1)
    minSeg = SegmentTree(N, min, N)

    cnt = 0
    for p, c in plist:
        l2 = maxSeg.get(0, c)
        l1 = -1 if l2 <= 0 else maxSeg.get(0, l2)

        r1 = minSeg.get(c + 1, N)
        r2 = N if r1 >= N - 1 else minSeg.get(r1 + 1, N)

        a = (l2 - l1) * (r1 - c)
        b = (r2 - r1) * (c - l2)
        cnt += p * (a + b)

        maxSeg.update(c, c)
        minSeg.update(c, c)

    print(cnt)


solve()


Measured memory_bytes: 123304
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict

N = int(input())

def prime_factorize(n):
  ret = []
  for i in range(2, int(n ** (1 / 2)) + 1):
    if i > n:break
    while n % i == 0:
      n //= i
      ret.append(i)
  if n != 1:
    ret.append(n)
  return ret

def solv_quadratic_equation(a, b, c):
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

dic = defaultdict(int)
lis = prime_factorize(N)
for num in lis:
    dic[num] += 1

ans = 0

for v in dic.values():
    a,b = solv_quadratic_equation(1, 1, -2*v)
    ans += int(max(a, b))
print(ans) 

Measured memory_bytes: 66544
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f), TMPend = (n); (i) < TMPend; (i)++)
#define RFOR(i, f, n) for(int (i) = (f), TMPend = (n); (i) >= TMPend; (i)--)
#define REP(i, n) for(int (i) = 0, TMPend = (n); (i) < TMPend; (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0, TMPend = (n); (i) < TMPend; (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int main(){
  int input(h);
  int input(a);
  out((h + a - 1) / a);
}


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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<pair<int, int>> pq;
    for (int i = 0; i < N; i++) {
        int takes, value;
        cin >> takes >> value;
        pq.push({-takes, value});
    }

    int64_t result = 0;
    priority_queue<int> values;
    for (int rest = 0; rest <= M; rest++) {
        while (!pq.empty()) {
            int takes = -pq.top().first;
            if (takes > rest) break;
            values.push(pq.top().second);
            pq.pop();
        }

        if (!values.empty()) {
            result += values.top();
            values.pop();
        }
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1908
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N;
	cin >> N;
	ll a[N + 10];
	for (ll i = 0; i < N; i++) {
		cin >> a[i];
	}
	ll cnt0_mod4 = 0;
	ll cnt0_mod2 = 0;
	ll cnt2_mod4 = 0;
	for (ll i = 0; i < N; i++) {
		if (a[i] % 4 == 0)
			cnt0_mod4++;
		if (a[i] % 2 == 0)
			cnt0_mod2++;
		if (a[i] % 4 == 2)
			cnt2_mod4++;
	}
	 if (cnt0_mod4 + (cnt2_mod4) / 2 >= N / 2)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}








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

int main(){
  int N, M;
  cin >>N>>M;
  vector<int> A(M);
  for (int i=0;i<M;i++)cin >> A[i];
  A.push_back(N+1);
  
  vector<long long> memo(N+2);
  int i = 0;
  while (i<=N+1){
    if(i==0) memo[0] = 0;
    if(i==1) memo[1] = 1;
    if(i>1){
      memo[i] = memo[i-1] + memo[i-2];
      memo[i] %= 1000000007;
    }
    i++;
  }
  
  long long ans = 1;
  
  int dist = A[0];
  //cout << dist << memo[dist] << endl; //test
  ans *= memo[dist];
  ans %= 1000000007;
  
  for (int i=0;i<M;i++){
    dist = A[i+1] - A[i] - 1;
    //cout << memo[dist] << endl; //test
    ans *= memo[dist];
    ans %= 1000000007;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1400
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printde(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, r;
    cin >> n >> m >> r;
    vector<int> ord(r);
    for(int i = 0; i < r; i++){
        cin >> ord[i];
        ord[i]--;
    }
    vector<vector<int>> dp(n, vector<int> (n, M));
    for(int i = 0; i < m; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        dp[a][b] = c;
        dp[b][a] = c;
    }
    for(int i = 0; i < n; i++){
        dp[i][i] = 0;
    }
    prints(dp);
    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }
    prints(dp);
    vector<int> idxs(r);
    iota(idxs.begin(), idxs.end(), 0);
    ll ans = MLL;
    do{
        ll cand = 0;
        for(int i = 0; i < r - 1; i++){
            cand += dp[ord[idxs[i]]][ord[idxs[i + 1]]];
        }
        ans = min(ans, cand);
    }while(next_permutation(idxs.begin(), idxs.end()));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    ll res = a[0];
    rep(i, n) {
        res = gcd(res, a[i]);
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int MAXN=10010;
int N,F[MAXN];
void Solve()
{
	int Ans=0;
	for (int i=1;i<=100;++i)
	{
		for (int j=1;j<=100;++j)
		{
			for (int k=1;k<=100;++k)
			{
				int v=i*i+j*j+k*k+i*j+i*k+j*k;
				if (v<MAXN)
				{
					F[v]++;
				}
			}
		}
	}
}
int main()
{
	Solve();
	cin>>N;
	for (int i=1;i<=N;++i) printf("%d\n",F[i]);
	return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const LL LINF = 1LL << 60;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ LL to, cost; edge(int t, LL c) :to(t), cost(c){} };

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

int main()
{
	int n;
	while (cin >> n && n)
	{
		vector<P> arr;
		int fn; cin >> fn;
		arr.emplace_back(fn, 1);
		rep(i, n - 1)
		{
			int x; cin >> x;
			if (i % 2 == 1)
			{
				if (arr[arr.size() - 1].first == x) arr[arr.size() - 1].second++;
				else arr.emplace_back(x, 1);
			}
			else
			{
				if (arr[arr.size() - 1].first == x) arr[arr.size() - 1].second++;
				else
				{
					if (arr.size() == 1) arr[0] = P(x, arr[0].second + 1);
					else
					{
						arr[arr.size() - 2].second += arr[arr.size() - 1].second + 1;
						arr.pop_back();
					}
				}
			}
		}
		int ans = 0;
		for (auto x : arr) if (x.first == 0) ans += x.second;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mm 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int binaryExponentiation(int x, int n) //function to calculate x raise to power n
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x;
		x = x * x;
		n = n / 2;
	}
	return result;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-______________________________________________________________________________


	int n;
	cin >> n;
	map<string, int>m;
	int cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		/* code */
		string s;
		cin >> s;
		if (m[s] == 0)
		{
			m[s]++;
			cnt++;
		}
	}
	cout << cnt << en;
	return 0;
}


Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int n, m, k;
    cin >> n >> m >> k;
    int a[n];
    ll dp[m+1];
    for (int& e : a) cin >> e;
    dp[0] = 0;
    for (int i=0; i<m; i++) {
        int x;
        cin >> x;
        dp[i+1] = dp[i] + x;
    }

    int p2=m;

    while (dp[p2] > k) {
        p2--;
    }
    int mx = p2;
    ll duh = 0;
    for (int i=0; i<n; i++) {
        duh += a[i];
        if (duh > k) break;
        while (dp[p2]+duh > k) {
            p2--;
        }
        mx = max(mx, p2+i+1);
    }
    cout << mx << "\n";
}


Measured memory_bytes: 5988
#include <stdio.h>
using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    int A[n];
    for(int i=0;i<=n;i++)scanf("%d",&A[i]);
    for(int i=n-1;i>0;i--)printf("%d ",A[i]);
    printf("%d\n",A[0]);
}


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

#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 VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}


using namespace std;

int prime[100010];
int cnt[100010];


int main() {
	prime[0] = prime[1] = 1;
	FOR(i,2,100005) {
		if (prime[i] == 0) {
			for (int j = 2*i; j<1e5+5;j+=i) prime[j] = 1;
		}
	}
	cnt[0] = 0;
	FOR(i,1,100004) {
		cnt[i] = cnt[i-1];
		if (prime[i] == 0 && prime[(i+1)/2] == 0) cnt[i]++;
	}
	make(q);
	FOR(i,0,q) {
		make2(a, b);
		printf("%d\n", cnt[b] - cnt[a-1]);
	}
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

typedef long long int lli;

int main(void)
{
  char s[100001], t[100001];
  int al[26][100001] = {0};

  scanf("%s", s);
  scanf("%s", t);

  int s_len = strlen(s);
  int t_len = strlen(t);

  int si, ti, ch;
  for (si = 0; si < s_len; si++)
  {
    ch = (int)(s[si] - 'a');
    for (ti = si; ti >= 0 && al[ch][ti] == 0; ti--)
      al[ch][ti] = si + 1;
  }

  for (ch = 0; ch < 26; ch++)
  {
    for (si = s_len - 1; si >= 0 && al[ch][si] == 0; si--)
      al[ch][si] = al[ch][0];
  }

  // for (ch = 0; ch < 26; ch++)
  // {
  //   for (si = 0; si < s_len; si++)
  //     printf("%d ", al[ch][si]);
  //   printf("\n");
  // }
  
  lli ans = 0;
  int next;
  for (ti = 0; ti < t_len; ti++)
  {
    // printf("%c", t[ti]);
    ch = (int)(t[ti] - 'a');
    next = ans % s_len;
    si = al[ch][next];
    if (si == 0)
    {
      ans = -1;
      break;
    }
    else
    {
      if (si > next)
        ans += si - next;
      else
        ans += s_len + si - next;
    }
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 10496
#include <iostream>

using namespace std;

int main() {
    
    size_t N, M;
    cin >> N >> M;
    size_t a = 0;
    for (size_t i = 0; i < M; ++i) {
        size_t x;
        cin >> x;
        a += x;
    }
    if (a > N) {
        cout << "-1";
    }
    else {
        cout << N - a;
    }

    return 0;
}

Measured memory_bytes: 3600
def main():
  ## IMPORT MODULE
  #import sys

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    S = "chokudai"
    T = "chokudaiz"

  else:
    ##INPUT 
    #n = input()
    #a, b = map(int, input().split())
    S = input()
    T = input()

  ## SUBMITION CODES HERE
  for i in range(len(S)):
    if S[i] != T[i]:
        print("No")
        exit()
        
  print("Yes")
    
main()

Measured memory_bytes: 9000
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, h, m = map(int, input().split())

degreeA = h * 30 + m/2
degreeB = m * 6
degree = abs(degreeA - degreeB) % 360

radian = (degree * (math.pi / 180))
ans = a ** 2 + b ** 2 - 2 * a * b * math.cos(radian)
print(math.sqrt(ans))



Measured memory_bytes: 9720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1001001001001001;

ll dp[20202][300];

int main() {
    int n, m;
    while (cin >> n >> m && !(n == 0 && m == 0)) {
        int c[m], x[n];
        for (int i = 0; i < m; i++) cin >> c[i];
        for (int i = 0; i < n; i++) cin >> x[i];
        for (int i = 0; i < 20202; i++) {
            for (int j = 0; j < 300; j++) {
                dp[i][j] = INF;
            }
        }
        dp[0][128] = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < 300; k++) {
                    if (dp[i][k] == INF) continue;
                    ll idx = min(255, max(0, c[j] + k));
                    dp[i + 1][idx] =  min(dp[i + 1][idx], dp[i][k] + (x[i] - idx) * (x[i] - idx));
                }
            }
        }
        ll ans = INF;
        for (int k = 0; k < 300; k++) {
            ans = min(ans, dp[n][k]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 50452
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}



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

	string S=in<string>();
	map<char,ll> M;
	for(auto& x:S) M[x]++;
	ll N=S.size();
	ll A=N*(N-1LL)/2LL;
	for(auto& x:M){
		A -= x.second*(x.second-1LL)/2LL;
	}
	out(A+1LL);
	return 0;
}


Measured memory_bytes: 720