akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

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

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

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


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n,m; cin >> n >> m;
    vii s(m);
    vi p(m);
    rep(i,m) {
        i32 k, ss; cin >> k;
        rep(j, k) {
            cin >> ss;
            s[i].push_back(--ss);
        }
    }
    rep(i,m) cin >> p[i];

    i32 cnt = 0;
    vec<bool> onoff;
    for(i32 bit = 0; bit < 1<<n; ++bit) {
        onoff.assign(n, 0);
        for(i32 i = 0; i < n; ++i) if((bit >> i) & 1) onoff[i] = 1;
        i32 light = 0;
        rep(i, m) {
            i32 tmp = 0;
            for(auto ss : s[i]) if(onoff[ss]) ++tmp;
            if(tmp%2 == p[i]) ++light;
        }
        if(light == m) ++cnt;
    }

    cout << cnt << '\n';

//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}


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

using namespace std;
using ll = long long;

const int MOD = 1000000007;

int modpow(int x, int n, int mod) {
  int res = 1;
  while (n > 0) {
    if (n & 1) res = 1LL * res * x % mod;
    x = 1LL * x * x % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll res = 0;
  for (int k = 0; k < 60; k++) {
    vector<ll> cnt(2, 0);
    for (int i = 0; i < N; i++) {
      cnt[(A[i] >> k) & 1]++;
    }
    res = (res + (cnt[0] * cnt[1] % MOD * modpow(2, k, MOD) % MOD)) % MOD;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  string S,T;
  cin >> S >> T;
  int32_t cnt = 0;
  for (int i= 0; i < S.size(); i++) {
    if (S[i] != T[i]){
      cnt++;
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3796
using System;
using System.Collections.Generic;
class Solve{
    int K;
    int T;
    int[] a;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        for(int i=0;i<T;i++){
            if(a[i] > (K+1)/2){
                Console.WriteLine(2*a[i]-K-1);
                return;
            }
        }
        Console.WriteLine(0);
    }
    void getinput(){
        string[] str = Console.ReadLine().Split(' ');
        K = int.Parse(str[0]);
        T = int.Parse(str[1]);
        a = new int[T];
        str = Console.ReadLine().Split(' ');
        for(int i=0;i<T;i++){
            a[i] = int.Parse(str[i]);
        }
    }    
}

Measured memory_bytes: 2648
import sys
import numpy as np

s1 = sys.stdin.readline().strip()
s2 = sys.stdin.readline().strip()

pos_dct = {}
pos_dct_1 = {}
for i, c in enumerate(s2):
    if c not in pos_dct:
        pos_dct[c] = [i]
    else:
        pos_dct[c].append(i)
for i, c in enumerate(s1):
    if c not in pos_dct_1:
        pos_dct_1[c] = [i]
    else:
        pos_dct_1[c].append(i)

        
s1 = np.array(list(s1))
s2 = np.array(list(s2))
for key in pos_dct:
    tmp = s1[pos_dct[key]][0]
    judge = len(list(filter(lambda x: x != tmp, s1[pos_dct[key]])))
    if judge != 0:
        print("No")
        sys.exit()
        
for key in pos_dct_1:
    tmp = s2[pos_dct_1[key]][0]
    judge = len(list(filter(lambda x: x != tmp, s2[pos_dct_1[key]])))
    if judge != 0:
        print("No")
        sys.exit()

print("Yes")


Measured memory_bytes: 35368
import sys


def input():
    return sys.stdin.readline().strip()


MOD = 998244353


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv


def power(a, n):
    x = 1
    while n:
        if n & 1:
            x = x * a % MOD
        n >>= 1
        a = a * a % MOD
    return x


def main():
    N, M, K = map(int, input().split())
    answer = 0
    combination = Combination(2 * 10 ** 5 + 1, MOD)
    for i in range(K + 1):
        answer += M * power(M - 1, N - i - 1) * combination(N - 1, i) % MOD
    print(answer % MOD)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32940
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <iostream>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("x = %d\n", x);
#define debug2(x, y) printf("x = %d, y = %d\n", x, y);
#define debug3(x, y, z) printf("x = %d, y = %d, z = %d\n", x, y, z);
#define debug4(x, y, z, t) printf("x = %d, y = %d, z = %d, t = %d\n", x, y, z, t);
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

int n1, n2;
char A[5];

bool yymm_valid(int a, int b) {
    return b >= 1 && b <= 12;
}

bool mmyy_valid(int a, int b) {
    return a >= 1 && a <= 12;
}

int main() {
    scanf(" %s", A);

    n1 = (A[1] - '0') + (A[0] - '0') * 10;
    n2 = (A[3] - '0') + (A[2] - '0') * 10;

    if (yymm_valid(n1, n2) && mmyy_valid(n1, n2)) {
        printf("AMBIGUOUS\n");
    } else if (yymm_valid(n1, n2)) {
        printf("YYMM\n");
    } else if (mmyy_valid(n1, n2)) {
        printf("MMYY\n");
    } else {
        printf("NA\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pii ct[105];

int main()
{
	int N, T;
	cin >> N >> T;
	REP(i, N)
	{
		cin >> ct[i].first >> ct[i].second;
	}

	int m = 1005;
	REP(i, N)
	{
		if (ct[i].second <= T)
		{
			m = std::min(m, ct[i].first);
		}
	}
  if(m!=1005)
  {
	cout << m << endl;
  }
  else
  {
    cout<<"TLE"<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int read() {
	int ans = 0, flag = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') flag = - flag; ch = getchar();}
	while(ch >= '0' && ch <= '9') {ans = ans * 10 + ch - '0'; ch = getchar();}
	return ans * flag;
}

const int N = 100010;
const int mod = 1000000007;

int n;
char s[N];
ll num[26];
ll ans;
int qpow(int a, int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = 1ll * ans * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	}
	return ans;
}
int main() {
	n = read();
	scanf("%s", s);
	for(int i = 0; i < n; ++ i) {
		int now = 1;
		for(int j = 0; j < 26; ++ j)
			if(s[i] - 'a' != j)
				now = 1ll * now * (num[j] + 1) % mod;
		ans += now;
		ans %= mod;
		++ num[s[i] - 'a'];
	}
	printf("%d\n", ans);
	return 0;
}

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

int h,w;

void check(vector<string> &arr, vector<int> &sm, int line, bool is_tate) {
	int cnt = 0;
	if(is_tate) {
		for(int i = 0; i <= h; i++) {
			if(i<h && arr[i][line]!='#') {
				cnt++;
			}else {
				for(int j = i-cnt; j < i; j++) {
					sm[j*w+line]+=cnt;
				}
				cnt = 0;
			}
		}
	}else {
		for(int i = 0; i <= w; i++) {
			if(i<w && arr[line][i]!='#') {
				cnt++;
			}else {
				for(int j = i-cnt; j < i; j++) {
					sm[line*w+j]+=cnt;
				}
				cnt = 0;
			}
		}
	}
}

int main() {
	cin >> h >> w;
	vector<string> arr(h);
	for(int i = 0; i < h; i++) {
		cin >> arr[i];
	}
	vector<int> sm(h*w);
	for(int i = 0; i < h; i++) {
		check(arr,sm,i,false);
	}
	for(int i = 0; i < w; i++) {
		check(arr,sm,i,true);
	}
	int ans = 0;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			ans = max(ans,sm[i*w+j]);
		}
	}
	cout << (ans-1) << endl;
	return 0;
}


Measured memory_bytes: 20864
#include <bits/stdc++.h>
using namespace std ;
int main()
{
   int x;
   cin >> x ;
   if(x%10==3){cout<<"bon" ;}
   else if (x%10==2 || x%10==4 || x%10==5 || x%10==7 || x%10==9  )
   {
       cout << "hon" ;
   }
   else {cout << "pon" ;}



    return 0 ;
}


Measured memory_bytes: 3644
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class FPure {
public:

    vector<int> graph[1001];
    int n;

    vector<int> bfs(int p) {
      vector<int> ret;
      vector<int> cost(n+1, INT_MAX/2);
      vector<int> parent(n+1);
      deque<P> que;
      cost[p] = 0;
      que.emplace_back(p, 0);
      while(!que.empty()) {
        P pa = que.front(); que.pop_front();
        int s = pa.first;
        int c = pa.second;
        if (c > cost[s]) continue;
        for(auto e: graph[s]) {
          if (e == p) {
            ret.push_back(e);
            e = s;
            while(e != p) {
              ret.push_back(e);
              e = parent[e];
            }
            reverse(all(ret));
            return ret;
          }
          if (cost[e] > c + 1) {
            cost[e] = c+1;
            parent[e] = s;
            que.emplace_back(e, c+1);
          }
        }
      }
      return ret;
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int m; cin >> n >> m;
      rep(i, m) {
        int a, b; cin >> a >> b;
        graph[a].push_back(b);
      }

      vector<int> ans;
      for(int i=1; i<=n; i++) {
        auto now = bfs(i);
        if (now.empty()) continue;
        if (ans.empty() || ans.size() > now.size()) {
          swap(ans, now);
        }
      }
      if (ans.empty()) {
        cout << -1 << endl;
        return;
      }

      cout << ans.size() << endl;
      for(auto e: ans) {
        cout << e << '\n';
      }
    }
};

signed main() {
  FPure solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
map<ll,int> primeFactor(ll n){
    map<ll,int> res;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1){
        res[n]=1;
    }
    return res;
}
int main(){
    ll n,m;
    cin>>n>>m;
    auto ma=primeFactor(m);
    ll ans=1;
    for(auto itr:ma){
        for(int j=0;j<itr.se/n;j++){
            ans*=itr.fi;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    a, b, c, d = map(int, input().split())
    if (a <= 0 and b >= 0) or (c <=0 and d >= 0):
        print(max(a*c, b*d, 0))
    else:
        print(max(a*c, b*d, a*d, b*c))

if __name__ == "__main__":
    main()

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

int main() {
    string answer = "No";
    int a = 0, b = 0, c = 0, d = 0;
    cin >> a >> b >> c >> d;
    if(a == b && b == c)
        answer = "Yes";
    else if((a + c) - b == d * 2)
        answer = "Yes";
    else if(abs(a - c) <= d)
        answer = "Yes";

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
    return !b ? a : gcd(b, a % b);
}
int main(){
    ll ans = 0;
    int k;
    scanf("%d", &k);
    for(int a = 1; a <= k; a++) {
        for(int b = 1; b <= k; b++) {
            for(int c = 1; c <= k; c++) {
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3828
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
N, M = gets_i_list
puts (1900 * M + 100 * (N - M)) * (2 ** M)

Measured memory_bytes: 2044
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
ll N, M, L, R;
ll ans = 0;

vector<vector<pair<ll, ll> > > G;
vector<ll > prever;
 
vector<ll > dijkstra(ll start, ll end){
    //準備
    vector<bool > used(N, false);
    vector<ll > dist(N, 1<<28);
    prever.assign(N, -1);
    priority_queue<pair<ll, ll > , vector<pair<ll, ll > >, greater<pair<ll, ll > > > que;
    //初期化
    que.push(make_pair(0, start));
 
    //cout << que.top().first << endl;
 
    while(!que.empty()){
        //距離
        ll d = 0;
        //次の頂点
        ll t_v = 0;
        d = que.top().first;
        t_v = que.top().second;
        //topから削除
        que.pop();
        //探査済みなら処理しない
        if(used[t_v] == true) continue;
        //探査済みにする
        used[t_v] = true;
        //キューの上には既に最小距離が来ているので
        dist[t_v] = d;
        
        if(t_v == end){
            break;
        }

        //次探査する頂点はt_vなのでt_vから更に次にの頂点の繋がりをキューにいれる
        for(ll i = 0; i < G[t_v].size(); i++){
            //もし探査済みの頂点で，そこまでの累積距離より今更新しようとしている距離が
            //大きいときは更新しない
            ll to = G[t_v][i].first;
            ll cost = d+G[t_v][i].second;
            if(dist[to] <= cost) continue;
            //累積距離と次の頂点
            que.push(make_pair(cost, to));
            //仮dist
            dist[to] = cost;
        }
        //cout << endl;
    }   
    
    return dist;
 
}
 
int main() {
    //頂点数
    cin >> N >> M >> R;
    
    vector<ll > city;
    for(ll i = 0; i < R; i++){
        ll in = 0; cin >> in;
        city.push_back(in-1);
        //conf[in-1]++;
        //que.push(in-1);
    }

    G.assign(N, vector<pair<ll, ll > >());
 
    for(ll i = 0; i < M; i++){   
        ll u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        //双方向に貼りましょうね
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));    
    }

    //2点間の距離を全て出す...()
    vector<vector<ll > > all_dist(R, vector<ll >(R, 1<<28));
    for(ll i = 0; i < R; i++){
        for(ll j = i; j < R; j++){
            vector<ll > dist = dijkstra(city[i], city[j]);
            //cout << city[i] << " " << city[j] << dist[city[j]] << endl;
            all_dist[i][j] = dist[city[j]];
            all_dist[j][i] = dist[city[j]];
        }
    }

    ll min_path = 1<<28;
    //答えを求める
    vector<ll > perm(R, 0);
    for(ll i = 0; i < R; i++) perm[i] = i;

    do{
        ll t_path = 0;
        for(ll i = 1; i < R; i++){
            if(all_dist[perm[i-1]][perm[i]] == 1<<28) continue;
            t_path += all_dist[perm[i]][perm[i-1]];
        }
        min_path = min(t_path, min_path);
    }while(next_permutation(perm.begin(), perm.end()));

    cout << min_path << endl;

}

Measured memory_bytes: 1152
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array

main :: IO ()
main = do
  n <- readLn
  xs <- fmap join $ replicateM n $ map read . words <$> getLine :: IO [Int]
  print $ solve xs

solve xs = sum xs - m `div` 2
  where
    m = maximum xs


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[300000];
bool vis[300000];
int cur;
void dfs(int v) {
	assert(!vis[v]);
	vis[v] = true;
	cur++;
	for(int nxt: adj[v]) if(!vis[nxt]) dfs(nxt);
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	int n, m; cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int res = 0;
	for(int i = 0; i < n; i++) if(!vis[i]) {
		cur = 0;
		dfs(i);
		res = max(res, cur);
	}
	cout << res << '\n';
}


Measured memory_bytes: 23260
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 10000000;

int min_factor[MAX+1];

void calc(int n) {
	min_factor[0] = min_factor[1] = -1;
	int i;
	for (i = 2; i*i <= n; i++) {
		if (min_factor[i]) continue;
		min_factor[i] = i;
		for (int j = i*i; j <= n; j += i) {
			if (!min_factor[j]) min_factor[j] = i;
		}
	}
	for (; i <= n; i++) if (!min_factor[i]) min_factor[i] = i;
}

vector<pair<long long, int>> prime_factorization(long long n) {
	vector<pair<long long, int>> v;
	while (n > 1) {
		long long p = min_factor[n];
		int exp = 0;
		while (n % p == 0) {
			n /= p;
			exp++;
		}
		v.emplace_back(p, exp);
	}
	return v;
}

int main() {
	long long n;
	cin >> n;
	calc(n);
	long long ans = 0;
	for (long long i = 1; i <= n; i++) {
		auto v = prime_factorization(i);
		long long now = 1;
		for (auto e : v) {
			now *= e.second + 1;
		}
		ans += now * i;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

long long calc(long long n,int k){
	long long l=0;
	long long r=n;
	while(r-l>1){
		long long m = (l+r)/2;
		long long x = n;
		for(int i=0;i<k;i++){
			x /= m;
			if(x<1){
				r = m;
				break;
			}
		}
		if(x>=1){
			l = m;
		}
	}
	long long tmp = n;
	for(int i=0;i<k;i++){
		tmp /=r;
		if(tmp<1){
			return l;
		}
	}
	return r;
}

int main(){
	long long n,A,ans,x,y,tmp;
	cin >> n >> A;
	if(n==1){
		cout << 1 << endl;
		return 0;
	}
	ans = n;
	for(int k=1;k<=40;k++){
		x = calc(n,k);
		y=1;
		int count =0;
		for(int i=0;i<k;i++){
			y = y*x;
		}
		while(1){
			if(y>=n)break;
			y /= x;
			y *= x+1;
			count +=1;
		}
		tmp = x*k+count+A*(k-1);
		ans = min(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<double,double> pii;
const int N = 2e5+5;
const int M = 2e5+5;
const int Mod = 1e8;
#define pi acos(-1)
#define INF 1e14
#define INM INT_MIN
#define pb(a)  push_back(a)
#define mk(a,b) make_pair(a,b)
#define dbg(x) cout << "now this num is " << x << endl;
#define met0(axx) memset(axx,0,sizeof(axx));
#define metf(axx) memset(axx,-1,sizeof(axx));
#define sd(ax) scanf("%d",&ax)
#define sld(ax) scanf("%lld",&ax)
#define sldd(ax,bx) scanf("%lld %lld",&ax,&bx)
#define sdd(ax,bx) scanf("%d %d",&ax,&bx)
#define sddd(ax,bx,cx) scanf("%d %d %d",&ax,&bx,&cx)
#define sfd(ax) scanf("%lf",&ax)
#define sfdd(ax,bx) scanf("%lf %lf",&ax,&bx)
#define pr(a) printf("%d\n",a)
#define plr(a) printf("%lld\n",a)
int main()
{
	int f = 0;
	string s1,s2;cin >> s1 >> s2;
	for(int i=0;i<min(s1.size(),s2.size());++i)
	{
		if(s1[i] != s2[i]) 
		{
			f = 1;
			break;
		}
	}
	if(f) printf("No\n");
	else printf("Yes\n");
	//system("pause");
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair

int main(){
  pair<int,int> data[10];
  char team[10][21];
  int n,d=0;
  while(cin>>n,n){
    if(d!=0)cout<<endl;
    d=1;
    REP(i,n){
      string s;
      int a,b,c;
      cin>>team[i]>>a>>b>>c;
      data[i]=MP(-(a*3+c),i);
    }
    sort(data,data+n);
    REP(i,n){
      cout<<team[data[i].second]<<","<<-data[i].first<<endl;
    }
  }
  
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

int root(int x, vector<int>& par){
  if(par[x] < 0){
    return x;
  }else{
    return par[x] = root(par[x],par);
  }
}

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}

int n;int a[210000];int b[210000], ans[210000];

void divisor(int n, int put) {
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      b[i]+=put;
      if(i * i != n){
        b[n/i]+=put;
      }
    }
  }
}

signed main(){
  cin>>n;rep(i,n)cin>>a[i+1];
  int cnt = 0;
  rep(i,n+1)b[i] = 0;rep(i,n+1)ans[i] = 0;
  for(int i = n;i >= 1;i--){
    int put = 0;
    if(b[i] % 2 != a[i])put = 1;
    ans[i] = put;
    cnt += put;
    divisor(i, put);
  }
  cout << cnt << endl;
  repd(i,1,n+1){
    if(ans[i])cout << i << endl;
  }
}


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

int main (void)
{
  int k,x;
  cin>>k>>x;
  if(k*500>=x){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  return 0;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#include <vector>
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define LONG_LONG_MAX 9223372036854775807LL
#define pblank putchar(' ')
#define ll LL
#define fastIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> P;
int n, m, k;
const int maxn = 1e5 + 10;
template <class T>
inline T read()
{
    int f = 1;
    T ret = 0;
    char ch = getchar();
    while (!isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        ret = (ret << 1) + (ret << 3) + ch - '0';
        ch = getchar();
    }
    ret *= f;
    return ret;
}
template <class T>
inline void write(T n)
{
    if (n < 0)
    {
        putchar('-');
        n = -n;
    }
    if (n >= 10)
    {
        write(n / 10);
    }
    putchar(n % 10 + '0');
}
template <class T>
inline void writeln(const T &n)
{
    write(n);
    puts("");
}
const ld PI = acos(-1);
ld solve(int a, int b, int x)
{
    if (2.0 * x >= a * a * b)
        return (ld)atan((2 * a * a * b * 1.0 - 2 * x) / (a * a * a * 1.0));
    return PI / 2 - atan(2 * x * 1.0 / (a * b * b));
}
int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif

    int a, b, x;
    cin >> a >> b >> x;
    cout << fixed << setprecision(7) << solve(a, b, x) * 180.0 / PI;
    return 0;
}

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

using namespace std;

int main() {
	long n,m,x,y;
	cin >> n >> m >> x >> y;
	vector<long> xs(n),ys(m);
	for (long ni=0;ni<n;++ni) {
		cin >> xs[ni];
	}
	for (long mi=0;mi<m;++mi) {
		cin >> ys[mi];
	}
	sort(xs.begin(),xs.end());
	sort(ys.begin(),ys.end());
	if (xs[n-1]<y && xs[n-1]<ys[0] && ys[0]>x) {
		cout << "No War" << endl;
	} else {
		cout << "War" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    l_n = [True] * n
    for i in range(m):
        a, b = map(int, input().split())
        if h[a-1] == h[b-1]:
            l_n[b-1] = False
            l_n[a-1] = False
        elif h[a-1] <= h[b-1]:
            l_n[a-1] = False
        elif h[a-1] >= h[b-1]:
            l_n[b-1] = False
    print(sum(l_n)) 

if __name__ == '__main__':
    main()

Measured memory_bytes: 20168
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(101):
        for j in range(101):
            for k in range(101):
                col1 = C1[0] - i
                if col1 < 0:
                    break
                if col1 > 100:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    continue
                col2 = C1[1] - i
                if col2 < 0:
                    break
                if col2 > 100:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    continue
                col3 = C1[2] - i
                if col3 < 0:
                    break
                if col3 > 100:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    continue
                print('Yes')
                sys.exit()
    print('No')

Measured memory_bytes: 3064
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47512
#include<iostream>
#include<map>

using namespace std;

int main(){
    string S;
    map<char, int> map_str;

    cin >> S;

    for(int i = 0; i  < S.length(); i++){
        if(map_str.count(S[i]) == 0){
            map_str[S[i]] = 1;
        } else {
            map_str[S[i]]++;
        }
    }

    int count = 0;

    for(auto el : map_str){
        if(el.second != 2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  ll a[n*3];
  rep(i,n*3) R a[i];
  priority_queue<ll,vector<ll>,greater<ll> > que;
  priority_queue<ll> que2;
  ll x=0,ans=-MAXL,d[n*3],d2[n*3];
  rep(i,n*3) {
    que.push(a[i]);
    ll z=0;
    if(que.size()>n) z=que.top();
    x+=a[i]-z;
    d[i]=x;
    if(que.size()>n) que.pop();
  }
  x=0;
  rrep(i,n*3) {
    que2.push(a[i]);
    ll z=0;
    if(que2.size()>n) z=que2.top();
    x+=a[i]-z;
    d2[i]=x;
    if(que2.size()>n) que2.pop();
  }
  REP(i,n-1,2*n) ans=max(ans,d[i]-d2[i+1]);
  pr(ans);
}

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


Measured memory_bytes: 9460
#include <stdio.h>
 #include <ctype.h>
 #include <stdlib.h> 
int main() { 
int e[101][101]; 
int R, C, r, c; 
int s, total; 
scanf("%d%d", &R, &C);
 for (r = 1; r <= R; r++) { 
for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
 } 
for (r = 1; r <= R; r++) {
 s = 0; for (c = 1; c <= C; c++) s += e[r][c];
 e[r][0] = s;
 }
 total = 0;
 for (c = 1;
 c <= C; c++) {
 s = 0;
 for (r = 1;r <= R; r++) s += e[r][c];
 e[0][c] = s;
 total += s; 
} 
for (r = 1; r <= R; r++) {
 for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
 printf("%d\n", e[r][0]); 
}
 for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
 printf("%d\n", total);
 return 0;
 } 


Measured memory_bytes: 2052
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        long[] ans = new long[N + 1];
        for (int a = 1; a < Sqrt(N)+1; a++)
        {
            for (int b = 1; b < Sqrt(N)+1; b++)
            {
                for (int c = 1; c < Sqrt(N)+1; c++)
                {
                    long n = a * a + b * b + c * c + a * b + b * c + c * a;
                    if (n > N) break;
                    ans[n]++;
                }
            }
        }
        for (int i = 1; i < N+1; i++)
        {
            WriteLine(ans[i]);
        }
    }
}


Measured memory_bytes: 27544
//ヘッダーファイル
#include <iostream>
#include <sstream>
#include <string>

//名前空間
using namespace std;

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

    char c;
    int count =0;
    for(int i=0;i<s.size();i++){
        c = s[i];
        if(c == '1'){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<assert.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 2e5+10, M = 1e6+10;
string s;
int n;
int main() {
	cin>>s;
	n = s.length();
	int ans = 0;
	for(int i = 0;i < n;i++) {
		ans += s[i] - '0';
	}
	if(ans % 9) cout<<"No\n";
	else cout<<"Yes\n";
	return 0;
}

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

using namespace std;
typedef long long int ll;
ll a, b, c, d, dap;
int main() {
    
    ll n, u, v, i, dap=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        dap+=i*(n+1-i);
    }
    for(i=1;i<n;i++)
    {
        scanf("%lld %lld", &u, &v);
        if(u>v)
        {
            ll x;
            x=u;
            u=v;
            v=x;
        }
        dap-=(u*(n+1-v));
    }
    
    
    cout<<dap;
    
    
    return 0;
}

Measured memory_bytes: 3732
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (long i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

long N;
unordered_map<string, long> m;

ll ans;

int main() {
  cin >> N;
  ans = 0;
  rep(i, N) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    m[s] = m[s] + 1;
    if (m[s] > 1) {
      ans += (m[s] - 1);
    }
  }

  cout << ans << endl;
}


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

typedef long long ll;

const ll mod = 1e9+7;
ll tab[10100];
ll tmp[10100];
ll ver[10100];
ll hol[10100];

ll fact[300100];
ll inv_fact[300100];

int main() {
	fact[0] = inv_fact[0] = 1;
	for(ll i = 1; i < 300100; i++) {
		ll t = mod-2, x;
		fact[i] = (fact[i-1] * i)%mod;
		x = fact[i];
		inv_fact[i] = 1;
		while(t) {
			if(t&1) {
				inv_fact[i]*= x;
				inv_fact[i]%= mod;
			}
			x = x*x%mod;
			t >>= 1;
		}
	}
	ll N, M, K;
	cin >> N >> M >> K;
	tab[0] = 1;
	for(int i = 1; i <= 2*K ; i++) {
		for(int j = 0; j <= K; j++) {
			tmp[j] = 0;
			tmp[j] = (((i >= 2*j && j) ? tab[j-1] : 0)
				+ tab[j]) % mod;
		}
		for(int j = 0; j <= K; j++) {
			tab[j] = tmp[j];
			if(i - 2*j == N) {
				ver[j] += tab[j];
				ver[j] %= mod;
			}
			if(i - 2*j == M) {
				hol[j] += tab[j];
				hol[j] %= mod;
			}
		}
	}
	for(int i = 0; i <= K; i++) {
		for(int j = 0; j <= K-i; j++){
			ll a;
			a = N - (2*K-2*i -j);
			if(a >= 0 && (j || a != 0)) {
				if(i+j <= K) {
					ver[i+j] += ((tab[i] * fact[a+j] % mod)
						* inv_fact[a] % mod) * inv_fact[j] % mod;
					ver[i+j] %= mod;
				}
			}
			a = M - (2*K-2*i -j);
			if(a >= 0 && (j || a != 0)) {
				if(i+j <= K) {
					hol[i+j] += ((tab[i] * fact[a+j] % mod)
						* inv_fact[a] % mod) * inv_fact[j] % mod;
					hol[i+j] %= mod;
				}
			}
		}
	}
	ll res = 0;
	for(int i = 0; i <= K; i++) {
		res += ((ver[i] * hol[K-i] % mod) *
			((fact[2*K+M+N] * inv_fact[N+2*i] % mod) * inv_fact[2*K+M+N -(N+2*i)] % mod)) % mod;
		res %= mod;
	}
	cout << res << endl;
}

Measured memory_bytes: 8036
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//---------------from here-----------------

int main(){
    int n; cin>>n;
    if(n%2==0) cout<<0.5<<endl;
    else cout<<(n/2+1)/(double)n<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   int n,m;
   string s[100];
   string t[100];
   cin >> n;
   rep(i,n) cin >> s[i];
   cin >> m;
   rep(i,m) cin >> t[i];

   map<string,int> mp;
      
      rep(i,n){
         mp[s[i]]++;
      }
      rep(i,m){
         mp[t[i]]--;
      }

      int ans = 0;
      rep(i,n){
         if(mp[s[i]] > ans) ans = mp[s[i]];
      }

   cout << ans <<endl;


   return 0;
}

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
     long long int A,B,C,K;
     cin >> A >> B >> C >> K;
     long long int ans = A-B;
     if(K%2==1){
          ans*=-1;
     }
     // if(K==0){
     //      ans*=1;
     // }
     if(ans>100000000000000000){
          cout << "Unfair";
     }
     else{
          cout << ans;
     }
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    for(;;){
        cin >> n;
        if(n==0) break;
        for(int i=0;i<9;i++){
            cin >> m;
            n-=m;
        }
        cout << n << endl;
    }
    return 0;
}



Measured memory_bytes: 3108
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();
	if ( a + b == 15 ) {
	    System.out.println("+");
	} else if ( a * b == 15 ) {
	    System.out.println("*");
	} else {
	    System.out.println("x");	    
	}
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)


int arr[100005]={0};

int32_t main()
{
       




     int n, k, q;
     cin >> n >> k >> q;

     rep(i,1,q)
     {
      int x;
      cin >> x;
      arr[x]++;
     }

     rep(i,1,n)
     {
      if(k - ( q - arr[i]) > 0)
      {
        cout << "Yes" << endl;
      }
      else
      {
        cout << "No" << endl;
      }
     }


   return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <climits>
#include <math.h>
 
using namespace std;
typedef unsigned long ul;

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

	while(n--) {
		cin>>a>>b;
		ul score = (a - 1) * (b - 1);
		ul hoge = score > 0 ? sqrt(score) : 0;
		ul count = hoge * 2 + (a <= hoge ? -1 : 0) + (b <= hoge ? -1 : 0);
		score = a * b - 1;
		ul amin = hoge, bmin = hoge;
		ul amax = bmin == 0 ? ULONG_MAX : score / bmin;
		ul bmax = amin == 0 ? ULONG_MAX : score / amin;

		while(true) {
			amin++;
			if(amin == a) amin++;
			if(amin >= amax) break;
			bmax = min(score / amin, bmax - 1);
			if(bmax == b) bmax--;
			if(bmin >= bmax) break;
			count++;

			bmin++;
			if(bmin == b) bmin++;
			if(bmin >= bmax) break;
			amax = min(score / bmin, amax - 1);
			if(amax == a) amax--;
			if(amin >= amax) break;
			count++;
		}

		cout<<count<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int len;
long long go(int x, long long sum)
{
	if(x==len)
		return sum;
	long long cur=0, ans=0;
	for(int i=x; i<len; i++)
	{
		cur*=10, cur+=s[i]-'0';
		ans+=go(i+1, sum+cur);
	}
	return ans;
}
int main() 
{
	cin>>s;
	len=s.size();
	printf("%lld\n", go(0, 0));
}


Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().unwrap_or_else(|_| panic!("Faild to parse {}", s))
}

fn main(){
    let n: u32 = read();
    let mut i = 0;
    while 1 << i <= n {
        i += 1;
    }
    println!("{}", 1 << (i - 1));
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    int a,b;
    cin>>a>>b;
    if(a<9&&b<9)cout<<"Yay!";
	else cout<<":(";
	return 0;
}



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

int main() {
    int n;
    cin >> n;
    int fib[50];
    fib[0] = fib[1] = 1;
    for (int i = 2; i < 50; i++) fib[i] = fib[i - 1] + fib[i - 2];
    cout << fib[n] << endl;
    return 0;
}


Measured memory_bytes: 3104
/************************
*                       *
* Nothing Is Impossible *
*                       *
************************/
#include <algorithm>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <math.h>
#include <cmath>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for (int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld; 
using namespace std;

int main()
{
	int n;	cin >> n;
	char c[n];
	if(n%2 == 0)
	{
		cin >> c;
		bool I = true;
		Rep(i,0,(n/2))
		{
			if(c[i] != c[i+(n/2)])
			{
				I = false;
				break;
			}
		}
		if(I)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	else
	{
		cin >> c; 
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-

def main():
    n = int(input())
    red_point = [tuple(map(int, input().split())) for _ in range(n)]
    blue_point = [tuple(map(int, input().split())) for _ in range(n)]
    red_point.sort(key=lambda x:(x[1], x[0]), reverse=True)
    blue_point.sort(key=lambda x:(x[0], x[1]))
    ans = 0
    for blue in blue_point:
        bx, by = blue
        for red in red_point:
            rx, ry = red
            if rx < bx and ry < by:
                red_point.remove(red)
                ans += 1
                break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

typedef long long ll;
typedef unsigned long long ull;

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif


const string join(vector<string> &v, string sep = ""){
    string s; FOREACH(it, v){ if(it != v.begin()) s.append(sep); s.append(*it); } return s;
}

const string to_string(int n){
    char buf[16];
    sprintf(buf, "%d", n);
    return string(buf);
}

bool check(int c[10]){
    if(c[0] == 2){
        REPEAT(i,1,10){
            if(c[i] == 2) return true;
        }
        return false;
    }

    int c2[10];
    REPEAT(i,1,8){
        if(c[i] && c[i+1] && c[i+2]){
            memcpy(c2, c, sizeof(c2));
            c2[i]--; c2[i+1]--; c2[i+2]--; c2[0] -= 3;
            if(check(c2)) return true;
        }
    }
    REPEAT(i,1,10){
        if(c[i] >= 3){
            memcpy(c2, c, sizeof(c2));
            c2[i] -= 3; c2[0] -= 3;
            if(check(c2)) return true;
        }
    }
    return false;
}

int main(){
    string s;
    while(getline(cin, s)){
        int c[10];
        REP(i,10) c[i] = 0;
        REP(i,13){
            c[s[i] - '0']++;
            c[0]++;
        }
        c[0]++;
        vector<string> result;
        REPEAT(i,1,10){
            if(c[i] < 4){
                c[i]++;
                if(check(c)) result.push_back(to_string(i));
                c[i]--;
            }
        }
        if(result.size() == 0) result.push_back(to_string(0));
        cout << join(result, " ") << endl;
    }

    return 0;
}

Measured memory_bytes: 1212