akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m;
	cin>>n>>m;
	
	k=(n%m);
	ll a,b;
	a=k; b=abs(k-m);
	cout<<(min(a,b));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int sum = 1;
	int i = 2;
	while (sum < n) {
		sum += i;
		i++;
	}

	int diff = sum - n;
	for (int j = 1; j < i; j++) {
		if (j == diff) {
			continue;
		}
		cout << j << endl;
	}

	return 0;
}

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

int main()
{
    int n,h,sum=0;
    int hh;
    cin>>n>>h;
    while(n--)
    {
        cin>>hh;
        if(hh>=h)
            sum++;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
h = Array.new(10**5,0)
sum = a.sum
a.each do |num|
  h[num-1] += 1
end

q = gets.chomp.to_i

q.times do
  b,c = gets.chomp.split.map{|x| x.to_i - 1}
  sum += (c-b)*h[b]
  puts sum 
  h[c] += h[b]
  h[b] = 0
end

Measured memory_bytes: 22640
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

#define MAXN 100000
void [[noreturn]] out(int t=0) 
{
	debug(t);
	puts("NO");
	exit(0);
}
LL a[MAXN+10];	
struct Edge
{
	int to,next;
}e[2*MAXN+10];
int head[MAXN+10];
void addEdge(int a,int b)
{
	static int c=0;
	e[++c]=(Edge){b,head[a]};
	head[a]=c;
	e[++c]=(Edge){a,head[b]};
	head[b]=c;
}
LL dp(int now,int fa)
{
	LL sum=0;
	LL mx=0;
	for(int i=head[now]; i!=0; i=e[i].next) {
		int v=e[i].to;
		if (v==fa) continue;
		LL son=dp(v,now);
		mx=max(mx,son);
		sum+=son;
	}
	if (mx==0) return a[now];
	//debug(now,a[now],sum);
	if (a[now]>sum ) out(1);
	if (sum>2*a[now]) {
		debug(now,a[now],sum);	
		out(0);
	}
	
	LL t=sum-a[now];
	if ((sum-mx)<t) out(2);
	return 2*a[now]-sum;
}
int main(){	
#ifdef WAAUTOMATON	
	freopen("in.txt","r",stdin);
#endif
	int n;
	cin>>n;
	for(int i=1; i<=n; ++i) {
		cin>>a[i];
	}
	for(int i=1; i<n; ++i) {
		int x,y;
		cin>>x>>y;
		addEdge(x,y);
	}
	int x=-1;
	for(int i=1; i<=n; ++i) {	
		if (head[i]!=0 && e[head[i]].next==0) {
			x=i;
			break;
		}
	}
	debug(x);
	LL t=dp(x,0);
	//if () out(3);
	puts("YES");
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0 ; i<(n) ;i++)
bool go(int a,int b,int k){
	int n = 0;
	while(k>0){
		n += k%10;
		k /=10;
	}

	return (k>=a && k<=b);
}

int main(){
	int n; cin >> n;
	set<int> s;
	rep(i,n){
		int a; cin >> a;
		s.insert(a);
	}

	cout << s.size() << endl;

	return 0;
}

Measured memory_bytes: 256
#! ruby -Ks

n, k = gets.strip.split(' ').map{|s| s.to_i}
d = Array.new(n,-1)
k.times do |i|
	a, b = gets.strip.split(' ').map{|s| s.to_i}
	d[a - 1] = b - 1;
end
dp = Array.new(2){Array.new(3,0)}
3.times do |i|
	3.times do |j|
		if (d[0] < 0 || d[0] == i) && (d[1] < 0 || d[1] == j)
			if i == j
				dp[0][j] += 1
			else
				dp[1][j] += 1
			end
		end
	end
end
for i in 2...n
	dpw = Array.new(2){Array.new(3,0)}
	3.times do |j|
		if d[i] < 0 || d[i] == j
			3.times do |k|
				if j == k
					dpw[0][j] += dp[1][k]
				else
					dpw[1][j] += dp[0][k] + dp[1][k]
				end
			end
		end
	end
	3.times do |j|
		dp[0][j] = dpw[0][j] % 10000
		dp[1][j] = dpw[1][j] % 10000
	end
end
all = 0
3.times do |i|
	all += dp[0][i] + dp[1][i]
end
print(all % 10000,"\n")

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

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

	if(a == 1 && a < b)
		cout << "Alice" << endl;
	else if(b == 1 && a > b)
		cout << "Bob" << endl;
	else if(a > b)
		cout << "Alice" << endl;
	else if(a < b)
		cout << "Bob" << endl;
	else if(a == b)
		cout << "Draw" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char* argv[]){
  int count = 0;
  vector<int> index;
  string a,b;
  cin >> a >> b;
  if(a.size()<b.size()) return 0;
  for(int i = 0; i <= a.size()-b.size(); i++){
    if(a.substr(i, b.size())==b){
      count++;
      index.push_back(i);
    }
  }
  if(count != 0){
    for(int i : index) cout << i << endl;
  }
}

Measured memory_bytes: 3184
package main

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

func main() {
	var text string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		text = scanner.Text()
	}
	n, _ := strconv.Atoi(text)
	fmt.Println(n * n * n)
}



Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  bool ans=1;
  string s;
  cin >> s;

  rep(i,s.size()){
    if((i+1)%2){
      if(s[i]=='L') ans=0;
    }
    else{
      if(s[i]=='R') ans=0;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
	int a[100], n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	for(int i = n-1; i >= 0; i--){
	   cout << a[i];
	   if(i != 0) {
	   	   cout << " ";
	   } else {
	   	   cout << endl;
	   }
	}
	return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;++i)
#define mod 998244353LL
const double pi =3.14159265358979323846;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll arr[5];
    for(ll i=0;i<5;++i)
    {
    	cin>>arr[i];
    	if(arr[i]==0) cout<<i+1;
    }
    return 0;
}

