akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = scanner.nextInt();
        }
        boolean[] dp = new boolean[k+1];
        dp[0] = false;
        for(int i = 1; i <= k; i++){
            for(int j = 0; j < n; j++){
                if(i < a[j]){
                    break;
                }else{
                    dp[i] = !dp[i - a[j]];
                    if(dp[i])
                        break;
                }
            }
        }
        System.out.println(dp[k] ? "First" : "Second");
    }
}


Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
int N, A, B;
vector<int> X;
//int dp[100000];
//int solve(int i) {
//  if(i >= N - 1) return 0;
//  int &res = dp[i];
//  if(res != -1) return res;
//  res = A * (X[i + 1] - X[i]) + solve(i + 1);
//  for(int j = i + 2; j < N; ++j) {
//    int t = B + A * (X[j] - X[i + 1]);
//    if(j < N - 1) {
//      t += B + solve(j + 1);
//    }
//    res = min(res, t);
//  }
//  return res;
//}
signed main() {
  cin >> N >> A >> B;
  X.resize(N);
  REP(i, N) cin >> X[i];
  //memset(dp, -1, sizeof(dp));
  //cout << solve(0) << endl;
  int ans = 0;
  REP(i, N - 1) {
    ans += min(A*(X[i+1] - X[i]), B);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;
#define pp pair<ll,ll>
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    int n,k;
    cin>>n>>k;
    ll ans=INT64_MAX;
    ll a[n];
    REP(i,n)cin>>a[i];
    for(int i=0;i<=n-k;i++)
    {
        ans=min(ans,min(abs(a[i]),abs(a[i+k-1]))+abs(a[i+k-1] - a[i]));
    }
    cout<<ans;
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

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

int main () {
    long long n;
    std::cin >> n;
    std::vector<long long> a;
    a.push_back(__LONG_LONG_MAX__);
    int i = 1;
    while (i <= n / i)
    {
        if(n%i == 0) {
            a.push_back(i + n / i - 2);
        }
        i++;
    }

    std::cout << *min_element(a.begin(), a.end()) << "\n";
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
ans = 0
flag = True
while True:
  for i in range(N):
    if A[i] % pow(2, ans+1) != 0:
      flag = False
      break
  if flag == True:
    ans += 1
  else:
    break
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<ctype.h>
#include<cstdio>
#include<algorithm>
using namespace std;
inline long long read(){
	long long x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
int main() {
    long long a=read(),b=read(),c=read();
    if(a&1 && b&1 && c&1)printf("%lld\n",min(min(a*b,a*c),b*c));
    else printf("0\n");
    return 0;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, k := nextInt(), nextInt()

	if (n-1)*(n-2)/2 < k {
		puts(-1)
		return
	}

	ans := make([][2]int, 0)
	for i := 2; i <= n; i++ {
		ans = append(ans, [2]int{1, i})
	}
	d := (n-1)*(n-2)/2 - k
	for i := 2; d > 0; i++ {
		for j := 1; j <= n-i && d > 0; j, d = j+1, d-1 {
			ans = append(ans, [2]int{i, i + j})
		}
	}

	puts(len(ans))
	for i := range ans {
		puts(ans[i][0], ans[i][1])
	}
}


Measured memory_bytes: 1152
#include <cstdio>
#include <queue>
using namespace std;

int main(void)
{
	priority_queue <int> w, k;
	int tmp;
	
	for (int i = 0; i < 10; i++){
		scanf("%d", &tmp);
		w.push(tmp);
	}
	for (int i = 0; i < 10; i++){
		scanf("%d", &tmp);
		k.push(tmp);
	}
	
	int sumw = 0, sumk = 0;
	for (int i = 0; i < 3; i++){
		sumw += w.top();
		w.pop();
		sumk += k.top();
		k.pop();
	}
	
	printf("%d %d\n", sumw, sumk);
	
	return (0);
}

Measured memory_bytes: 0
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;

#define rep(i,n)   for (int i = 0; i < (n); i++)
#define rrep(i,n)  for (int i = (n)-1; i >= 0; i--)
#define rep1(i,n)  for (int i = 1; i <= (n); i++)
#define rrep1(i,n) for (int i = (n); i > 0; i--)

ll n, k, q;
int score[100000];
int main(void) {
    cin >> n >> k >> q;
    rep(i,q) {
        int x;
        cin >> x;
        score[x-1]++;
    }
    rep(i,n) {
        if (k-q+score[i] > 0) puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))

A_n = [0] * (N + 1)
for i in range(1, N):
    A_n[i] = abs(A[i] - A[i - 1])
A_n[0] = abs(A[0] - 0)
A_n[N] = abs(A[N - 1] - 0)

A_total = sum(A_n)
A_added = [0] + A + [0]
for i in range(1, N + 1):
    if A_added[i + 1] >= A_added[i] and A_added[i] >= A_added[i - 1]:
        print(A_total)
    elif A_added[i + 1] >= A_added[i - 1] and A_added[i - 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i] >= A_added[i + 1] and A_added[i + 1] >= A_added[i - 1]:
        print(A_total - 2 * abs(A_added[i + 1] - A_added[i]))
    elif A_added[i] >= A_added[i - 1] and A_added[i - 1] >= A_added[i + 1]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i - 1] >= A_added[i] and A_added[i] >= A_added[i + 1]:
        print(A_total)
    elif A_added[i - 1] >= A_added[i + 1] and A_added[i + 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i + 1]))
    else:
        print(0)

Measured memory_bytes: 13928
// diverta2019_2_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    vector<P> points(N);
    REP(i, N) cin >> points[i].first >> points[i].second;
    sort(ALL(points));

    int ans = INF;
    REP(i, N) REP(j, N){

        int p = points[j].first - points[i].first;
        int q = points[j].second - points[i].second;

        vector<bool> used(N, false);

        int count = 0;
        REP(k, N){
            if (used[k]) continue;
            count++;

            int a = points[k].first;
            int b = points[k].second;
            used[k] = true;

            REP(l, N){
                if (points[l].first == a + p && points[l].second == b + q) {
                    used[l] = true;
                    a += p;
                    b += q;
                }
            }
        }
        ans = min(ans, count);
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt[4]={0};
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        char str[5];
        scanf("%s",str);
        cnt[0]+=(*str=='A');
        cnt[1]+=(*str=='W');
        cnt[2]+=(*str=='T');
        cnt[3]+=(*str=='R');
    }
    printf("AC x %d\n",cnt[0]);
    printf("WA x %d\n",cnt[1]);
    printf("TLE x %d\n",cnt[2]);
    printf("RE x %d\n",cnt[3]);
    return 0;
}


