akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	int N, K; cin >> N >> K;
	vector<int>H(N);
	REP(i, N)cin >> H[i];
	VSORT(H); VREVERSE(H);
	int ans = 0;
	REP(i, N) {
		if (K) {
			//ans++;
			K--;
		}
		else ans += H[i];
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 1792
#include <cstdio>

int A[20], m;

bool rec(int i, int sum, int s){
	if (i == -1 || sum == s) return sum == s;
	return rec(i - 1, sum + A[i], s) || rec(i - 1, sum, s);
}
int main(){
	int n, q;

	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}

	scanf("%d", &q);


	for (int i = 0; i < q; i++){
		scanf("%d", &m);
		if (rec(n-1, 0, m)) printf("yes\n");
		else printf("no\n");
	}

	return 0;
}

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

ans = 0
mod = 10 ** 9 + 7
a_r = list(reversed(a))
sumlist = [a_r[0]]
for i in range(1,len(a)):
  sumlist.append(sumlist[-1] + a_r[i])
sumlist.reverse()
sumlist = sumlist[1:]

for i in range(len(sumlist)):
  ans += a[i] * sumlist[i]

print(ans%mod)


Measured memory_bytes: 31560
#include <bits/stdc++.h>
using namespace std;
typedef  long long  ll;
	int mod=1e9+7;
	int dp[2000+4];
	int main() {

		#ifndef ONLINE_JUDGE
	        freopen("input.txt","r",stdin);
	        // freopen("output.txt","w",stdout);
	    #endif
	    ios::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	   	

	   	int x;
	   	cin>>x;
	   	
	   	dp[0]=1;
	  	for(int sum=0; sum<=x; sum++){
	  		for(int coin =3;coin<=sum;coin++){
	  			dp[sum]+=dp[sum-coin];
	  			dp[sum]%=mod;
	  		}
	  	}
	  	cout<<dp[x]<<endl;
	    return 0;
}



	



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