/**
pair<ll,ll>fib(ll n)
{
    if(n==0) return {0,1};
    pair<ll , ll >p=fib(n/2);
    ll c=p.first*(2LL*p.second - p.first) ;
    ll d=p.second*p.second + p.first*p.first;
    if(n&1) return {d,c+d};
    else return {c,d};
}
**/
/**
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
**/
/**check for perfect square.
ll is_perfect_square(ll n)
{
    ll tp=floor(sqrt(n));
    if(n==(tp*tp)) return tp;
    else return -1;
}
**/
/**
ll biexp(ll a,ll n)
{
    if(n==0) return 1;
    ll res=1;
    while(n>0)
    {
        if(n%2!=0) res*=a;
        a=a*a;
        n=n/2;
    }
    return res;
}
ll modular_exp(ll a,ll n)
{
    if(n==0) return 1;
    ll res=1;
    while(n>0)
    {
        if(n%2!=0) res*=a;
        a=(a*a)%mod;
        n=n/2;
        res=res%mod;
    }
    res=(res%mod);
    return res;
}
**/
/** sieve implementation**/
/**
    ll N=1299827; // first 100008 primes;
    vector<ll>lp(N+1,0);
    vector<ll>pr;
    for(ll i=2;i<=N;++i)
    {
        if(lp[i]==0)
        {
            lp[i]=i;
            pr.push_back(i);
        }
        for(ll j=0;j<pr.size() and i*pr[j]<=N ;++j)
        {
            lp[i*pr[j]]=pr[j];
        }
    }
**/
/**
bool isprime(ll n)
{
    if(n<2) return false;
    for(ll i=2;i*i<=n;++i)
    {
        if(n%i==0) return false;
    }
    return true;
}
**/
/**factors in sqrt(n);
    ll N=100000;
    vector<vector<ll> >factors(N+1);
    for(ll j=1;j<=N;++j)
    {
        for(ll x=1;x*x<=j;++x)
         {
            if(j%x==0)
            {
                factors[j].push_back(x);
                if(j/x != x) factors[j].push_back(j/x);
            }
         }
    }
**/
/**
vector<pair<ll,ll> >prime_factors(ll n)
{
    vector<pair<ll,ll> >res; ll ct=0;
    if(!(n&1))
    {
        while(!(n&1))
        {
            ct++; n/=2;
        }
        res.push_back({2,ct});
    }
    ct=0;
    for(ll i=3;i*i<=n;i+=2)
    {
        while(n%i==0)
        {
            ct++; n/=i;
        }
        if(ct>0) res.push_back({i,ct});
        ct=0;
    }
    if(n!=1) res.push_back({n,1});
    return res;
}
**/
/** calculating n_C_r();
ll ncr(ll n, ll k) {
    ll res = 1;
    for (ll i = 1; i <= k; ++i)
        res = (res*(n-k+i))/i;

    return res;
}
**//**/


