akhauriyash/Code-Regression huggingface dataset:
class PriorityQueue
  def initialize
    @h = [] # min-heap
  end

  def enq v
    @h << v
    up_heap
  end
  alias :push :enq

  def deq
    min, last = @h[0], @h.pop
    unless @h.empty?
      @h[0] = last
      dn_heap
    end
    return min
  end
  alias :pop :deq

  def empty?
    @h.empty?
  end

  private
  def up_heap
    i, up = @h.size-1, @h[-1]
    while 0 <= (iP = (i-1)/2)
      break unless up < @h[iP]
      @h[i], i = @h[iP], iP
    end
    @h[i] = up
  end

  def dn_heap
    i, dn, size = 0, @h[0], @h.size
    while (iC = 2*i+1) < size
      iC += 1 if iC+1 < size and @h[iC+1] < @h[iC]
      break unless @h[iC] < dn
      @h[i], i = @h[iC], iC
    end
    @h[i] = dn
  end
end

MAX_V = 50 # 制約の最大値。
MAX_S = MAX_V * 50 + 5
INF   = Float::INFINITY

#　頂点
Edge = Struct.new(:to, :a, :b)
#　両替所
Exchange = Struct.new(:v, :s, :x) do
  include Comparable
  def <=>(other)
    self.x <=> other.x
  end
end

g    = Array.new(MAX_V) { Array.new { Edge.new } }
dist = Array.new(MAX_V) { Array.new(MAX_S + 5) { INF } }

def input
  gets.split.map &:to_i;
end

# メイン
n, m, s = input
#　都市の入力
m.times do
  u, v, a, b = input
  u          = u.pred
  v          = v.pred
  g[u] << Edge.new(v, a, b)
  g[v] << Edge.new(u, a, b)
end

# プライオリティキューのライブラリを利用
s = [s, MAX_S].min
# プライオリティーキュー
q =PriorityQueue.new
# 入力用ラムダ
push = lambda { |v, s, x|
  return if s < 0
  return if dist[v][s] <= x

  dist[v][s] = x
  q.push(Exchange.new(v, s, x))
}

c = []
d = []
n.times do |i|
  cc, dd = input
  c[i]   = cc
  d[i]   = dd
end
push.call(0, s, 0)
until q.empty?
  hoge = q.pop
  v    = hoge.v; s = hoge.s; x = hoge.x
  next if dist[v][s] != x

  ns = [s + c[v], MAX_S].min
  push.call(v, ns, x + d[v])

  g[v].each do |e|
    push.call(e.to, s - e.a, x + e.b)
  end
end


(1 ... n).each do |i|
  ans = INF
  (0 ... (MAX_S + 5)).each do |j|
    ans = [ans, dist[i][j]].min
  end
  puts ans
end