int main() {
	int A, B,kuchi=1,ans=0;
	cin >> A;
	cin >> B;
	while (kuchi<B) {
		kuchi = kuchi - 1 + A;
		ans++;
	}
	cout << ans;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

baselis = []

for _ in range(M):
    temp = [x for x in input().split()]
    baselis.append(temp)

ac = [0] * (N + 1)
wa = [0] * (N + 1)

for i in range(M):
    result = baselis[i][1]
    question = int(baselis[i][0])

    if result == 'AC' and ac[question] == 0:
        ac[question] = 1
    elif result == 'WA' and ac[question] == 0:
        wa[question] += 1

for i in range(N + 1):
    if ac[i] != 1:
        wa[i] = 0

print(sum(ac), sum(wa))

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int i = 0; i <= A; ++i) {
    for (int j = 0; j <= B; ++j) {
      for (int k = 0; k <= C; ++k) {
        int total = 500 * i + 100 * j + 50 * k;
        if (total == X) {
          ++res;
        }
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX_LENGTH 101
#define WHITE 0
#define GRAY 1
#define BLACK 2
int tm;
int discovery[MAX_LENGTH];
int finish[MAX_LENGTH];
int color[MAX_LENGTH];
int adj[MAX_LENGTH][MAX_LENGTH];
void initial(int numV, int adj[MAX_LENGTH][MAX_LENGTH])
{
    for(int i = 0;i<numV;i++)
    {
        for(int j = 0;j<numV;j++)
        {
            adj[i][j]=0;
        }
    }
}
void printTime(int numV, int discovery[], int finish[])
{
    for(int i = 0;i<numV;i++){printf("%d %d %d\n", i+1, discovery[i], finish[i]);}
}
void visit(int i, int numV)
{
    color[i] = GRAY;
    discovery[i] = ++tm;
    for(int j=0;j<numV;j++)
    {
        if(adj[i][j]==0)continue;
        if(color[j]==WHITE){visit(j, numV);}
    }
    color[i] = BLACK;
    finish[i]=++tm;
}
void DFS(int numV)
{
    for(int i = 0;i<numV;i++){color[i]=WHITE;}
    tm = 0;
    for(int i = 0;i<numV;i++)
    {
        if(color[i]==WHITE){visit(i, numV);}
    }
}
int main(){
    int numV, numA, temp, node;
    scanf("%d", &numV);
    initial(numV, adj);
    for(int i = 0;i<numV;i++)
    {
        scanf("%d", &node);
        scanf("%d", &numA);
        for(int j = 0;j<numA;j++)
        {
            scanf("%d", &temp);
            adj[i][temp-1] = 1;
        }
    }
    DFS(numV);
    printTime(numV, discovery, finish);
    return 0;
}




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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W;
    cin >> H >> W;
    rep(i, H) {
        string temp;
        cin >> temp;
        cout << temp << endl;
        cout << temp << endl;
    }
    return 0;
}


Measured memory_bytes: 3480
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DEL(v) decltype(v)().swap(v)
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define NL cerr << endl;
#define chmax(a, b) a=(((a)<(b))?(b):(a))
#define chmin(a, b) a=(((a)>(b))?(b):(a))
#define F first
#define S second
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const P<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T> ostream& operator << (ostream& s, const set<T>& st) {
   s << "{";
   for (auto i = st.begin(); i != st.end(); ++i) {
      s << *i;
      if (next(i) != st.end()) s << ", ";
   }
   s << "}";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   int N, M; cin >> N >> M;
   V<int> a(M), b(M);
   REP(i, M) {
      cin >> a[i] >> b[i];
   }

   V<P<int,int>> p(M);
   REP(i, M) {
      p[i] = MP(b[i], a[i]);
   }
   SORT(p);

   int cnt = 0, prev = -1;
   REP(i, M) {
      if (p[i].S < prev) continue;
      ++cnt; prev = p[i].F;
   }
   cout << cnt << endl;

   return 0;
}


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

int main(){
	int n,m,d,h,i,j,r,s;
	string str;
	for(;cin>>n,n;cout<<r<<endl){
		vector<int>monster(n);
		for(h=i=0;i<n;i++){
			cin>>monster[i];
			if(h<monster[i])h=monster[i];
		}
		vector<pair<int,int> >_all,_single;
		vector<int>all(h+1),single(h+1);
		for(cin>>i;i--;){
			cin>>str>>m>>str>>d;
			if(d){
				if(str=="All")_all.push_back(make_pair(m,d));
				else _single.push_back(make_pair(m,d));
			}
		}
		for(i=1;i<=h;i++){
			all[i]=9999999;
			single[i]=9999999;
			for(j=0;j<_all.size();j++){
				all[i]=min(all[i],all[max(0,i-_all[j].second)]+_all[j].first);
			}
			for(j=0;j<_single.size();j++){
				single[i]=min(single[i],single[max(0,i-_single[j].second)]+_single[j].first);
			}
		}
		if(all.empty()){
			for(r=j=0;j<monster.size();j++)r+=single[monster[j]];
		}else if(single.empty()){
			r=all[h];
		}else{
			r=9999999;
			for(i=0;i<=h;i++){
				s=all[i];
				for(j=0;j<monster.size();j++)s+=single[max(0,monster[j]-i)];
				if(r>s)r=s;
			}
		}
	}
}

Measured memory_bytes: 1968
#include<stdio.h>
int main()
{
 int a;
 int b;
 scanf("%d %d",&a,&b);
 if(a<b)
 {
     printf("a < b\n");
 }
 else if(a>b)
 {
     printf("a > b\n");
 }
 else if(a==b)
 {
     printf("a == b\n");
 }
return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> light(M);

    rep(i, M) {
        int K;
        cin >> K;
        rep(k, K) {
            int s;
            cin >> s;
            s--;
            light[i].push_back(s);
        }
    }

    vector<int> p(M);
    rep(i, M) {
        cin >> p[i];
    }

    int ans = 0;
    rep(i, pow(2, N)) {
        bool flag = true;
        rep(m, M) {
            bool isOn = (p[m] == 0);
            for (auto e : light[m]) {
                isOn = (i & (1 << e)) ? !isOn : isOn;
            }
            if (!isOn) {
                flag = false;
            }
        }
        if (flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
string s;cin>>s;
string hitachi= "";
for(int i= 1;i<= 5;i++) 
{
hitachi+= "hi";
if(hitachi==s) 
{
cout<< "Yes" <<endl;
return 0;
}
}
cout<< "No" <<endl;
return 0;
}

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

int rec(int n, int sum, int max) {
  if(sum<0) return 0;
  if(!n&&!sum) return 1;
  int ans=0;
  for(int i = max+1; i<=9; ++i)
    ans += rec(n-1, sum-i, i);
  return ans;
}

int main() {
  int n,s;
  while(cin>>n>>s, n||s) {
    cout<<rec(n,s,-1)<<endl;
  }
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a, b,c;
		a = sc.nextLong();
		b = sc.nextLong();
		c = sc.nextLong();
		if (c < a+b) {
			System.out.println("No");
			return ;
		}
		long result = c-a-b;
		result= result*result;
		if(result >4*a*b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 23124
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>

using namespace std;

int main()
{
  int x, y;
  while(true)
  {
    cin >> x >> y;
    if(!x && !y)
      break;
    if(x < y)
      cout << x	<< " " << y << endl;
    else
      cout << y	<< " " << x << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

ll solve(int u, int p, const vector<ll>& x, const vector<vector<int>>& conn){
	if(conn[u].size() == 1u){ return x[u]; }
	ll csum = 0, cmax = 0;
	for(const int v : conn[u]){
		if(v == p){ continue; }
		const ll t = solve(v, u, x, conn);
		if(t < 0){ return -1; }
		csum += t;
		cmax = max(cmax, t);
	}
	const ll y = max(0ll, cmax - (csum - cmax));
	const ll r = (csum - y) / 2;
	if(x[u] < csum - r || csum < x[u]){ return -1; }
	return csum - 2 * (csum - x[u]);
}

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> x(n);
	for(int i = 0; i < n; ++i){ cin >> x[i]; }
	vector<vector<int>> conn(n);
	for(int i = 1; i < n; ++i){
		int a, b;
		cin >> a >> b;
		--a; --b;
		conn[a].push_back(b);
		conn[b].push_back(a);
	}
	if(n == 2){
		cout << (x[0] == x[1] ? "YES" : "NO") << endl;
		return 0;
	}
	int root = 0;
	for(; root < n; ++root){
		if(conn[root].size() >= 2u){ break; }
	}
	cout << (solve(root, -1, x, conn) == 0 ? "YES" : "NO") << endl;
	return 0;
}



Measured memory_bytes: 14464
package main

import (
	"fmt"
	"strings"
)

func main() {
	s := "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
	ss := strings.Split(s, ", ")
	var K int
	fmt.Scan(&K)
	fmt.Println(ss[K-1])
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  string in;
  char list[9][6]={
    {'.',',','!','?',' ','/'},
    {'a','b','c','/','/','/'},
    {'d','e','f','/','/','/'},
    {'g','h','i','/','/','/'},
    {'j','k','l','/','/','/'},
    {'m','n','o','/','/','/'},
    {'p','q','r','s','/','/'},
    {'t','u','v','/','/','/'},
    {'w','x','y','z','/','/'}
  };
  
  int x=-1,y=-1;
  
  cin >>N;
  
  for(int i=0 ; i < N ; i++){
    
    cin >>in;
    
    for(int j=0 ; j < (int)in.size() ; j++){
      
      char in_one=in[j];
      int num=atoi(&in_one);

      if(num == 0){
	if(y != -1)cout <<list[y][x];
	y=-1;
	x=-1;
      }else{
	x++;
	if(list[y][x] == '/')x=0;
	y=num-1;
      }
      
    }
    cout <<endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1204
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		while (true) {
			int a = sc.nextInt(); int b = sc.nextInt();
			if (a==0 && b==0) return;
			System.out.println(a<b?(a+" "+b):(b+" "+a));
			
		}
		
	}
}


Measured memory_bytes: 35880
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int A,B,K;
  cin >> A >> B >> K;
  int larger,smaller;
  larger = max(A,B);
  smaller = min(A,B);
  vector<int> d;
  for(int i=1;i<=smaller;i++){
    if((larger % i == 0) && (smaller % i == 0)){
      d.push_back(i);
    }
  }
  sort(d.begin(),d.end(),greater<int>());
  cout << d[K-1] << endl;
}

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

int main() {
  int N=0,K=0;
  cin >> N >> K;

  // ここにプログラムを追記
  int x=0,Kekka=0,i=0;
  for (int i=0; i<N; i++) {
    cin >> x;
    if (abs(x-K)>x) {
      Kekka+=x*2;
    } else {
      Kekka+=abs(x-K)*2;
    }
  }
  cout << Kekka << endl;
}


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

int main()
{
    int n; cin>>n;
    vector<int> a(n); for(auto& e: a) cin>>e;

    if (n==1) return cout<<1<<endl, 0;

    int res=1, i;
    for(i=0; i+1<n && a[i+1]==a[i]; ++i);
    bool inc=a[i+1]>a[i];
    for(int i=1; i<n; ++i) {
        if (a[i]==a[i-1]) continue;
        if ((a[i]>a[i-1])==inc) continue;
        ++res;
        while (i+1<n && a[i+1]==a[i]) ++i;
        inc=a[i+1]>a[i];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 640
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = 1e18;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    REP(i, 0, N) cin >> A[i];
    REP(i, 0, N) cin >> B[i];
    REP(i, 0, N) cin >> C[i];
    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    // 解答の方針はよかったが，TLEやREしないようにするにはupperboundのSTLを活用することが大事だった…あとデバッグオプションは場合によって遅くなるらしい

    // Cのとりうる範囲内で，ある数以上になっている数の個数をカウントしてvectorに収納
    // int C_max = C[N - 1];
    // vector<int> C_upper_cnt(C_max + 1);
    // REP(i, 0, N){
    //     chmax(C_upper_cnt[C[i]], N - i);
    // }
    // int Ctmp = 0;
    // for (int i = C_max; i >= 0; --i){  // 直接C内になかった値のインデックス部分は0になってるので右側の値で埋めてやる
    //     if (!chmax(Ctmp, C_upper_cnt[i])){
    //         C_upper_cnt[i] = Ctmp;
    //     }
    // }
    vector<ll> d(N);
    REP(i, 0, N){
        d[i] = (ll)(C.size() - (upper_bound(ALL(C), B[i]) - C.begin()));
    }

    // 各Bの値について，その数以上のBを選択したときのCの候補数の総和
    // int B_max = B[N - 1];
    // vector<ll> B_upper_cnt(B_max + 1);
    // ll C_cnt = 0;
    // for (int i = N - 1; i >= 0; --i){
    //     if (B[i] + 1 > C_max) continue;
    //     C_cnt += C_upper_cnt[B[i] + 1];  //「以上」から「より大きい」に注意
    //     B_upper_cnt[B[i]] = C_cnt;
    // }
    // ll Btmp = 0;
    // for (int i = B_max; i >= 0; --i){
    //     if (!chmax(Btmp, B_upper_cnt[i])){
    //         B_upper_cnt[i] = Btmp;
    //     }
    // }
    for(int i=N-2; i>=0; i--) d[i] += d[i+1];

    ll ans = 0;
    // REP(i, 0, N){
    //     if (A[i] + 1 > B_max) break;
    //     ans += B_upper_cnt[A[i] + 1];  //「以上」から「より大きい」に注意
    // }
    REP(i, 0, N){
        int t = upper_bound(ALL(B), A[i]) - B.begin();
        if(t<N) ans += (ll)d[t];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5372
#include<iostream>
#include<cstdio>
#include<queue>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(u) for(int i=hd[u],v,w,c;v=e[i].v,w=e[i].w,c=e[i].c,i;i=e[i].n)
using namespace std;
typedef long long ll;
const int N=100100,M=N<<1;
struct edge{int n,v,w,c;}e[M];
int n,T,fl=1,x,y,c,hd[N],p[N],I[N],f[N],in[N];
ll ans,d[N];
queue<int>q;
void add_(int u,int v,int w,int c){e[++fl]={hd[u],v,w,c};hd[u]=fl;}
void adde(int u,int v,int w,int c){add_(u,v,w,c);add_(v,u,-w,0);}
bool SPFA(){
	FOR(i,2,T) d[i]=-1e15;
	q.push(1);f[1]=1e9;
	while(q.size()){
		int u=q.front();q.pop();in[u]=0;
		REP(u)if(c && d[v]<d[u]+w){
			d[v]=d[u]+w,f[v]=min(f[u],c),p[v]=u,I[v]=i;
			if(!in[v]) in[v]=1,q.push(v);
		}
	}return d[T]>=0;
}
int main(){
	scanf("%d",&n);T=2*n+6;
	FOR(i,1,n){
		scanf("%d%d%d",&x,&y,&c);
		adde(1,i+5,0,c);
		adde(i+5,2,x+y,c);adde(i+5,3,y-x,c);
		adde(i+5,4,x-y,c);adde(i+5,5,-x-y,c);
	}
	FOR(i,n+1,n*2){
		scanf("%d%d%d",&x,&y,&c);
		adde(i+5,T,0,c);
		adde(2,i+5,-x-y,c);adde(3,i+5,x-y,c);
		adde(4,i+5,y-x,c); adde(5,i+5,x+y,c);
	}
	while(SPFA())for(int u=T;u!=1;u=p[u])
		e[I[u]].c-=f[T],e[I[u]^1].c+=f[T],ans+=1ll*e[I[u]].w*f[T];
	cout<<ans<<'\n';
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
struct node
{
	 int x,y,flag;
};
bool cmp1(const node a,const node b)
{
	 return a.y<b.y;
}
bool cmp2(const node a,const node b)
{
	 return a.x<b.x;
}
int main()
{
	int t;
	scanf("%d",&t);
	vector<struct node>a,b;
	int ans=0,mj;
for(int i=0;i<t;i++)
{  int x,y;
	 scanf("%d %d",&x,&y);
	 struct node z;
	 z.x=x;
	 z.y=y;
	 z.flag=0;
	 a.push_back(z);
}
for(int i=0;i<t;i++)
{  int x,y;
	 scanf("%d %d",&x,&y);
	 struct node z;
	 z.x=x;
	 z.y=y;
	 z.flag=0;
	 b.push_back(z);
}
  sort(a.begin(),a.end(),cmp1);

  sort(b.begin(),b.end(),cmp2);
 /* printf("\n\n");
 for(int i=0;i<a.size();i++)
  printf("%d %d\n",a[i].x,a[i].y);
  printf("\n\n");
for(int i=0;i<b.size();i++)
 printf("%d %d\n",b[i].x,b[i].y);
 */
  for(int i=0;i<t;i++)
  {int flag=0;
  	for(int j=0;j<t;j++)
  	 {
  	 	 if(a[j].x<b[i].x&&a[j].y<b[i].y)
  	 	   {
  	 	   	 
  	 	   	if(a[j].flag==0)
  	 	   	{
  	 	   		flag=1;
  	 	   		mj=j;
				  }
  	 	   	  // printf("%d %d %d %d\n",a[i].x,a[i].y,b[j].x,b[j].y);
  	 	   	  
  	 	   	 
			  }
	   }
	   if(flag)
	   {
	   	ans++;
	   	a[mj].flag=1;
	   }
  }
  cout<<ans;
 } 


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

int main(){
	int n, r;
	cin >> n >> r;
	if(n <= 10){
		cout << r + 100*(10 - n) << endl;
	}else{
		cout << r << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[45][403][406];
int a[45],b[45],c[45];
int Ma,Mb;
int n;
#define inf 100000000
int call(int i,int x,int y)
{
//    cout<<i<<" "<<x<<" "<<y<<endl;
    if(x>0&&y>0)
    {
        int gc=__gcd(x,y);
        if(x/gc==Ma&&y/gc==Mb)return 0;
    }
    if(i==n)return inf;
    if(dp[i][x][y]!=-1)return dp[i][x][y];
    int inc=inf,exc=inf;
    int ans=min(c[i]+call(i+1,x+a[i],y+b[i]),call(i+1,x,y));
    return dp[i][x][y]=ans;
}

int main()
{
    cin>>n>>Ma>>Mb;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    int ans=call(0,0,0);
    if(ans>=inf)cout<<-1<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 29056
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2)
{
    sort(ALL(v1));
    sort(ALL(v2),greater<T>());
    return v1 == v2;
}
   
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

int main(){
    ll a,b,c,d,x,y,z,n,m,k,l,w,sum=100000,sum2=0,ans=0;
    string s,t;
    bool ok=true;
    cin >> a >> b >> c >> k;
    if(abs(a-b) > 1e18){
        cout << "Unfair" << endl;
    }

    if(k%2==0){
        cout << a-b << endl;
    }
    else{
        cout << b-a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less   
using namespace __gnu_pbds;  
using namespace std;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> set1;
ll find(ll a,ll p[])
{
   //cout<<"find "<<a<<endl;
   if(a==p[a])
   return a;
   else return p[a]=find(p[a],p);

}
void join(ll a,ll b,ll p[],ll sz[])
{
   a=find(a,p);
   b=find(b,p);
   if(a!=b)
   {
      if(sz[a]<sz[b])
      swap(a,b);
      sz[a]+=sz[b];
      p[b]=a;
   }
}
ll power(ll a,ll b,ll mod)
{
   ll res=1;
   while(b>0)
   {
      if(b&1)
      res=(res*a)%mod;
      b=b/2;
      a=(a*a)%mod;
   }
   return res;
}
ll inverse(ll x, ll p)
{
   return power(x,p-2,p);
}
ll hash1(ll x,ll y)
{
   return x+y+x*y;
}
ll f[200000]={0};
ll mod=1000000007;
void ini()
{
   f[0]=1;
   for(ll i=1;i<=200000;i++)
   f[i]=(i*f[i-1])%mod;
}



ll ncr(ll n,ll r)
{
   ll res=1;
   ll k=f[n];
   ll v=inverse(f[n-r],mod);
   ll u=inverse(f[r],mod);
   ll x=(u*v)%mod;
   k=(k*x)%mod;
   return k;
}
int main()
{
   ll n,k;
   cin>>n>>k;
   ll a[n];
   for(ll i=0;i<n;i++)
   cin>>a[i];
   ll dp[n][k+1];
   for(ll i=0;i<n;i++)
   {
      for(ll j=0;j<=k;j++)
      dp[i][j]=0;
     // cout<<endl;
   }
   for(ll i=0;i<=a[0];i++)
   dp[0][i]=1;
   for(ll i=1;i<n;i++)
   {
      for(ll j=0;j<=k;j++)
      {
         dp[i][j]=dp[i-1][j];
         if(j>0)
         dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
         ll x=j-a[i]-1;
         if(x>=0)
         dp[i][j]=(dp[i][j]-dp[i-1][x])%mod;
         if(dp[i][j]<0)
         dp[i][j]=(dp[i][j]+mod)%mod;
      }
   }
 /*  for(ll i=0;i<n;i++)
   {
      for(ll j=0;j<=k;j++)
      cout<<dp[i][j]<<" ";
      cout<<endl;
   }*/
   cout<<dp[n-1][k]<<endl;
   return 0;
}


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

typedef vector<vector<int>> mat;

int n, m;

bool isChange(int &from, int &to, mat &g) {
    auto s = g[from];
    auto t = g[to];
    if (s.size() == 0) return false;
    if (t.size() > 0 && t[t.size() - 1] > s[s.size() - 1]) return false;
    t.push_back(s[s.size() - 1]);
    s.erase(s.begin() + s.size() - 1);
    g[from] = s;
    g[to] = t;

    return true;
}


bool change(int &now, int &pre, mat &g) {
    vector<int> from = {0, 1, 1, 2};
    vector<int> to = {1, 2, 0, 1};
    for (int i = 0; i < 4; i++) {
        if (to[i] == pre && from[i] == now) continue;
        if (isChange(from[i], to[i], g)) {
            now = to[i];
            pre = from[i];

            return true;
        }
    }

    return false;
}

int main() {
    while (cin >> n >> m, n || m) {
        mat v(3);
        for (auto &i : v) {
            int c; cin >> c;
            for (int j = 0; j < c; j++) {
                int x; cin >> x;
                i.push_back(x);
            }
        }


        mat g1(3), g2(3);
        for (int i = 1; i <= n; i++) {
            g1[0].push_back(i);
            g2[2].push_back(i);
        }

        int res = 1 << 28;
        vector<int> now = {0, 1, 1, 2};
        vector<int> pre = {1, 0, 2, 1};
        for (int i = 0; i < 4; i++) {
            int tmp = 0;
            auto g(v);
            while (tmp <= m) {
                if (g[0].size() == n || g[2].size() == n) break;
                if (!change(now[i], pre[i], g)) {
                    tmp = 1 << 28;
                    break;
                }
                tmp++;
            }
            res = min(res, tmp);
        }

        cout << (res > m ? -1 : res) << endl;
    }
}

Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()


int main(int argc, char const *argv[])
{
    string s;
    cin >> s;

    if (s.back() == 's')
    {
        cout << s + "es" << endl;
    }
    else
    {
        cout << s + "s" << endl;
    }
}

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

using ll=long long;



void solve(){
    string s;
    cin>>s;
    sort(s.begin(), s.end());
    if(s=="abc"){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define rep1(i,s,e) for(int i=s;i<e;i++)
#define rep2(i,s,e,c) for(int i=s;i>=e;i--)
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define pfn() printf("\n")
#define pfs() printf(" ")
#define sfi(x) scanf("%d",&x)
#define sfi1(x,y) scanf("%d%d",&x,&y)
#define sff(x) scanf("%lf",&x)
#define sfl(x) scanf("%lld",&x)
#define memset1(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
const int MAX = 1e4 + 50;
const int mod = 996873654;
double arr[105];
int main(){
	int n;
	sfi(n);
	double sum=0;
	rep(i,1,n){
		scanf("%lf",&arr[i]);
		sum+=1./arr[i];
	}
	sum=1./sum;
	printf("%.8lf",sum);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <vector>
//#include <string>

using namespace std;

// ostream & operator<<(ostream & os, const vector<string> & v)
// {
// 	for (auto e : v)
// 		os << e << " ";
// 	return os;
// }

int main()
{
	int A, B;
	cin >> A >> B;
	if (A >= 1 && A <= 9 && B >= 1 && B <= 9)
		cout << (A * B) << endl;
	else 
		cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: chars
    }
    for i in 0..s.len() {
        if i % 2 == 0 && s[i] == 'L' || i % 2 == 1 && s[i] == 'R' {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define SG getchar()
#define C count
#define W wgbh
using namespace std;
set<char> W;
signed main()
{
	char c;
	while((c=SG)!=10){W.insert(c);}
	puts(((((W.C('N'))&&(!(W.C('S'))))||((W.C('S'))&&(!(W.C('N'))))||((W.C('W'))&&(!(W.C('E'))))||((W.C('E'))&&(!(W.C('W')))))?("No"):("Yes")));
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;


int main() {
  int r, g, b, n, ans=0, tmp;
  
  cin >> r >> g >> b >> n;
  
  if(r<g) {
    tmp = r;
    r = g;
    g = tmp;
  }
  if(r<b) {
    tmp = r;
    r = b;
    b = tmp;
  }
  
  if(g<b) {
    tmp = g;
    g = b;
    b = tmp;
  }
  

  for (int i=0; i<=n/r; i++) {
    for (int j=0; j<=(n-r*i)/g; j++) {
      if((n-r*i-g*j)%b==0) ans++;

    }
  }
  
  cout << ans <<endl;
}

Measured memory_bytes: 256
N = gets.to_i

ans = 0

d = 1
while d*d <= N
  if N % d == 0
    e = N / d
    if e > 1
      m = e - 1
      x = d
      if m > x
        ans += m
      end
    end
    if d > 1
      m = d - 1
      x = e
      if m > x
        ans += m
      end
    end
  end
  d += 1
end
  
puts ans


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    int n; cin >> n;
    ll ans = 0;
    for (int c = 1; n - c >= 1; c++) {
        for (int a = 1; a*a <= n - c; a++) if ((n-c) % a == 0 && (n-c) / a >= 1) {
            if (a*a == n - c) ans++;
            else ans += 2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(a<c && c<b){
      System.out.println("Yes");
    }else if(a>c && c>b){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 22740
#include <stdio.h>
int main() {
	long int n,i;
	scanf("%ld",&n);
	long int h[100000];
	for(i=0;i<n;i++){
		scanf("%ld",&h[i]);
	}
	for(i=0;i<n-1;i++){
		if(h[i]<h[i+1]){
			h[i+1]-=1;
		}
	}
	for(i=0;i<n-1;i++){
		if(h[i]>h[i+1]){
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 896
"use strict"

function Main(input) {
  let dataList = input.split("\n");
  dataList.shift();
  dataList.pop();
  let restaurants = dataList.map((data, index) => {
    const tmp = data.split(" ")
    return { index: index + 1, city: tmp[0], score: parseInt(tmp[1]) }
  });
  restaurants.sort(function(a, b) {
    if (a.city < b.city) return -1
    if (a.city > b.city) return 1
    if (a.score < b.score) return 1
    if (a.score > b.score) return -1
  });
  restaurants.forEach(restaurant => {
    console.log(restaurant.index);
  });
}

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


Measured memory_bytes: 7500
/*
 * Hit and Blow
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0 0")) {

			int hit = 0, blow = 0;

			int[] nums = new int[10];
			char[] r = line.substring(0, 4).toCharArray();
			char[] a = line.substring(5).toCharArray();

			for (int i = 0; i < 4; i++) {
				if (r[i] == a[i]) {
					hit++;
					continue;
				}
				nums[r[i] - '0']++;
				nums[a[i] - '0']++;
			}
			for (int i = 0; i < 10; i++) {
				if (nums[i] > 1) {
					blow++;
				}
			}

			System.out.println(hit + " " + blow);
		}

	}
}

Measured memory_bytes: 27160
# include<stdio.h>
     
    int main(void){
      int n;
      scanf("%d", &n);
      int i;
      int a[n];
      int sum = 0;
      for(i=0;i<n;i++){
        scanf("%d", &a[i]);
      }
      sum = a[0];
      for(i=1;i<n;i++){
        sum = sum^a[i];
      }
      if(sum == 0){
        printf("Yes");
      }else{
        printf("No");
      }
    }

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

//約数列挙 O(n**1/2)
vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    return res;
}

int main(){
    ll N;
    cin >> N;

    auto div = divisor(N);

    ll ans = 0;
    for(auto q : div){
        ll n = N / q;
        if(q+1 >= n) continue;
        //cout << q << endl;
        if(n > 0) n--;
        ans += n;
    }

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std ;
int main(){
    int a , b ;
    cin >> a >> b ;
    if ( a + b == 15 ) cout << "+" << endl ;
    else
     if ( a * b == 15 ) cout << "*" << endl ;
     else cout << "x" << endl ;
    return 0 ;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String ans = "No";
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (sc.nextInt() == sc.nextInt()) {
        cnt++;
      } else {
        cnt = 0;
      }
      if (cnt >= 3) {
        ans = "Yes";
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35912
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
 //   #ifndef ONLINE_JUDGE
   //     freopen("input.txt", "r", stdin);
     //   freopen("output.txt", "w", stdout);
   // #endif
    lli a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e;
    cin>>k; 
  //  cout<<k<<" "<<e<<a<<endl;
    if(k>=e-a)cout<<"Yay!";
    else cout<<":(";


 	return 0;
 }

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define SENTINEL 2000000000
typedef long long ll;

using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;

int n, k = -1;

void CountingSort(int a[], int b[], int k) {
    int c[k + 1] = {};
    for (int j = 0; j < n; j++) c[a[j]]++;
    for (int i = 0; i < k + 1; i++) {
        c[i + 1] += c[i];
        // cout << c[i] << endl;
    }
    for (int j = n - 1; j >= 0; j--) {
        b[c[a[j]] - 1] = a[j];
        c[a[j]]--;
    }
    for (int i = 0; i < n; i++) {
        cout << b[i];
        if (i != n - 1)
            cout << " ";
        else
            cout << endl;
    }
}

int main() {
    cin >> n;
    int a[n], b[n];
    rep(i, n) {
        cin >> a[i];
        k = max(k, a[i]);
    }
    CountingSort(a, b, k);
}


Measured memory_bytes: 18772
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

int N,M;
int a[1050], b[1050], c[1050][15];

void input(){
    cin >> N >> M;
    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i];
        for(int j=0; j<b[i]; j++){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
}

void solve(){
    input();
    int inf=100000000;
    vector<int> dp(5000, inf);
    dp[0]=0;
    for(int key=0; key<M; key++){
        int flag=0;
        for(int i=0; i<b[key]; i++){
            flag|=(1<<c[key][i]);
        }
        for(int n=0; n< (1<<N); n++){
            int tmp=flag|n;
            dp[tmp]=min(dp[n]+a[key], dp[tmp]);
        }
    }
    if(dp[(1<<N)-1]==inf) dp[(1<<N)-1]=-1;
    cout << dp[(1<<N)-1] << endl;

    return;
}

int main()
{
    solve();

    

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#define maxn 101
#define maxk 100001
#define int long long
using namespace std;
const int mod = 1000000007;
int arr[maxn], dp[maxn][maxk], pre[maxn][maxk];
main() {
	ios::sync_with_stdio(false);
	//   sync_with_YinHsuan(true);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for ( int i=1; i<=n; ++i )	cin >> arr[i];
	dp[0][0] = pre[0][0] = 1;
	for ( int i=1; i<=k; ++i )	pre[0][i] = 1; // dp[0][i] = 0
	for ( int i=1; i<=n; ++i ) {
		dp[i][0] = pre[i][0] = pre[i-1][0];
		for ( int j=1; j<=arr[i]; ++j ) {
			dp[i][j] = pre[i-1][j];
			pre[i][j] = (pre[i][j-1] + dp[i][j])%mod;
		}
		for ( int j=arr[i]+1; j<=k; ++j ) {
			dp[i][j] = (pre[i-1][j] - pre[i-1][j-arr[i]-1] + mod)%mod;
			pre[i][j] = (pre[i][j-1] + dp[i][j])%mod;
		}
	}
	cout << dp[n][k] << '\n';
	return 0;
}

Measured memory_bytes: 158080
main = do
 [sx,sy,tx,ty] <- map read . words <$> getLine
 putStrLn $ back_forth (sx,sy) (tx,ty)

back_forth (sx,sy) (tx,ty) = first ++ second
  where
   first = u dy ++ r dx ++ u 1 ++ l (dx+1) ++ d (dy+1) ++ r 1
   second = r dx ++ u dy ++ r 1 ++ d (dy+1) ++ l (dx+1) ++ u 1
   dx = tx - sx
   dy = ty - sy

u n = replicate n 'U'
d n = replicate n 'D'
l n = replicate n 'L'
r n = replicate n 'R'

Measured memory_bytes: 1020
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
const MOD: u64 = 1000000007;


fn main() {
    input!{
        N: usize,
    }
    println!("{}", N*(N+1)/2);
}

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

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

string s;
int cnt=0,k;

void fun(vi cur,int len){
	cnt++;
	if(k==cnt){
		fr(i,0,len){
			cout<<s[cur[0]+i];
		}
		exit(0);
	}
	vi temp;
	fr(i,0,26){
		temp.clear();
		fr(j,0,cur.size()){
			if(cur[j]+len<s.size() && s[cur[j]+len]-'a'==i){
				// cout<<"fsdf"<<endl;
				temp.pb(cur[j]);
			}
		}
		if(temp.size()!=0){
			fun(temp,len+1);
		}
	}
}

void solve(){
	cin>>s;
	cin>>k;
	vi cur;
	fr(i,0,26){
		cur.clear();
		fr(j,0,s.size()){
			if(s[j]-'a'==i){
				cur.pb(j);
			}
		}
		if(cur.size()!=0){
			fun(cur,1);
		}
	}
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 3704