Measured memory_bytes: 3584
// https://atcoder.jp/contests/abc125/tasks/abc125_d

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int A_I_MAX = 1e9;

int N;
int A[N_MAX];

void solve() {
  bool ng = false;
  REP(i, N) if (A[i] < 0) {
    ng = !ng;
    A[i] = -A[i];
  }
  sort(A, A + N);
  ll ans = 0;
  REP(i, N) ans += A[i];
  if (ng) ans -= A[0] * 2;
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", A + i);
}

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


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
n = int(input())
c = []
s = []
f = []

for _ in range(n-1):
    line = input().split(" ")
    c.append(int(line[0]))
    s.append(int(line[1]))
    f.append(int(line[2]))

def calc(idx, t):
    # print(idx,t)
    ret = 0
    if idx==n-1:
        return t

    if t<s[idx]:
        t = s[idx]

    if t%f[idx]==0:
        return calc(idx+1, t+c[idx])
    else:
        return calc(idx+1, (t//f[idx]+1)*f[idx]+c[idx])


for i in range(n):
    # print("--",i,"--")
    print(calc(i, 0))


Measured memory_bytes: 3444
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

const p = 1000000007

func Solve() {
  var N, K int
  NextInt(&N, &K)
  A := make([]int, N + 2)
  B := make([]int, N + 2)
  for i := range A[1:] {
    A[i + 1] = A[i] + i
    B[i + 1] = B[i] + N - i
  }
  S := 0
  for i := K; i <= N + 1; i++ {
    S += B[i] - A[i] + 1
    S %= p
  }
  Write(S)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 5092
n, m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
good = Array.new(n, true)
m.times do
  a, b = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  good[a] = false if h[a] <= h[b]
  good[b] = false if h[a] >= h[b]
end
puts good.count(true)


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

int main(int argc, char const *argv[])
{
    string c1,c2;
    cin>>c1>>c2;
    if (c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int gcd (int a, int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a%b);
}
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", a+i);
  }
  int b[n], c[n];
  b[0] = 0;
  c[n-1] = 0;
  for (int i = 1; i < n; i++) {
    b[i] = gcd(a[i-1], b[i-1]);
  }
  for (int i = n-1; i > 0 ; i--) {
    c[i-1] = gcd(a[i], c[i]);
  }
  int max = 0, x;
  for (size_t i = 0; i < n; i++) {
    x = gcd(b[i], c[i]);
    if (max < x) {
      max = x;
    }
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 1e6 + 5;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin>>n>>s;
    cout<<count(s.begin(),s.begin()+(count(s.begin(),s.end(),'R')),'W');
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int>vec(N);
  for(int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  
  int A = 0;
  int B = 0;
  
  for(int j = 0; j < N; j += 2) {
    A += vec.at(j);
  }
  
  for(int k = 1; k < N; k += 2) {
    B += vec.at(k);
  }
  
  cout << A - B << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))

vector<ll> a;   //幸福度保持用
vector<ll> rui; //累積和用


//greater<ll>()とすれば良い
bool cmp(ll a,ll b){
    return a<b;
}


int main(){
    //入力
    ll ans=0,n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        ll tmp;
        cin>>tmp;
        a.push_back(tmp);
    }

    //小さいものから順に並べる
    sort(a.begin(),a.end());

    //累積和を作る
    rui.push_back(0);
    for(int i=0;i<n;i++){
            rui.push_back(rui[i]+a[i]);
    }

    //本番では二分探索による解法(M個選んだ時に答えがans以上になるか)を考えたが、結局スコアの高速な計算方法が思いつかなくて断念。
    //正しい二分探索は「幸福度がmid以上になるものがmペア以上あるか」のKを求める方であった。
    //[ok,ng)
    ll ok=1;//解に含まれる値(閉区間)
    ll ng=2*10e5+1;//解の区間に含まれない値(開区間)
    while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        ll num=0;//2つの和がmid以上になるものをカウントする
        for(int i=0;i<n;i++){//仮に左手を選んで、
            //右手:mid-a[i]以上の、最も左側にある(最も番号の若い)位置のイテレータから
            //最後の要素までの距離を測る(個数を求める)
            ll tmp=a.end()-lower_bound(a.begin(),a.end(),mid-a[i]);
            num+=tmp;
        }
        if(num>=m){//m以上あるなら下側を狭め
            ok=mid;
        }else{//m未満なら上側を狭める
            ng=mid;
        }
    }
    dbg cout<<ok<<endl;//デバッグ用。上限値を表示する
    ans=0;
    ll num=0;
    for(int i=0;i<n;i++){//仮に左手を選んで、
        ////右手:mid-a[i]以上の、最も左側にある(最も番号の若い)位置(0-index)
        ll idx=lower_bound(a.begin(),a.end(),ok-a[i],cmp)-a.begin();
        //右手は何通りあるか
        num+=n-idx;
        //右手の数だけ左手＆選んだ右手の和(大きい方から数えてn-idx人)
        ans+=a[i]*(n-idx)+rui[n]-rui[idx];

        //デバッグ用
        dbg cout<<a[i]<<" "<<(n-idx)<<" "<<rui[n]<<" "<<rui[idx]<<endl;
    }
    dbg cout<<m<<" "<<num<<endl;
    if(num>m){
        //下限値までを取得するとmより大きな値になってしまうことがある
        //(例えば、下限値が4の時にA[i]+A[j]=4となるjが10000個以上ある時など)
        //上記の足し算ではそれらを減らせないため、差分を減らしていく
        ans-=max(0LL,num-m)*ok;
    }

    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 2548
using System;
using System.Linq;

namespace ABC137
{
    class A
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);

            int[] n = new int[] { A + B, A - B, A * B };
            int res = n.Max();

            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 13268
l_1 = list(map(int,input().split()))
l_2 = list(map(int,input().split()))
n = l_1[0]
m = l_1[1]
count = 0
s = l_1[2]
for i in range(n):
    l_3 = list(map(int,input().split()))
    for j in range(m):
        s += l_3[j]*l_2[j]
    if s>0:
        count+=1
    s=l_1[2]
print(count)

Measured memory_bytes: 3064
w = input()
flag = False
arr = []
for i in w:
  arr.append(i)
  
set_arr = list(set(arr))
for i in set_arr:
  count_num = arr.count(i)
  if count_num % 2 != 0:
    flag = True
    break
if flag:
  print("No")
else:
  print("Yes")



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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n, m, c;
    cin >> n >> m >> c;

    vector<int> b(m);
    rep(i, m){
        cin >> b[i];
    }

    int ans = 0;
    rep(i, n){
        int val = c;
        rep(j, m){
            int a;
            cin >> a;
            val += a * b[j];
        }
        ans += (val > 0);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.endd()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;

int main(){
	_

	int t = 1;

	int n, k;
	string s;
	cin>>n>>k>>s; s = s + '2';
	vi last;
	rep(i, 0, n + 1)
		if(i - 1 >= 0 && s[i] != '0' && s[i - 1] == '0')
			last.pb(i - 1);

/*	rep(i, 0, last.size())
		cout<<last[i]<<"\n";*/

	int ans = 0, pre = 0, cur = 0;

	int i = 0, j = 0;
	while(i < n){

		if(s[i] == '1') cur++, i++;
		else{
			if(k == 0){
				//cout<<"ib "<<i<<" "<<cur; cn;
				while(pre <= last[j])
					cur--, pre++;
				j++, k++;
			}

			while(s[i] == '0' && i < n)
				cur++, i++;
			k--;
		}

		ans = max(ans, cur);
	}

	cout<<ans; cn;

	return 0;
}

/*

14 2
11101010110011

5 1
00010

*/

Measured memory_bytes: 768
N,M = map(int,input().split())
es = []
for i in range(M):
  a,b = map(int,input().split())
  a,b = a-1,b-1
  es.append((a,b))

parent = None
def root(a):
  if parent[a] == a:
    return a
  else:
    parent[a] = root(parent[a])
    return parent[a]

def is_same(a,b):
  return root(a) == root(b)

def unite(a,b):
  ra = root(a)
  rb = root(b)
  if ra == rb:
    return
  parent[ra] = rb

ans = 0
for i in range(M):
  parent = [k for k in range(N)]
  for j,e in enumerate(es):
    if j == i:
      continue
    a,b = e
    unite(a,b)
  a,b = es[i]
  if not is_same(a,b):
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, A, B, C, D, E;
	in >> N >> A >> B >> C >> D >> E;
	LL neck = std::min({ A,B,C,D,E });
	out << N / neck + (N % neck == 0 ? 0 : 1) + 4 << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int n;
double dp[305][305][305];

double dfs(int i, int j, int k) {
    if (dp[i][j][k] != -1) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return 0.0;
    double res = 0;
    if (i > 0) res += dfs(i-1,j,k) * i;
    if (j > 0) res += dfs(i+1,j-1,k) * j;
    if (k > 0) res += dfs(i,j+1,k-1) * k;
    res += n;
    res /= i+j+k;
    
    return dp[i][j][k] = res;
}

int main() {
    cin >> n;
    vint ct(4);
    rep(i,n) {
        int a; cin >> a;
        ct[a]++;
    }
    rep(i,305)rep(j,305)rep(k,305) dp[i][j][k] = -1;
    printf("%.10f\n",dfs(ct[1],ct[2],ct[3]));
}

Measured memory_bytes: 221952
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#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;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
 
int main () {
    
    ll n; cin >>n;
    vector<vector<vector<ll> > > f(n, vector<vector<ll> >(5, vector<ll>(2, 0)));
    for (ll i = 0; i < n; i++) {
        for (ll j = 0; j < 5; j++) {
            for (ll k = 0; k < 2; k++) {
                cin >> f[i][j][k];
            }
        }
    }
    vector<vector<ll> > p(n, vector<ll>(11)); REP(i,n) REP(j,11) cin >> p[i][j];

    ll m = 10;
    ll res = -INFLL;
    for (ll s = 1; s < (1<<m); s++) {
        vector<ll> sum(n, 0);
        for (ll i = 0; i < n; i++) {
            for (ll j = 0; j < m; j++) {
                if (s & (1<<j)) {
                    sum[i] += f[i][j/2][j%2];
                } 
            }
        }
        ll ans = 0;
        for (ll i = 0; i < n; i++) {
            ans += p[i][sum[i]];
        }
        res = max(res, ans);
    }

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


Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int n;
    cin >> n;

    vector<vll> F(n, vll(10));
    REP(i, n) REP(j, 10) cin >> F[i][j];

    vector<vll> P(n, vll(11));
    REP(i, n) REP(j, 11) cin >> P[i][j];

    ll ans = -INF;
    FOR(i, 1, 1 << 10) {
        vector<int> cnt(n, 0);

        REP(j, 10) {
            if (i >> j & 1) {
                REP(k, n) {
                    if (F[k][j] == 1) cnt[k]++;
                }
            }
        }

        ll tmp = 0;
        REP(j, cnt.size()) {
            tmp += P[j][cnt[j]];
        }

        ans = max(ans, tmp);
    }

    print(ans);

}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  int x,t;
  cin >> x >> t;
  int ans = x-t;
  if(ans<=0) cout << "0" << endl;
  else cout << ans << endl; 
}


Measured memory_bytes: 256
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	string  s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes";
	} else {
		cout << "No";
	}

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{


    string s;
    cin>>s;

    string s_r=s;
    reverse(s_r.begin(),s_r.end());

    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)!=s_r.at(i))
            cnt++;
    }
    
    cout<<cnt/2<<endl;

    return 0;
}  




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