Measured memory_bytes: 3824
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

vector< vector<int> > V;

int main () {
  int N, T;
  cin >> N >> T;
  int A[100010];
  for (auto i = 0; i < N; i++) {
    cin >> A[i];
  }
  multiset<int> S;
  for (auto i = 0; i < N; i++) {
    S.insert(A[i]);
  }
  int income = 0;
  for (auto i = 0; i < N; i++) {
    auto x = S.end();
    x--;
    int y = *x;
    income = max(income, y - A[i]);
    S.erase(S.find(A[i]));
  }
  reverse(A, A+N);
  set<int> SS;
  int ans = 0;
  for (auto i = 0; i < N; i++) {
    if (SS.find(A[i]+income) == SS.end()) {
      //
    } else {
      ans++;
    }
    SS.insert(A[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 5376
#include <iostream>

using namespace std;

int main()
{
    long long h,w,s;
    cin >> h >> w;
    s = h*w/2;
    if(h*w%2 == 1) s++;
    if(h==1 || w==1) s=1;
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

const int dh[2] = {0,-0};
const int dw[2] = {1,-1};

int main(){
  int H,W,K; cin >> H >> W >> K;
  vector<vector<char>> s(H,vector<char>(W));
  vector<pii> itigo;
  rep(h, H) rep(w, W){
    cin >> s[h][w];
    if(s[h][w] == '#') itigo.pb(mp(h,w));
  }

  vvi a(H, vi(W, -1));

  rep(i, K){
    int h = itigo[i].first;
    int w = itigo[i].second;
    a[h][w] = i+1;
  }

  rep(i, K){
    int h = itigo[i].first;
    int w = itigo[i].second;
    rep(dir, 2){
      int nw = w + dw[dir];
      while (0 <= nw && nw < W && a[h][nw] == -1) {
        a[h][nw] = i+1;
        nw += dw[dir];
      }
    }
  }

  rep(h, H) rep(w, W){
    if(a[h][w] == -1 && h-1 >= 0){
      a[h][w] = a[h-1][w];
    }
  }
  for (int h = H-1; h >= 0; h--) for (int w = W-1; w >= 0; w--) {
    if(a[h][w] == -1 && h+1 < H){
      a[h][w] = a[h+1][w];
    }
  }
  rep(h, H) rep(w, W){
    if(w < W-1) printf("%d ", a[h][w]);
    else printf("%d\n", a[h][w]);
  }
}


Measured memory_bytes: 1908
import Data.List

main :: IO ()
main = do
  n <- getInt
  print $ countIf ((== 8) . length . divisors) [1,3..n]

divisors :: Int -> [Int]
divisors n = concat [nub [x, n `div` x] | x <- takeWhile (\x -> x * x <= n) [1..], n `mod` x == 0]

getInt :: IO Int
getInt = read <$> getLine

countIf :: (a -> Bool) -> [a] -> Int
countIf f = length . filter f


Measured memory_bytes: 508
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n, m;
	vector<int> move(3);
	cin >> n >> m >> move[0] >> move[1] >> move[2];
	SORT(move);
	vector<vector<int>> route(n + 1);

	REP(i, m){
		int a, b;
		cin >> a >> b;
		route[a].push_back(b);
	}
	int ans = -1;
	vector<vector<vector<bool>>> step(n + 1, vector<vector<bool>>(n + 1, vector<bool>(3, false)));
	FOR(i, 1, n){
		vector<int> now;
		now.push_back(i);
		REP(j, move[2]){
			int ns = now.size();
			vector<int> now2;
			set<int> si;
			REP(k, ns){
				REP(l, route[now[k]].size()){
					if (si.find(route[now[k]][l]) == si.end()){
						now2.push_back(route[now[k]][l]);
						si.insert(route[now[k]][l]);
					}
				}
			}
			now = now2;
			if (j == move[0] - 1)
				REP(k, now.size())
				step[i][now[k]][0] = true;
			if (j == move[1] - 1)
				REP(k, now.size())
				step[i][now[k]][1] = true;
			if (j == move[2] - 1)
				REP(k, now.size())
				step[i][now[k]][2] = true;
		}
	}
	vector<vector<int>> goalto(n+1,vector<int>(3,10000));
	goalto[n][0] = 0;
	goalto[n][1] = 0;
	goalto[n][2] = 0;
	queue<pair<int,int>> qii;
	qii.push({ 0,n });
	while (!qii.empty()){
		pair<int,int> num = qii.front(); qii.pop();
		REP(i,n){
			REP(j,3){
				if (step[i][num.second][j]){
					if (goalto[i][j] ==10000){
						goalto[i][j] = num.first + 1;
						if (goalto[i][0] != 10000 && goalto[i][1] != 10000 && goalto[i][2] != 10000){
							qii.push({ max(goalto[i][0], max(goalto[i][1], goalto[i][2])), i });
						}
					}
				}
			}
		}
	}

	REP(i,3){
		if (goalto[1][i] == 10000){
			ans = -1;
			break;
		}
		ans = max(ans, goalto[1][i]);
	}
	if (ans != -1)
		cout << ans << endl;
	else
		cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 3360
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
int n;
char s[100005];
int main(void){
    cin>>s;
    n=strlen(s);
    if(s[0]==s[n-1]){
        if(n%2)cout<<"Second\n";
        else cout<<"First\n";
    }else{
        if(n%2)cout<<"First\n";
        else cout<<"Second\n";
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int H,W,K;
vector<string> C;
void input(){
    fast_io();
    cin >> H >> W >> K;
    for (int i = 0; i < H; i++)
    {
        string s; cin >> s;
        C.push_back(s);
    }   
}

int cnt(int bitH, int bitW){
    int ret = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(C[i][j]=='#' && (bitH>>i)&1 && (bitW>>j)&1) ret++;
        }
    }
    return ret;
}

int solve(){
    int ans = 0;
    for (int bitH = 0; bitH < (1<<H); bitH++)
    {
        for (int bitW = 0; bitW < (1<<W); bitW++)
        {
            if(cnt(bitH,bitW)==K) ans++;
        }
    }
    cout << ans << endl;    
    return 0;
}   

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

Measured memory_bytes: 3656
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    int a, b, x, y;
    double angle;
    double r2d = 45.0 / atan(1.0);
    cin >> a >> b >> x;
    y = a * a * b - x;
    if (x >= y)
    {
        angle = atan((double)(2.0 * y / a / a / a)) * r2d;
    }
    else
    {
        angle = 90.0 - atan((double)(2.0 * x / a / b / b)) * r2d;
    }
    printf("%.10f\n", angle);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
//const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}



int main() {
    int n,m;cin>>n>>m;
    
    vector<pii> p(m);
    rep(i,m){
        cin>>p[i].second>>p[i].first;
    }
    sort(all(p));
    
    int pre = -1;
    int cnt=0;
    rep(i,m){
        if(pre>p[i].second)continue;
        cnt++;
        pre=p[i].first;
    }
    
    cout<<cnt<<endl;
    
    return 0;
}



Measured memory_bytes: 1024
import sys

N = int(input())
X = [int(x) for x in input().split()]

ret = sys.maxsize

# for i in range(min(X) , max(X)):
for i in range(1, 100):
    pow = 0
    for x in X:
        pow += (x - i) ** 2
    if pow < ret:
        ret = pow

print(ret)

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

int main(){
  int n, a;
  string ans = "hon";
  cin >> n;
  a = n % 10;
  if(a == 3){
    ans = "bon";
  }
  else if(a == 0 || a == 1 || a == 6 || a == 8){
    ans = "pon";
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>

using namespace std;

class Solution {
public:
	/* time: O(1), space: O(1) */
	string weatherPrediction(const string& s) {
		if (s == "Sunny")
			return "Cloudy";
		if (s == "Cloudy")
			return "Rainy";
		return "Sunny";
	}
};

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

	Solution sol;
	string ans = sol.weatherPrediction(s);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String line = null;
			while ((line = br.readLine()) != null) {
				String[] s = line.split(" ");
				int [] ii = new int[s.length];
				for (int i = 0; i < s.length; i++) {
					ii[i] = Integer.parseInt(s[i]);
				}
				Arrays.sort(ii);
				for (int i = ii.length - 1; i >= 0; i--) {
					System.out.print(ii[i] + ((i != 0) ? " " : ""));
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 24184
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int check(int start, int x, long **bit)
{
    for (int i = 0; i < 20; i++)
        if (bit[x][i] - bit[start][i] >= 2)
            return 0;
    return 1;
}

int bisect(int start, int x, int y, long **bit)
{
    if (y - x == 1)
        return x;
    int mid = (y - x) / 2 + x;
    if (check(start, mid, bit))
        return bisect(start, mid, y, bit);
    else
        return bisect(start, x, mid, bit);
}


int main(void)
{
    int N;
    scanf("%d", &N);
    long *L = (long *) malloc(N * sizeof(long));
    for (int i = 0; i < N; i++)
        scanf("%ld", &L[i]);
    long **bit = (long **) malloc((N + 1) * sizeof(long *));
    for (int i = 0; i < N + 1; i++)
        bit[i] = (long *) calloc(20, sizeof(long));

    for (int j = 0; j < N; j++)
        for (int i = 0; i < 20; i++)
            bit[j + 1][i] = (L[j] >> i) & 1;
    for (int j = 1; j < N; j++)
        for (int i = 0; i < 20; i++)
            bit[j + 1][i] += bit[j][i];

    long cnt = 0;

    for (int i = 0; i < N; i++)
        cnt += bisect(i, i, N + 1, bit) - i;
    printf("%ld\n", cnt);
}


Measured memory_bytes: 37632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (1LL<<59)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int sx = 0;
	if(k >= a)
	{
		sx += a;
		k -= a;
	}
	else
	{
		sx += k;
		k = 0;
	}
	if(k >= b)
	k -= b;
	else k = 0;
	if(k >= c)
	{
		sx -= c;
		k -= c;
	}
	else
	{
		sx -= k;
		k = 0;
	}
	cout<<sx<<"\n";
	return;
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = MAP()
print(max(C-(A-B), 0))

Measured memory_bytes: 5328
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=201234;

int n,nw,nw2;
ll k,res,a[64][51][51],b[64][51];

void ksm(ll k)
{
    while(k)
    {
        if(k&1)
        {
            ++nw2;
            for(int i=1; i<=n; ++i)
            {
                for(int k=1; k<=n; ++k)
                {
                    b[nw2][i]+=b[nw2-1][k]*a[nw][k][i];
                    b[nw2][i]%=MOD;
                }
            }
        }
        k>>=1;
        ++nw;
        for(int i=1; i<=n; ++i)
        {
            for(int j=1; j<=n; ++j)
            {
                for(int k=1; k<=n; ++k)
                {
                    a[nw][i][j]+=a[nw-1][i][k]*a[nw-1][k][j];
                    a[nw][i][j]%=MOD;
                }
            }
        }
    }
}

int main()
{
    scanf("%d %lld",&n,&k);
    for(int i=1; i<=n; ++i)
    {
        for(int j=1; j<=n; ++j)
            scanf("%lld",&a[nw][i][j]);
        b[nw2][i]=1;
    }
    ksm(k);
    for(int i=1; i<=n; ++i)
        res=(res+b[nw2][i])%MOD;
    printf("%lld",res);
    return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
int main(void)
{
    int n,x,y,b,p,i,k,s,m,r,j;
	scanf("%d",&n);
	for (i=0;i<n;i++){
	    scanf("%d %d",&x,&y);
		scanf("%d %d",&b,&p);
		k=x*b+y*p;
		m=x*5+y*p-(x*2/10)*5-(y*2/10)*p;
		r=x*b+y*2-(x*2/10)*b-(y*2/10)*2;
		if (b>=5&&p>=2){
		    s=x*b+y*p-(x*2/10)*b-(y*2/10)*p;
		    printf("%d\n",s);
		}
		else if (p>=2&&m<k){
		    printf("%d\n",m);
		}
		else if (b>=5&&r<k){
		    printf("%d\n",r);
		}
		else {
		    printf("%d\n",k);
		}
	}
	return 0;
}

Measured memory_bytes: 1032
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(void) {
	int n, k, tmp;
	cin >> n >> k;
	vector<int> dislike(10, 0);
	for (int i = 0; i < k; ++i) {
		cin >> tmp;
		++dislike[tmp];
	}
	set<int> like;
	for (int i = 0; i < 10; ++i) {
		if (dislike[i] == 0) like.insert(i);
	}
	while (true) {
		int a = n;
		set<int> st = like;
		while (a > 0) {
			st.insert(a % 10);
			a /= 10;
		}
		if (st.size() == like.size()) {
			break;
		}
		++n;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define Q_LEN 1000000
int queue[Q_LEN];
int head, tail;
void enque(int i) {
  if((tail+1)%Q_LEN == head) return;
  queue[tail] = i;
  tail++;
  tail %= Q_LEN;
}
int deque() {
  int res;
  if(head == tail) return -1;
  res = queue[head];
  head++;
  head %= Q_LEN;
  return res;
}
int empty() {
  return head == tail;
}
int main() {
  int n;
  int A[101][101] = {{}};
  int i, j;
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    int u, k;
    scanf("%d %d", &u, &k); --u;
    for(j = 0; j < k; j++) {
      int v;
      scanf("%d", &v); --v;
      A[u][v] = 1;
    }
  }
  int dist[101];
  memset(dist, -1, sizeof(dist));
  enque(0);
  dist[0] = 0;
  while(!empty()) {
    int u = deque();
    for(i = 0; i < n; i++) {
      if(A[u][i] == 1 && dist[i] == -1) {
	enque(i);
	dist[i] = dist[u]+1;
      }
    }
  }
  for(i = 0; i < n; i++) printf("%d %d\n", i+1, dist[i]);

  return 0;
}

Measured memory_bytes: 652
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut map: HashMap<usize, usize> = HashMap::new();

    for na in &a {
        let counter = map.entry(*na).or_insert(0);
        *counter += 1;
    }

    let mut ans = 0;
    for (key, value) in &map {
        if key > value {
            ans += value;
        } else {
            ans += value - key;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 7052
import java.util.Scanner;



public class Main {


  public static void main(String[] args) {

	  Scanner sc=new Scanner(System.in);
	  int n=Integer.parseInt(sc.next());
	 int a[][]=new int[n+1][n+1];
	 
	 for(int i=0;i<n+1;i++){
	for(int j=0;j<n+1;j++){	 
	 a[i][j]=0;
	}
	
	 }
	  for(int i=1;i<=n;i++){
		  int u=Integer.parseInt(sc.next());
		  int k=Integer.parseInt(sc.next());
		  for(int j=1;j<=k;j++){
			  int v=Integer.parseInt(sc.next());
		  a[i][v]=1;
		  }
	  }
	  
	  for(int i=1;i<=n;i++){
		  for(int j=1;j<=n;j++){
			  System.out.print(a[i][j]);
			  System.out.print((j==n) ? "\n" : " ");
		  }
	  }
	  
	 
  }
}

Measured memory_bytes: 27944
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const input = stdin.split('\n')

const [A, B] = input[0].split(' ').map(Number)

const ans = () => {
  let count = 0

  let i = 0

  let slot = 1
  while (1) {
    if (slot >= B) break

    slot += A - 1
    count++
  }

  console.log(count)
}

ans()


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

int main(){
    double N; cin>>N;
    long one = ((N+1)/1.08);
    long two = one - 1;
    if(floor(one*1.08) == int(N)) cout<<one<<endl;
    else if(floor(two * 1.08) == int(N)) cout<<two<<endl;
    else cout<<":(";
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 25 22:14:29 JST 2020
 **/

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

signed main() {
    int n;
    std::cin >> n;
    int x[n], y[n];
    Int p[n];
    REP(i, n) std::cin >> x[i] >> y[i] >> p[i];
    std::vector<int> x_ord(n), y_ord(n);
    std::iota(ALL(x_ord), 0), std::sort(ALL(x_ord), [&](int i, int j) { return x[i] < x[j]; });
    std::iota(ALL(y_ord), 0), std::sort(ALL(y_ord), [&](int i, int j) { return y[i] < y[j]; });
    int min_dist[n], orig_dist[n];
    REP(i, n) orig_dist[i] = std::min(std::abs(x[i]), std::abs(y[i]));
    std::vector<Int> ans(n + 1, 1e18);
    REP(S, 1 << n) {
        Int cnt = __builtin_popcount(S);
        // Sの部分集合の列挙
        for (int T = S;; T = (T - 1) & S) {
            // 操作
            REP(i, n) min_dist[i] = orig_dist[i];
            int l = 1e9;
            REP(k, n) {
                int i = x_ord[k];
                if (T >> i & 1) l = x[i];
                chmin(min_dist[i], std::abs(x[i] - l));
            }
            l = 1e9;
            for (int k = n - 1; k >= 0; k--) {
                int i = x_ord[k];
                if (T >> i & 1) l = x[i];
                chmin(min_dist[i], std::abs(x[i] - l));
            }
            l = 1e9;
            REP(k, n) {
                int i = y_ord[k];
                if ((S ^ T) >> i & 1) l = y[i];
                chmin(min_dist[i], std::abs(y[i] - l));
            }
            l = 1e9;
            for (int k = n - 1; k >= 0; k--) {
                int i = y_ord[k];
                if ((S ^ T) >> i & 1) l = y[i];
                chmin(min_dist[i], std::abs(y[i] - l));
            }
            Int acc = 0;
            REP(i, n) acc += p[i] * min_dist[i];
            chmin(ans[cnt], acc);
            if (T == 0) break;
        }
    }
    for (Int z : ans) std::cout << z << "\n";
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define  clr(v,val)      memset(v,val,sizeof(v))
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
ll setBit1(ll num, ll idx) {return num | (1ll<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=500000+5,mod=1e9+7;

int main(){
    int n;
    cin>>n;
    if(n%1000==0){
        cout<<"0"<<endl;
    }
    else
    cout<<(1000-n%1000)<<endl;
}


















































































































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

int main() {
  vector<int> x(5);
  rep(i,5){
    cin >> x.at(i);
    if(x.at(i) == 0){
      cout << i+1 << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main(){
	int n;
	long long int a;
	int counter = 0;

	cin >> n;

	for(int i=1;i<=n;i++){
		cin >> a;
		if(a%2!=0) counter++;
	}

	if(counter%2 == 0) printf("YES\n");
	else printf("NO\n");

	return 0;
}


Measured memory_bytes: 256
var readline = require('readline');

var knapSack = async function(){
  let n,capacity;

  let val = []
  let weight = [];

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
  });

  async function processLineByLine() {
    const rl1 = readline.createInterface({
      input: process.stdin,
      output: process.stdout,
      terminal: false
    });
    let index = 0;
    for await (const line of rl1) {
      let [one, two] = line.trim().split(" ").map(x => parseInt(x));
      if(!index){
        [n,capacity] = [one,two]
      } else {
        weight.push(one);
        val.push(two);
        // console.log(val);
      }
      index++;
      if(index === n+1){
        return;
      }
    }
  }

  await processLineByLine();

  let mem = [];

  for(let i = 0 ; i <= capacity ; i++){
    mem.push(0);
  }

  for(let i=1;i<= n ; i++){
    for(let j=capacity;j > 0;j--){
      let valWithoutItem = mem[j];
      let valWithItem = 0;
      if(weight[i-1] <= j){
        valWithItem = val[i-1] + mem[j - weight[i-1]];
      }
      mem[j] = Math.max(valWithItem, valWithoutItem);
    }
  }

  console.log(mem[capacity]);
};

knapSack();


Measured memory_bytes: 36628
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll H,W,N; cin>>H>>W>>N;
    H=max(H,W);
    cout<< (N+H-1)/H<<"\n";

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        Pair[] pairs = new Pair[n];
        for (int i = 0; i < n; i++)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            pairs[i] = new Pair() { a = ab[0], b = ab[1] };
        }

        Array.Sort(pairs, (x, y) => x.b - y.b);

        long sum = 0;
        foreach(var p in pairs)
        {
            sum += p.a;
            if (sum > p.b)
            {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
    }

    class Pair
    {
        public int a { get; set; }
        public int b { get; set; }
    }
}


Measured memory_bytes: 23444
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  vector<ll> A(N);
  REPLL(i, N){
    cin >> A[i];
  }
  sort(A.begin(), A.end(), greater<ll>());
  ll ans = 0;
  REPLL(i, N){
    if(i == 0) continue;
    ans += A[i/2];
  }
  cout << ans << endl;
}

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

int main()
{
	int a,b;
	cin >> a;
	cin >> b;
	if(a<b)
	{
		cout <<a<< endl;
	}
	if(b<a)
	{
		cout << a-1 << endl;
	}
	else if(a==b)
	{
		cout << a << endl;
	}
}

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

struct Card { char suit, value; };

void bubble (struct Card A[], int N) {
    int i, j;
    for ( i = 0; i < N; i++) {
        for ( j = N - 1; j > i; j-- ) {
            if ( A[j].value < A[j-1].value ) {
                swap(A[j], A[j-1]);
            }
        }
    }
}

void select ( struct Card A[], int N ) {
    int i, j, minj;

    for ( i = 0; i < N; i++) {
        minj = i;
        for ( j = i; j < N; j++) {
            if ( A[minj].value > A[j].value) {
                minj = j;
            }
        }
        swap(A[i], A[minj]);
    }
}

void print(struct Card A[], int N) {
    for ( int i = 0; i < N; i++) {
        if ( i != 0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable ( struct Card A[], struct Card B[], int N) {
    for ( int i = 0; i < N; i++ ) {
        if ( A[i].suit != B[i].suit) return false;
    }
    return true;
}

main()
{
    Card C1[100], C2[100];
    int N;
    char ch;

    cin >> N;
    for ( int i = 0; i < N; i++ ) {
        cin >> C1[i].suit >> C1[i].value;
    }

    for ( int i = 0; i < N; i++ ) C2[i] = C1[i];

    bubble(C1, N);
    select(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if ( isStable(C1, C2, N))
        cout << "Stable" << endl;
    else
        cout << "Not stable" << endl;

}

Measured memory_bytes: 3100
#include <stdio.h>
 
main(){
	int a,b,c,d,e,k;
    scanf("%d\n%d\n%d\n%d\n%d\n%d",&a,&b,&c,&d,&e,&k);
    
    int dis;
    dis = e - a;
    if(dis > k){
    	printf(":(");
    }
    else{
    	printf("Yay!");
    }
}

Measured memory_bytes: 128
import sys

def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A


def Yes():
    print('Yes')
    sys.exit()


def No():
    print('No')
    sys.exit()


if __name__ == '__main__':
    N, A, B, C, D = InputToInt()
    L = input()
    if D > C:
        for i in range(A, D-2):
            if L[i:i+2] == '##':
                No()
        Yes()

    if D < C:
        for i in range(A, C-2):
            if L[i:i+2] == '##':
                No()
        if '...' in L[B-2:D+1]:
            Yes()
        else:
            No()
                

Measured memory_bytes: 3572
#include <stdio.h>
int main()
{
  int a,b;
  scanf("%d%d",&a,&b);

  if(a<b){
    printf("a < b\n");
  }
  if(a>b){
    printf("a > b\n");
  }
  if(a==b){
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;



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

    ll bit[100008] = {};

    string res = "Yes";

    REP(i,N)
    {
        cin >> bit[i];
    }

    ll a = bit[0];
    ll b = bit[1];
    bit[N] = a;
    bit[N+1] = b;

    ll tmp = 0;

    for(ll i = 0; i < N; ++i)
    {

        tmp = tmp^bit[i];

    }

    if(tmp != 0)
    {
        res = "No";
    }



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



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <utility>
using namespace std;

typedef pair<int,int> point;
#define pt(x,y) make_pair(x,y)
#define U 1
#define L 2
#define D 4
#define R 8

int main(){
    int H,W;
    cin >> H >> W;
    string rm[50];
    for(int i=0;i<H;i++){
        cin >> rm[i];
    }

    int map[50][50],len[50][50];
    int count=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            map[i][j]=0;
            len[i][j]=10000;
            if(i>0 && rm[i-1][j]=='.') map[i][j]|=U;
            if(j>0 && rm[i][j-1]=='.') map[i][j]|=L;
            if(i<H-1 && rm[i+1][j]=='.') map[i][j]|=D;
            if(j<W-1 && rm[i][j+1]=='.') map[i][j]|=R;
            if(rm[i][j]=='.') count++;
        }
    }

    queue<point> prev;
    prev.push(pt(0,0));
    len[0][0]=1;

    while(!prev.empty()){
        point cur=prev.front();
        int nei=map[cur.first][cur.second];
        int cl=len[cur.first][cur.second];
        prev.pop();
        
        if((nei&U)!=0){
            if(cl+1<len[cur.first-1][cur.second]){
                len[cur.first-1][cur.second]=cl+1;
                prev.push(pt(cur.first-1,cur.second));
            }
        }
        if((nei&L)!=0){
            if(cl+1<len[cur.first][cur.second-1]){
                len[cur.first][cur.second-1]=cl+1;
                prev.push(pt(cur.first,cur.second-1));
            }
        }
        if((nei&D)!=0){
            if(cl+1<len[cur.first+1][cur.second]){
                len[cur.first+1][cur.second]=cl+1;
                prev.push(pt(cur.first+1,cur.second));
            }
        }
        if((nei&R)!=0){
            if(cl+1<len[cur.first][cur.second+1]){
                len[cur.first][cur.second+1]=cl+1;
                prev.push(pt(cur.first,cur.second+1));
            }
        }
    }

    if(len[H-1][W-1]==10000) cout << "-1" << endl;
    else cout << (count-len[H-1][W-1]) << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int W[100];
int main() {
	int N;
	cin >> N;
	int tot = 0;
	for (int i = 0; i < N; i++) {
		cin >> W[i];
		tot += W[i];
	}
	int ans = 1 << 30;
	int sum = 0;
	for (int i = 0; i + 1 < N; i++) {
		sum += W[i];
		ans = min(ans, abs(sum - (tot - sum)));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
 
public class Main {
    public static void main(String[] args) {
 
 
    	Scanner scanner = new Scanner(System.in);
    	String s1 = scanner.next();
    	String s2 = scanner.next();
    	System.out.println(s2 + s1);
    	
    }
}

Measured memory_bytes: 22996
function main(input) {

    input = input.split('\n')[0].split('');
    var plus = 0;
    var minus = 0;
    for (var i = 0; i < input.length; i++) {
        if (input[i] == '+') plus++;
        else minus++;
    }


    console.log(plus - minus)

}

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


Measured memory_bytes: 7372