Measured memory_bytes: 21676
#include<bits/stdc++.h>
using namespace std;
int main () {
  string N;
  cin >> N;
  int count = 0;
  
  for (int i = 0; i < 4; i++) {
    if (N.at(i) == '2') {
      count ++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

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

	pll p[2 * N];
	rep(i, n) {
		cin >> p[i].first;
		p[i].second = 1;
	}

	rep(i, m) {
		cin >> p[i + n].second >> p[i + n].first;
	}

	sort(p, p + n + m, greater<pll>());

	ll ans = 0;
	ll remain = n;
	for(int i = 0; i < n; i++) {
		if(remain - p[i].second >= 0) {
			remain -= p[i].second;
			ans += p[i].second * p[i].first;
		}
		else {
			ans += remain * p[i].first;
			break;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3328
"use strict";

function main(input) {
  var inputs = input.split("\n");

  var N = parseInt(inputs[0], 10)
  var a = inputs.slice(1, N + 1).map((v, i) =>
    v.split(" ").map((v, i) => parseInt(v, 10))
  );
  var c = inputs.slice(N + 1, 2 * N + 1).map((v, i) =>
    v.split(" ").map((v, i) => parseInt(v, 10))
  );
  a.sort((a, b) => b[1] - a[1]);
  c.sort((a, b) => a[0] - b[0]);

  var result = 0;

  for (let ci = 0; ci < c.length; ci++) {
    for (let ai = 0; ai < a.length; ai++) {
      if (a[ai][0] < c[ci][0] && a[ai][1] < c[ci][1]) {
        a[ai][0] = a[ai][1] = 100 * N;
        result++;
        break;
      }
    }
  }

  console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include <iostream>
#include <algorithm>
#define llint long long
#define mod 1000000007

using namespace std;

int n, x;
int s[205];
llint dp[205][100005];

int main(void)
{
	cin >> n >> x;
	for(int i = 1; i <= n; i++) cin >> s[i];
	sort(s+1, s+n+1);
	reverse(s+1, s+n+1);
	
	dp[0][x] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= x; j++){
			(dp[i+1][j%s[i+1]] += dp[i][j]) %= mod;
			(dp[i+1][j] += dp[i][j] * (n-i-1) % mod) %= mod;
		}
	}
	
	llint ans = 0;
	for(int i = 0; i < s[n]; i++){
		ans += dp[n][i] * i % mod, ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 157056
N,M=map(int,input().split())
a = []
cost = 0

for i in range(N):
    a.append(list(map(int, input().split())))
    
a = sorted(a, key=lambda x: x[0])
    
for i in range(N):
    while a[i][1] > 0:
        a[i][1] -= 1
        cost += a[i][0]
        M -= 1
        if M == 0:
            break
    if M == 0:
        break

print(cost)



Measured memory_bytes: 29796
N = int(input())
A = list(map(int, input().split()))
tf = True
cnt = 0
while tf == True:
    for i in range(N):
        if A[i] % 2 != 0:
            tf = False
    if tf == True:
        cnt += 1
        for i in range(N):
            A[i] //= 2
print(cnt)


Measured memory_bytes: 63964
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int a, b;
    cin >> a >> b;
    cout << (a - 1) / b + 1 << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  var tmp = readLine()!!.split(" ").map(String::toLong);
  val n = tmp[0];
  val map = mutableMapOf<String, Boolean>();
  var c = 0;
  for (i in 1..n) {
    val s = readLine();
    if (s != null && !map.containsKey(s)) {
      c++;
      map.set(s, true);
    }
  }
  println(c);
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

vec<vec<double>> dp;
/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    cout << fixed << setprecision(15);

    int n; cin >> n;
    vec<double> p(n); rep(i,n) cin >> p[i];
    dp.resize(n+1, vec<double>(n+1));
    dp[0][0] = 1;

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

    double ans = 0;
    for(int j = (n+1)/2; j <= n; ++j) {
        ans += dp[n][j];
    }
    cout << ans << '\n';
}

Measured memory_bytes: 70784
#include<iostream>
using namespace std;
int n, m, x,cnt,cnt2;
int mm[110];
main()
{
  cin >> n >> m >> x;
  for (int i = 0; i < m;i++)
  {
    cin >> mm[i];
    if(mm[i]<x)
      cnt++;
    else cnt2++;
    
  }
  cout << (cnt<=cnt2 ? cnt : cnt2) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(void){
  vector<int> cost;
  int tmp;
  int TOTAL = 0;
  
  for(int i=0; i<3; i++){
	cin >> tmp;
    cost.push_back(tmp);
  }
  
  sort(cost.begin(),cost.end());
  
  TOTAL = cost[0] + cost[1];
  
  cout << TOTAL << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; i++) {
        if(i % 3 == 0 || i % 5 == 0) {
            continue;
        }
        ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	cin>>s;
	int l=s.length();
	queue<LL> q;
	FOR(i,0,(1<<(l-1))){
		LL tmp=s[0]-'0';
		FOR(j,0,l){
			int k=j+1;
			if(i&(1<<j)){
			}else{
				q.push(tmp);
				tmp=0;
			}
			tmp=tmp*10+s[k]-'0';
		}
	}
	LL ans=0;
	while(q.size()){
		ans+=q.front();
		q.pop();
	}
	cout<<ans<<endl;
    return 0;
}


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

main()
{
    int a[3][3];
    for(int i=0;i<3;++i)
    {
        for(int j=0;j<3;++j)
        {
            cin>>a[i][j];
        }
    }
    int n; cin>>n;
    for(int i=0;i<n;++i)
    {
        int b; cin>>b;
        for(int i=0;i<3;++i)
        {
            for(int j=0;j<3;++j)
            {
                if(a[i][j]==b)
                {
                    a[i][j]=0;
                }
            }
        }
    }
    for(int i=0;i<3;++i)
    {
        if(*max_element(a[i],a[i]+3)==0)
        {
            cout << "Yes" << "\n";
            return 0;
        }
    }
    for(int i=0;i<3;++i)
    {
        for(int j=0;j<i;++j)
        {
            swap(a[i][j],a[j][i]);
        }
    }
    for(int i=0;i<3;++i)
    {
        if(*max_element(a[i],a[i]+3)==0)
        {
            cout << "Yes" << "\n";
            return 0;
        }
    }

    if(max({a[0][0],a[1][1],a[2][2]})==0 or max({a[2][0],a[1][1],a[2][0]})==0)
    {
        cout << "Yes" << "\n";
    }
    else cout << "No" << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll f(ll x,ll c,ll d){
    ll res =x;
    res -=x/c;
    res -=x/d;
    res+= x/lcm(c,d);
    return res;
}

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> v(n),s(n);
    rep(i,n){
        cin>>v[i];
    }
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        a--;b--;
        if(v[a]==v[b]){
            s[a]=-1;
            s[b]=-1;
        }
        if(v[a]<v[b])s[a]=-1;
        if(v[b]<v[a])s[b]=-1;
    }
    ll ans=0;
    rep(i,n){
        if(s[i]==0)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4752
//Author: Prakhar Asaiya
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define pb push_back
#define ll long long
//const int M=1e9+7;
const int INF=1e9+5;



int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
   int n,m;
   cin>>n>>m;
   int A[m];
   ll sum=0;
   REP(i,0,m)
   {
   	cin>>A[i];
   	sum+=A[i];
   }
   if(sum>n)
   cout<<"-1\n";
   else if(sum==n)
   cout<<"0\n";
   else
 cout<<n-sum<<"\n";
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int ans = 0;
    int n,m;
    cin>>n>>m;
    set<int> si;
    vector<int> v(n);
    rep(i,m){
        int p;
        string s;
        cin>>p>>s;
        p--;
        if(s=="WA"){
            v[p]++;
        }else{
            if(si.find(p)==si.end()){
                ans+=v[p];
            }
            si.insert(p);
        }
    }
    cout<<si.size()<<" "<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include<vector>
#include<tuple>

using namespace std;
int main(){
  int a,b,t,sum=0;
  cin >> a >> b >> t;
  t = (t+0.5)/a;
  sum = b*(t);
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static class Point{
		double x=0.0;
		double y=0.0;
		public Point(double x,double y){
			this.x=x;
			this.y=y;
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		
		System.out.println("0.00000000 "+"0.00000000");
		koch(n,new Point(0.0,0.0),new Point(100.0, 0.0));
		System.out.println("100.00000000 "+"0.00000000");
	}
	private static void koch(int n, Point point1, Point point2) {
		// TODO Auto-generated method stub
		if(n==0)
			return;
		double degree=60;
		double dr=Math.toRadians(degree);
		Point s=new Point((2*point1.x+point2.x)/3,(2*point1.y+point2.y)/3 );
		Point t=new Point((point1.x+2*point2.x)/3,(point1.y+2*point2.y)/3 );
		Point u=new Point((t.x-s.x)*Math.cos(dr)-(t.y-s.y)*Math.sin(dr)+s.x,(t.x-s.x)*Math.sin(dr)+(t.y-s.y)*Math.cos(dr)+s.y);

		koch(n-1,point1 , s);
		System.out.format("%.8f %.8f\n", s.x,s.y);
		
		koch(n-1,s , u);
		System.out.format("%.8f %.8f\n", u.x,u.y);
		
		koch(n-1,u , t);
		System.out.format("%.8f %.8f\n", t.x,t.y);
		
		koch(n-1,t, point2);
	
	}

}



Measured memory_bytes: 41204
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define MAX_N 100100
vector<ll> dp(MAX_N);

int main() {
  //入力部
  int N;
  cin >> N;
  vector<int> h;
  for (int i = 0; i < N; i++) {
    int H;
    cin >> H;
    h.push_back(H);
  }

  // ここだけ調整
  dp[1] = abs(h[1] - h[0]);
  for (int i = 0; i < N; i++) {
    dp[i + 2] =
        min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]));
  }
  cout << dp[N - 1] << endl;
  return 0;
}

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

using namespace std;

#define mod 1000000007

int main () {
    int n = 0, m = 0;
    cin >> n >> m;
    vector<bool> a(n, true);
    for (int i=0; i<m; i++) {
        int buf = 0;
        cin >> buf;
        a.at(buf) = false;
    }
    vector<long long> dp(n+1);
    dp.at(0) = dp.at(1) = 1;
    for (int i=2; i<=n; i++) {
        dp.at(i) = dp.at(i-2) * a.at(i-2) + dp.at(i-1) * a.at(i-1);
        dp.at(i) %= mod;
    }
    cout << dp.at(n) << endl;
    return 0;
}


Measured memory_bytes: 1024
import Data.List
import Control.Monad

main :: IO ()
main = do
    [n, x] <- map read . words <$> getLine :: IO [Int]
    d <- sort <$> replicateM n (read <$> getLine)
    let (gram, n) = foldr (\d (s, n) -> if s+d <= x then (s+d, n+1) else (s, n)) (0,0) d
    print $ n + div (x-gram) (head d)

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

struct TTree
{
private:
	struct TNode
	{
	public:
		int Id;
		TNode* Parent;
		TNode* LChild;
		TNode* RChild;
		TNode(int Value)
		{
			Id = Value;
			Parent = NULL;
			LChild = NULL;
			RChild = NULL;
		}
	};
	TNode* Root;
	void Delete(const TNode* Node)
	{
		if(Node == NULL) return;
		Delete(Node->LChild);
		Delete(Node->RChild);
		delete Node;
	}
	void InorderOutput(const TNode* Node)
	{
		if(Node == NULL) return;
		InorderOutput(Node->LChild);
		cout << ' ' << Node->Id;
		InorderOutput(Node->RChild);
	}
	void PreorderOutput(const TNode* Node)
	{
	    if(Node == NULL) return;
	    cout << ' ' << Node->Id;
	    PreorderOutput(Node->LChild);
	    PreorderOutput(Node->RChild);
	}
	void Insert(TNode* z)
	{
	    assert(z != NULL);
		TNode* y = NULL;
		TNode* x = Root;
		while(x != NULL){
			y = x;
			if(z->Id < x->Id){
				x = x->LChild;
			}else{
				x = x->RChild;
			}
		}
		z->Parent = y;
		if(y == NULL){
			Root = z;
		}else if(z->Id < y->Id){
			y->LChild = z;
		}else{
			y->RChild = z;
		}
	}
	void Find(TNode* Node, int Value, bool& IsExist)
	{
		if(Node == NULL) return;
		if(Node->Id == Value){
			cout << "yes" << endl;
			IsExist = true;
			return;
		}else if(Node->Id > Value){
			Find(Node->LChild, Value, IsExist);
		}else{
			Find(Node->RChild, Value, IsExist);
		}
	}
public:
	TTree()
	{
		Root = NULL;
	}
	~TTree()
	{
		Delete(Root);
	}
	void Insert(int Id)
	{
		Insert(new TNode(Id));
	}
	void Find(int Id)
	{
		bool IsExist = false;
		Find(Root, Id, IsExist);
		if(IsExist == false) cout << "no" << endl;
	}
	void Print()
	{
		InorderOutput(Root);
		cout << endl;
		PreorderOutput(Root);
		cout << endl;
	}
};

int main()
{
	int n;
	cin >> n;
	TTree Tree;
	for(int i = 0; i < n; i++){
		string Command;
		cin >> Command;
		if(Command == "insert"){
			int Id;
			cin >> Id;
			Tree.Insert(Id);
		}else if(Command == "find"){
			int Id;
			cin >> Id;
			Tree.Find(Id);
		}else{
			Tree.Print();
		}
	}
	return 0;
}

Measured memory_bytes: 21788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int main(){
  int n,m,c,ans=0;
  ll test=0;
  cin>>n>>m>>c;
  int b[m];
  rep(i,m) cin>>b[i];
  int a[n][m];
  rep(i,n)rep(j,m) cin>>a[i][j];
  rep(i,n){
    rep(j,m){
      test += a[i][j]*b[j];
    }
    if(test+c > 0) ans++;
    test = 0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3552
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/
const int mod = 998244353;
const int MAXN = 333;
int dp[MAXN][MAXN][MAXN];





int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  string s; cin >> s;
  int k; cin >> k;
  vector<int> nums;
  int cur = 0;
  for (char c : s) {
    if (c == '0') {
      nums.push_back(cur);
      cur = 0;
    } else {
      cur++;
    }
  }
  if (cur != 0) nums.push_back(cur);
  int n = nums.size();
  int m = s.size();
  dp[n][0][0] = 1;
  for (int i = n-1; i >= 0; i--) {
    for (int a = 0; a <= m; a++) {
      for (int b = 0; b <= a; b++) {
        if (dp[i+1][a][b] == 0) continue;
        for (int c = 0; c <= b; c++) {
          dp[i][a][c] = (dp[i+1][a][b] + dp[i][a][c]) % mod;
        }
        for (int c = 1; c <= nums[i]; c++) {
          dp[i][a+c][b+c] = (dp[i][a+c][b+c] + dp[i+1][a][b]) % mod;
        }
      }
    }
  }
  LL ret = 0;
  for (int i = 0; i <= min(k, m); i++) {
    ret = (ret + dp[0][i][0]) % mod;
  }
  cout << ret << '\n';







/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 32736
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

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

    bool flg = false;
    for (auto i = 1; i <= 9; i++) {
        if(n % i == 0 and n / i <= 9) {
            flg = true;
            break;
        }
    }

    cout << (flg ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
main(){
	int c[11]={0,48,51,54,57,60,64,69,75,81,91},i;
	string name[11]={"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};
	double n;
	while(cin>>n){
		for(i=0;i<10;++i){
			if(c[10]<n){
				i=10;
				break;
			}
			if(c[i]<n && c[i+1]>=n){
				break;
			}
		}
		cout<<name[i]<<endl;
	}
}

Measured memory_bytes: 1232
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class Main{
    public static void main(final String[] args){
 
        final Scanner sc = new Scanner(System.in);
        BigDecimal Av = new BigDecimal(sc.next());
        BigDecimal Bv = new BigDecimal(sc.next());
        BigDecimal ans = Av.multiply(Bv);

       
            System.out.println(ans.setScale(0, BigDecimal.ROUND_DOWN));
        
    }
}

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

const int maxn = (int)(1e5) + 5;
vector<int> nxt[maxn], val[maxn];
int f[maxn];

void dfs(int x) {
	for (int i = 0; i < (int)nxt[x].size(); ++i) {
		dfs(nxt[x][i]); val[x].push_back(f[nxt[x][i]]);
	} f[x] = val[x].size();
	sort(val[x].begin(), val[x].end(), greater<int>()); int now = 0;
	for (int i = 0; i < (int)val[x].size(); ++i) f[x] = max(f[x], val[x][i] + now + 1), ++now;
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 2; i <= n; ++i) {
		int x; scanf("%d", &x);
		nxt[x].push_back(i);
	}
	dfs(1);
	return printf("%d\n", f[1]), 0;
}

Measured memory_bytes: 19328
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	map<string, int> mp;

	mp["SUN"] = 0;
	mp["MON"] = 1;
	mp["TUE"] = 2;
	mp["WED"] = 3;
	mp["THU"] = 4;
	mp["FRI"] = 5;
	mp["SAT"] = 6;

	string tmp;
	cin >> tmp;

	cout << 7 - mp[tmp] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MONTHS 12
int main(void){
  int L,M,N,sum,a,i;
  scanf("%d",&L);
  while(L){
    M=0;N=0;sum=0;a=0;
    for(i=1;i<=MONTHS;i++){
      scanf("%d %d",&M,&N);
      sum += M-N;
      if(sum>=L&&a==0)
	a = i;
    }
    if(a)
      printf("%d\n",a);
    else puts("NA");
    scanf("%d",&L);
  }
  return 0;
}

Measured memory_bytes: 612
def solve():
    H = int(input())

    divided = H
    cnt = 0
    while divided != 1:
        divided //= 2
        cnt += 1
    
    ans = 0
    for i in range(cnt+1):
        ans += 2 ** i

    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 38384
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	char c1, c2;
	cin >> c1 >> c2;
	if (c1 > c2) puts(">");
	if (c1 == c2) puts("=");
	if (c1 < c2) puts("<");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include "math.h"
using namespace std;
int main()
{
	vector<long long> a;
	long long n;
	cin >> n;

	for (long long i = 0; i < n; i++) {
		long long kari;
		cin >> kari;
		a.push_back(kari);
	}

	//long long sum = accumulate(a.begin(), a.end(), 0);
	//これだとaccumulateの第三引数がintとみなされ、オーバーフローの恐れ！
	long long sum = accumulate(a.begin(), a.end(), 0LL);


	long long sumima = 0, minimam = 1000000000000000000LL;
	for (long long i = 0; i < n - 1; i++) {
		sumima += a[i];
		if (abs(sum - 2 * sumima) < minimam) {
			minimam = abs(sum - 2 * sumima);
		};
	}

	cout << minimam<<endl;
	return 0;

}


Measured memory_bytes: 2420
n = int(input())
x= list(map(int, input().split()))
sx=sorted(x)
center=sum(sx[n//2-1:n//2+1])/2
under=sx[n//2-1]
over=sx[n//2]
for i in x:
    if i>=center:
        print(under)
    else:
        print(over)

Measured memory_bytes: 25220
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> a(5);
    REP(i, 5) cin >> a[i];
    SORT(a);
    ll mn = a[0];

    ll ans = ((N + mn - 1) / mn) + 4;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
    int N, M;
    cin >> N >> M;
    priority_queue<int, std::vector<int>> A;
    for (auto i = 0; i < N; ++i) { int a; cin >>a; A.push(a); }

    for (int i = 0; i < M; ++i) {
        auto a = floor(A.top() / 2);
        A.pop();
        A.push(a);
    }
    long long acc = 0;
    for (int i = 0; i < N; ++i) {
        acc += A.top();
        A.pop();
    }
    cout << acc << endl;
    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<ll,ll> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,a,b,c;
  while(cin >> n && n){
    vector<pair<ll,ll>> v;
    vary(ll,v2,4001,0);
    vary(ll,t,4001,0);
    ll cnt=0;
    rep(i,n){
      cin >> a >> b >> c;
      if(v2[a] == 0){
        v.push_back(make_pair(cnt,a));
        ++cnt;
        v2[a] = 1;
      }
      t[a] += b * c;
    }
    bool f = false;
    REP(i,0,v.size()){
      if(t[v[i].se] >= 1000000){
        cout << v[i].se<<endl;
        f = true;
      }
    }
    if(!f) cout << "NA"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3212
extern crate core;

use std::collections::HashMap;
use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(n:usize)(list:[i64]));
    list.into_iter()
        .map(|x| prime_factor(x).get(&2).cloned().unwrap_or(0))
        .fold(0, |sum, i| sum + i)
        .to_string()
}

pub fn prime_factor(mut n: i64) -> HashMap<i64, i64> {
    let mut res: HashMap<i64, i64> = HashMap::new();
    let mut i = 2;
    while i * i <= n {
        while n % i == 0 {
            let v = match res.get(&i) {
                Some(v) => *v + 1,
                None => 1,
            };
            res.insert(i, v);
            n /= i;
        }
        i += 1;
    }
    if n != 1 {
        res.insert(n, 1);
    }
    res
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3\n5 2 4" => "3",
    test2: "4\n631 577 243 199" => "0",
    test3: "10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776" => "39",
}


Measured memory_bytes: 4352
n = int(input())
a = list(map(int, input().split()))

b = [0] + a + [0]
c = []
for i in range(n+1):
    c.append(abs(b[i] - b[i+1]))

l = sum(c)

for i in range(n):
    ans = l - c[i] - c[i+1]
    ans += abs(b[i] - b[i+2])
    print(ans)



Measured memory_bytes: 14040
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
int main()
{
    ll a[3][3];
    rp(i, 0, 3) rp(j, 0, 3) cin >> a[i][j];
    ll n;
    cin >> n;
    ll b[n];
    rp(i, 0, n) cin >> b[i];

    ll aa[3][3];

    rp(i, 0, 3) rp(j, 0, 3) aa[i][j] = 1;

    rp(i, 0, n) rp(k, 0, 3) rp(j, 0, 3) if (a[k][j] == b[i]) aa[k][j] = 0;

    rp(i, 0, 3) if (aa[i][0] == 0 && aa[i][1] == 0 && aa[i][2] == 0)
    {
        cout << "Yes" << endl;
        exit(0);
    }
    rp(i, 0, 3) if (aa[0][i] == 0 && aa[1][i] == 0 && aa[2][i] == 0)
    {
        cout << "Yes" << endl;
        exit(0);
    }

    if (aa[0][0] == 0 && aa[1][1] == 0 && aa[2][2] == 0)
    {
        cout << "Yes" << endl;
        exit(0);
    }
    if (aa[0][2] == 0 && aa[1][1] == 0 && aa[2][0] == 0)
    {
        cout << "Yes" << endl;
        exit(0);
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(){
    char wethar[3];
    int sun = 7;

    scanf("%s", &wethar);
    
    if(wethar[0] == 'S' && wethar[1] == 'U'){
        sun = 7;
    }

    if(wethar[0] == 'M' && wethar[1] == 'O'){
        sun = 6;
    }

    if(wethar[0] == 'T' && wethar[1] == 'U'){
        sun = 5;
    }

    if(wethar[0] == 'W' && wethar[1] == 'E'){
        sun = 4;
    }

    if(wethar[0] == 'T' && wethar[1] == 'H'){
        sun = 3;
    }

    if(wethar[0] == 'F' && wethar[1] == 'R'){
        sun = 2;
    }

    if(wethar[0] == 'S' && wethar[1] == 'A'){
        sun = 1;
    }


    printf("%d", sun);
    return 0;
}

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

int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (U == S) {
    A--;
  } else {
    B--;
  }
  cout << A << " " << B << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z=[abs(a-b) for (a,b) in zip(x,y)]
for i in range(1,4):
    print('{:.9}'.format(sum([j**i for j in z])**(1/i)))
print(max(z))


Measured memory_bytes: 5656
#include<iostream>
#include<string>
using namespace std;
void swap(int* x, int* y){
    *x += *y;
    *y = *x - *y;
    *x = *x - *y;
}
void swap2(char* x, char* y){
    *x += *y;
    *y = *x - *y;
    *x = *x - *y;
}

void trace(int A[], char B[], int n){
    cout << B[0] << A[0];
    for (int i = 1; i < n; i++)
    {
        cout << " " << B[i] <<A[i];
    }
    cout << endl;
}
void bubble_sort(int A[], char B[], int n){
    bool flag = true;
    while (flag)
    {
        flag = false;
        for (int i = n-1; i > 0; i--)
        {
            if (A[i] < A[i-1])
            {
                swap(&A[i], &A[i-1]);
                swap2(&B[i], &B[i-1]);
                flag = true;
            }   
        }   
    }
}
void insertion_sort(int A[], char B[], int n){
    int min_A;
    for (int i = 0; i < n-1; i++)
    {
        min_A = i;
        for (int j = i+1; j < n; j++)
        {
            min_A = ((A[min_A] <= A[j]) ? min_A : j);
        }
        if(min_A!=i){
        swap(&A[min_A], &A[i]);
        swap2(&B[min_A], &B[i]);
        }
    }
}

int main(){
    int n; cin >> n;
    int A_num[105],  B_num[105];
    char A_suit[105], B_suit[105];
    for (int i=0; i < n; i++){
        string str;
        cin >> str;
        A_num[i] = int(str[1] - '0');
        A_suit[i] = str[0];
        B_num[i] = int(str[1] - '0');
        B_suit[i] = str[0];
    }
    bubble_sort(A_num, A_suit, n);
    insertion_sort(B_num, B_suit, n);
    trace(A_num, A_suit, n);
    cout << "Stable" << endl;
    trace(B_num, B_suit, n);
    bool flag = true;
    for (int i = 0; i < n; i++)
    {
        if(A_suit[i] != B_suit[i]){
            flag = false;
            break;
        }
    }
    cout << (flag ? "Stable" : "Not stable") << endl;
    
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
string s,p;
char a[108];
int main()
{
    ft
    int t,i,j,n,m,l=0,r,z=0;
    cin>>s>>p;
    for(char c:s)
    {
        a[z]=c;
        z+=2;
    }
    l=z;
    z=1;
    for(char c:p)
    {
        a[z]=c;
        z+=2;
    }
    l=max(l,z);
    a[l]='\n';
    cout<<a<<"\n";
    return 0;
}



Measured memory_bytes: 256
/* Simplicity and Goodness */

#include <bits/stdc++.h>
using namespace std;
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define deb(x) cout << #x << ' ' << x << '\n'
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define per(i,ini) for(int i=ini;i>=0;i--)
#define tc int tt; scn(tt); while(tt --)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 1e6+2;

int main()
{
    int n;
    scn(n);

    set <string> s;

    rep(i, 0, n)
    {
        string ts;
        cin >> ts;

        s.insert(ts);
    }

    prin(s.size());
    
    return 0;
}

Measured memory_bytes: 19380
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> bool chmax(T &a, const T& b) {if (a < b) {a = b;return true;}return false; }
template <typename T> bool chmin(T &a, const T& b) {if (a > b) {a = b;return true;}return false; }

struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(0);
      cout << fixed << setprecision(20);
      cerr << fixed << setprecision(20);
    }
} IoSetup;

int main() {
  string s; cin >> s;
  for (int i = 0; i < (int) s.size()-1; ++i) {
    if (s[i] == 'A' && s[i+1] == 'C') {
      cout << "Yes" << '\n';
      return 0;
    }
  }
  cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()



signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s, t;
  cin >> s >> t;
  int s_size = s.size(), t_size = t.size();
  vector<char> sp(s_size), tp(t_size);
  rep(i, 0, s_size) sp[i] = s[i];
  rep(i, 0, t_size) tp[i] = t[i];
  
  sort(all(sp));
  sort(allg(tp));
  cout << (sp < tp ?"Yes" :"No") << "\n";

}

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

class UnionFind
{
public:
    vector<int> parent;
    vector<int> sz;
    
    UnionFind(int n): parent(n), sz(n)
    {
        for(int i=0;i<n;i++)
        {
            parent[i] = i;
            sz[i] = 1;
        }
    }

    int root(int x)
    {
        return parent[x]==x ? x : parent[x] = root(parent[x]);
    }

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

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (sz[x] < sz[y])
            {
                parent[x] = y;
                sz[y] += sz[x];
            }
            else
            {
                parent[y] = x;
                sz[x] += sz[y];
            }
        }
    }

    int size(int x)
    {
        return sz[root(x)];
    }
};

#include <iostream>
#include <map>
#include <utility>

int main()
{
    int N, K, L;
    cin>>N>>K>>L;
    vector<int> p(K), q(K);
    for (int i=0; i<K; i++)
    {
        cin>>p[i]>>q[i];
        p[i]--;
        q[i]--;
    }
    vector<int> r(L), s(L);
    for (int i=0; i<L; i++)
    {
        cin>>r[i]>>s[i];
        r[i]--;
        s[i]--;
    }

    UnionFind UF1(N);
    for (int i=0; i<K; i++)
        UF1.unite(p[i], q[i]);
    UnionFind UF2(N);
    for (int i=0; i<L; i++)
        UF2.unite(r[i], s[i]);

    map<pair<int, int>, int> M;
    for (int i=0; i<N; i++)
        M[make_pair(UF1.root(i), UF2.root(i))]++;
    for (int i=0; i<N; i++)
        cout<<(i==0?"":" ")<<M[make_pair(UF1.root(i), UF2.root(i))];
    cout<<endl;
}


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

int main(){
    string s,t;
    cin>>s;
    cin>>t;
    int c=0;
    int m=t.length();
    for(int i=0;i<m;i++){
        if(s[i]!=t[i])
            c++;
        
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 3916
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author NMouad21
 */
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);
    DKnapsack1 solver = new DKnapsack1();
    solver.solve(1, in, out);
    out.close();
  }

  static class DKnapsack1 {
    public final void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      int maxW = in.nextInt();
      int[] w = new int[n];
      int[] v = new int[n];
      for (int i = 0; i < n; i++) {
        w[i] = in.nextInt();
        v[i] = in.nextInt();
      }

      long[][] dp = new long[n][maxW + 1];
      for (int i = w[0]; i <= maxW; i++) {
        dp[0][i] = v[0];
      }
      for (int i = 1; i < n; i++) {
        for (int j = 0; j <= maxW; j++) {
          dp[i][j] = dp[i - 1][j];
          if (j - w[i] >= 0) {
            dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
          }
        }
      }
      out.println(dp[n - 1][maxW]);
    }
  }

  static final class InputReader {
    private final InputStream stream;
    private final byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader() {
      this.stream = System.in;
    }

    public InputReader(final InputStream stream) {
      this.stream = stream;
    }

    private final int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public final int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {}

      byte sgn = 1;
      if (c == 45) { // 45 == '-'
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
        res *= 10;
        res += c - 48; // 48 == '0'
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    private static final boolean isSpaceChar(final int c) {
      return c == 32 || c == 10 || c == 13 || c == 9
          || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
    }
  }
}


Measured memory_bytes: 126420
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int p, m, c;
  cin >> p >> m >> c;
  cout << (p + m + c) << endl;
}



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

int main() {
  int best = 0;
  int N;
  cin >> N;
  vector<string> s;
  
  for(int i=0; i<N; i++) {
    string temp;
    cin >> temp;
    s.push_back(temp);
  }
  int M;
  cin >> M;
  vector<string> t;
  for(int i=0; i<M; i++) {
    string temp;
    cin >> temp;
    t.push_back(temp);
  }
  for(int i=0; i<N; i++) {
    int earn=0;
    string curr=s[i];
    // earn
    for (int j=0; j<N; j++)
      if(s[j]==curr) earn ++;
    // lose
    for (int j=0; j<M; j++)
      if(t[j]==curr) earn --;
    best = (earn > best)? earn: best;
  }
  cout << ((best > 0)? best: 0) << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    int s=0;
    for (int i=0;i<n;i++) {
        cin >> w[i];
        s+=w[i];
    }
    int st=0;
    int ans=s;
    for (int i=0;i<n;i++) {
        st+=w[i];
        int d=abs(s-2*st);
        ans=min(ans,d);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int n, k;
	string s;
	cin >> n >> k >> s;
	k--;
	s[k] = tolower(s[k]);
	cout << s << endl;
}

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

	solve();
}


Measured memory_bytes: 256