int main()
{
	int W,H,x,y,r;
	
	cin>>W>>H>>x>>y>>r;
	if( 0<=(x-r) && (x+r)<=W && 0<=(y-r) && (y+r)<=H ) {
		cout <<"Yes"<<endl;
	} else {
		cout <<"No"<<endl;
	} 
	 
    return 0;
}

Measured memory_bytes: 1156
#include <iostream>
using namespace std;
int main(){
  int N,K,x[101];
  int i;
  int m = 0; //move
  cin >> N >> K;
  for(i=1;i<=N;i++){
    cin >> x[i];
  }
  for(i=1;i<=N;i++){
    if(x[i]<=(K-x[i])){
      m += 2*x[i];
    }
    else{
      m += 2*(K-x[i]);
    }
  }
  cout << m;
  return 0;
}

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

int main() {
  int a;
  cin >> a;
  int a1, a10, a100;
  a1 = a % 10;
  a10 = ((a - a1) % 100)/10;
  a100 = ((a - a1 - a10) % 1000)/100;
  cout << a1 + a10 + a100 << endl;
}



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


int main() {

    double a, b;
    cin >> a >> b;
    string ans;
    if (a > b) ans = "GREATER";
    else if (a < b) ans = "LESS";
    else ans = "EQUAL";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
 
namespace ALDS1_14_D
{
    class SuffixArray
    {
        internal int[] sa, rank, tmp;
        internal string S;
        internal int n, k;
         
        public SuffixArray(string SS)
        {
            S = SS;
            n = S.Length;
            sa = new int[n + 1];
            rank = new int[n + 1];
            tmp = new int[n + 1];
            Construct_SA();
        }
         
        public int Compare_SA(int i, int j)
        {
            if(rank[i] != rank[j]) return rank[i] - rank[j];
             
            int ri = i + k  <= n ? rank[i + k] : -1;
            int rj = j + k <= n ? rank[j + k] : -1;
 
            return  ri - rj; 
        }
         
        public void Construct_SA()
        {
            for(int i = 0; i < n; i++)
            {
                sa[i] = i;
                rank[i] = S[i];
            }
            sa[n] = n; rank[n] = -1;
             
            for(k = 1; k <= n; k <<= 1)
            {
                Array.Sort(sa, Compare_SA);
                 
                int d;
                d = tmp[sa[0]] = 0;
                
                for (int i = 1; i <= n; i++)
                {
                    d = tmp[sa[i]] = d + ((Compare_SA(sa[i - 1], sa[i]) < 0) ? 1 : 0);
                }
                
                for (int i = 0; i <= n; i++)
                {
                    rank[i] = tmp[i];
                }
  
            }
        }
         
        public string Contains(string pattern)
        {
            int l = 1, r = n + 1;
            int pl = pattern.Length;
             
            while(l < r)
            {
                int m = (l + r) >> 1;
                 
                string subStr = (sa[m] + pl > n) ? S.Substring(sa[m]) : S.Substring(sa[m], pl);
                     
                int comp = subStr.CompareTo(pattern);
                if (comp == 0) return "1";
                 
                if (comp < 0) l = m + 1;
                else r = m;
            }
            return "0";
        }
    }
     
     
    class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
          
            var T = Console.ReadLine();
            var SA = new SuffixArray(T);
            var Q = int.Parse(Console.ReadLine());
  
            for (int i = 0; i < Q; i++)
            {
                var P = Console.ReadLine();
  
                Console.WriteLine(SA.Contains(P));
            }
            Console.Out.Flush();
        }
    }
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e5+111;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>n;
        vll a(n);
        ll sum=0;
        for(i=0;i<n;i++){
                cin>>a[i];
                sum+=a[i];
        }
        sort(allr(a));
        ll ans=0;
        j=0;
        if(n>1){
                ans+=a[j];
                j++;
        }
        for(i=1;i<n-1;i++,j++){
                ans+=a[j];
                i++;
                if(i+1<n){
                        ans+=a[j];
                }
        }
        cout<<ans;
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 4780
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		
		while (true) {
			int num = sc.nextInt();
			int keta = sc.nextInt();

			if (num == 0 && keta == 0) {
				return;
			}

			Map<Integer, Integer> map = new HashMap<Integer, Integer>();
			for (int i = 0;; i++) {
				if (map.containsKey(num)) {

					System.out.println(map.get(num) + " " + num + " "
							+ (i - map.get(num)));
					break;
				} else {
					map.put(num, i);
				}

				char[] array = new char[keta];
				for (int j = keta - 1; j >= 0; j--) {
					int p = 1;
					for (int k = 0; k < j; k++) {
						p *= 10;
					}

					array[keta - j - 1] = (char) ('0' + ((num / p) % 10));

				}

				char[] big = new char[keta];
				System.arraycopy(array, 0, big, 0, keta);
				Character[] big_s = new Character[keta];
				for (int j = 0; j < keta; j++) {
					big_s[j] = big[j];
				}

				char[] small = new char[keta];
				System.arraycopy(array, 0, small, 0, keta);

				Arrays.sort(small);

				Arrays.sort(big_s, Collections.reverseOrder());
				for (int j = 0; j < keta; j++) {
					big[j] = big_s[j];
				}

				int small_num = Integer.parseInt(String.valueOf(small));
				int big_num = Integer.parseInt(String.valueOf(big));

				num = big_num - small_num;

			}
		}
		
		
	}
}	

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
	string s;
	cin>>s;
	if(s=="Sunny")cout<<"Cloudy"<<endl;
	else if(s=="Cloudy")cout<<"Rainy"<<endl;
	else if(s=="Rainy")cout<<"Sunny"<<endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int n, m;
vector<vint> graph;
int col[100010];
int num[2];

bool dfs(int u, int c) {
  col[u] = c;
  num[c]++;
  for(int& v : graph[u]) {
    if(col[v] == c) return false;
    if(col[v] == -1 && !dfs(v, 1-c)) return false;
  }
  return true;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> n >> m;
  graph.resize(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  memset(col, -1, sizeof(col));
  bool flag = true;
  rep(i, n) {
    if(col[i] == -1) flag &= dfs(i, 0);
  }
  if(!flag) {
    cout << n*(n-1)/2 - m << endl;
    return 0;
  }
  cout << n*(n-1)/2 - m - (num[0]*(num[0]-1)/2) - (num[1]*(num[1]-1)/2) << endl;

  return 0;
}


Measured memory_bytes: 7424
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int n;cin>>n;
	int a[n];
	map<int,int>m;
	for(int i=0;i<n;i++) cin>>a[i],m[a[i]]++;
	sort(a,a+n);
	ll ans=0;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			// cout<<a[i] <<" "<<a[j] <<" "<< lower_bound(a+j+1,a+n,a[i]+a[j])-a<<"\n";
			// cout<<(upper_bound(a+j+1,a+n,a[i]+a[j])-a)-j-1-m[a[i]+a[j]]<<"\n";
			ans+=(upper_bound(a+j+1,a+n,a[i]+a[j])-a)-j-1-m[a[i]+a[j]];
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3740
# -*- coding: utf-8 -*-
from itertools import product, combinations
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))

N, K = inpl()
X = []
Y = []
Px = []
Py = []

for i in range(N):
    x, y = inpl()
    X.append(x)
    Y.append(y)
    Px.append((x, i))
    Py.append((y, i))

X = sorted(X)
Y = sorted(Y)

dX = {x:i for i, x in enumerate(X)}
dY = {y:i for i, y in enumerate(Y)}
Px = sorted(Px)
Py = sorted(Py)

get = itemgetter(1)
res = 5 * 10**18

for (l, r), (d, u) in product(combinations(X, 2), combinations(Y, 2)):
    if res < (r-l)*(u-d):
        continue
    if (dX[r] - dX[l] < K-1) or (dY[u] - dY[d] < K-1):
        continue

    sx = set(map(get, Px[dX[l]:dX[r]+1]))
    sy = set(map(get, Py[dY[d]:dY[u]+1]))
    if len(sx.intersection(sy)) >= K:
        res = min(res, (r-l)*(u-d))

print(res)

Measured memory_bytes: 3188
import java.io.*;
import java.util.Scanner;
class Main{
 public static void main(String[] args){
  int a,b;
  String op;
  Scanner sc= new Scanner(System.in);
  while(true){
   a=sc.nextInt();
   op=sc.next();
   b=sc.nextInt();
   if(op.equals("+"))
    System.out.println((a+b));
   else if(op.equals("-"))
    System.out.println((a-b));
   else if(op.equals("*"))
    System.out.println((a*b));
   else if(op.equals("/"))
    System.out.println((a/b));
   else if(op.equals("?"))
    break;}
 }
}


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

int main() {
  
  int N; cin >> N; int64_t ans = 0;
  
  vector<int64_t> vecA(N), vecB(N), vecC(N);
  
  for (int i = 0; i < N; i++) cin >> vecA[i];
  for (int i = 0; i < N; i++) cin >> vecB[i];
  for (int i = 0; i < N; i++) cin >> vecC[i];
  
  sort(vecA.begin(), vecA.end());
  sort(vecB.begin(), vecB.end());
  sort(vecC.begin(), vecC.end());
  
  for (int i = 0; i < N; i++) {
    
    int64_t key = vecB[i];
    
    auto itrOfvecA = lower_bound(vecA.begin(), vecA.end(), key);
    auto itrOfvecC = upper_bound(vecC.begin(), vecC.end(), key);
    
    if (itrOfvecC == vecC.end()) break;
    
    int64_t numberOfvecA = distance(vecA.begin(), itrOfvecA);
    int64_t numberOfvecC = distance(itrOfvecC, vecC.end());
    
    ans += numberOfvecA * numberOfvecC;
    
  }
  
  cout << ans << endl;
  
}

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

#define INF 100000000
#define ABS(a) (a<0?-(a):a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define REP(i,a) for(int i=0;i<a;i++) 

using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  char po[H][W];
  REP(i, H){
    REP(j, W){
      cin >> po[i][j];
    }
  }
  REP(i, W+2){
    cout << "#";
  }
  cout << endl;
  REP(i, H){
    cout << "#";
    REP(j, W){
      cout << po[i][j];
    }
    cout << "#" << endl;
  }
  REP(i, W+2){
    cout << "#";
  }
  cout << endl;

}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;
int main()
{
    int n;
    int a[100005],x=1,ans=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(int i=1; i<n; i++)
    {
        if(a[i]==a[i-1])
       {
           x=(x+1)%2;
       }
       else
       {
           ans+=x;
           x=1;

       }

    }if(x%2)
        ans++;

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


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)


int main(){
  int a,b;
  cin >> a >> b;
  if (a%2 == 1 && b%2 == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  


  return 0; 
}



Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;

 //最大公約数求める関数
auto my_gcd(auto n , auto m){
  if(n < m){
    auto tmp = n;
    n = m;
    m = tmp;
  }
  auto l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

ll at(ll hp){
	if(hp == 1){
		return 1;
	}
	else{
		ll a = at(hp/2);
	return a * 2 + 1;
	}
}


int main(){
ll H; cin >> H;
	cout << at(H) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[51][51][2510];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int x[51];
    rep(i, N) cin >> x[i];
    dp[0][0][0] = 1;
    rep(i, N) {
        rep(j, N) {
            REP(k, 0, 50*50) {
                dp[i + 1][j][k] += dp[i][j][k];
                if (k - x[i] >= 0)
                    dp[i + 1][j + 1][k] += dp[i][j][k - x[i]];
            }
        }

    }
    int ans = 0;
    rep(i, N) ans += dp[N][i + 1][(i + 1) * K];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 50304
#include <stdio.h>
#include <stdlib.h>
int A[2000000],k,*B,C[10000],n;
int main(){
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(k<=A[i])k=A[i];
  }

 
  B=malloc(sizeof(int)*n+1);

  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=0;j<n;j++){
    C[A[j]]++;
  }


  for(i=0;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }

  for(j=n-1;j>=0;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
    }
  
  for(i=1;i<=n;i++){
    if(i==n) printf("%d\n",B[i]);
    else  printf("%d ",B[i]);
  }


  return 0;
}

Measured memory_bytes: 16268
#include<stdio.h>
#include<string.h>
 main()
 {
    char s[21], tmp;
    int i, sl;
   while(scanf("%s",s)==1)

    {
    sl=strlen(s);
    for(i=0;i<sl/2;i++)
 {
    tmp=s[i];
    s[i]=s[sl-i-1];
    s[sl-i-1]=tmp;
    }
    printf("%s\n", s);
    }
return 0;
 }

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

using namespace std;

int digsum(int a){
    int dig;
    int sum = 0;
    while(a){
        dig = a % 10;
        sum += dig;
        a = a / 10;
    }
    return sum;
}
int main(){
    int n; scanf("%d",&n);
    int a = digsum(n);
    
    if(n % a == 0)
        printf("Yes\n");
    
    else
        printf("No\n");
    
    return 0;
}


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

int main() {
  int to_1, to_2, to_3, to_h;
  cin >> to_1 >> to_2 >> to_3 >> to_h;

  int sum_s = to_1 + to_2 + to_3 + to_h;
  int x = sum_s / 60;
  int y = sum_s % 60;

  cout << x << "\n" << y << endl;

  return 0;
}


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

main(int argc, char const *argv[])
{
	string l="qwertasdfgzxcvb",r="yuiophjklnm",s;
	while(cin>>s,s!="#")
	{
		bool f=0;
		for (int i = 0; i < r.size(); ++i) if(s.at(0)==r.at(i)) f=1;
		int ans=0;
		for (int i = 1; i < s.size(); ++i)
		{
			if(f)
			{
				for (int j = 0; j < l.size(); ++j)
				{
					if(s.at(i)==l.at(j))
					{
						++ans,f=0;
						break;
					}
				}
			}
			else
			{
				for (int j = 0; j < r.size(); ++j)
				{
					if(s.at(i)==r.at(j))
					{
						++ans,f=1;
						break;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int n;cin>>n;
  int t,a;cin>>t>>a;
  vector<double> hList(n);
  double mn=(double)ULONG_MAX;
  int index=0;
  REP(i,n){
    int x;cin>>x;
    double value=abs((double)t-(double)x*0.006-(double)a);
    if(value<mn){
      mn=value;
      index=i+1;
    }
  }
  cout << index << endl;
}

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

int main(){
    char c, d;
    cin >> c;
    d = tolower(c);
    
    if(c == d) cout << 'a' << endl;
    else cout << 'A' << endl;
  
}


Measured memory_bytes: 3616