akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <algorithm>
using namespace std;
int a[110000];
int s[110000];
int n, m, x, y;
int main() {
    while (scanf("%d%d", &n, &m) !=EOF) {
        memset(s, 0, sizeof s);
        s[1] = 1;
        for (int i = 1; i <= n; i++) a[i] = 1;
        for (int i = 0; i < m; i++) {
            scanf("%d%d", &x, &y);
            if (a[x] >= 1) {
                if (s[x] == 0) {
                    a[x]--;
                    a[y]++;
                } else if (a[x] > 1) {
                    s[y] = 1;
                    a[x]--;
                    a[y]++;
                }else {
                    s[x] = 0;
                    s[y] = 1;
                    a[x]--;
                    a[y]++;
                }
            }
        }
        int num = 0;
        for (int i = 1; i <= n; i++)
            if (s[i]) num++;
        printf("%d\n", num);
    }
}


Measured memory_bytes: 1024
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N, M;
    std::cin >> N >> M;

    std::unordered_map<int64_t, int64_t> m;
    int64_t s = 0;
    m[0]++;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        s += t;
        int64_t r = s % M;
        m[r]++;
    }

    int64_t ans = 0;

    for (const auto& g: m) {
        ans += g.second * (g.second -1)/2;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define umap unordered_map

using namespace std;

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

const int N = 1e5 + 10;
vector<P> G[N];

struct BIT{
	int n;
	vector<int> dat;
	BIT(int _n){
		n = _n;
		dat.resize(n + 1);
	}

	void add(int pos, int val){
		for (int x = pos; x <= n; x += x&-x) dat[x] += val;
	}
	
	int sum(int pos){
		int s = 0;
		for (int x = pos; x > 0; x -= x&-x) s += dat[x];
		return s;
	}
};

void dijk(int start, vector<ll> &d){
	fill(ALL(d), 1ll << 60);

	d[start] = 0;
	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
	q.push(MP(0, start));

	while (!q.empty()){
		ll dist = q.top().first;
		int pos = q.top().second;
		q.pop();

		if (dist > d[pos]) continue;

		for (auto e : G[pos]){
			if (d[e.first] <= dist + e.second) continue;
			d[e.first] = dist + e.second;
			q.push(MP(d[e.first], e.first));
		}
	}
}

int main(){
	int n, m;
	cin >> n >> m;
	rep(i, m){
		int a, b, c;
		cin >> a >> b >> c;
		G[a].push_back(MP(b, c));
		G[b].push_back(MP(a, c));
	}

	vector<ll> ds(n), dg(n);
	dijk(0, ds);
	dijk(n-1, dg);

	vector<pair<ll, ll>> vp(n);
	rep(i, n) vp[i] = MP(ds[i], dg[i]);
	sort(ALL(vp));

	auto v = dg;

	int q;
	cin >> q;
	vector<pair<ll, ll>> query(q);
	rep(i, q){
		cin >> query[i].first >> query[i].second;
		v.push_back(query[i].second);
	}

	sort(ALL(v));
	v.erase(unique(ALL(v)), v.end());

	rep(i, n) vp[i].second = lower_bound(ALL(v), vp[i].second) - v.begin() + 1;
	rep(i, q) query[i].second = lower_bound(ALL(v), query[i].second) - v.begin() + 1;

	auto sq = query;
	sort(ALL(sq));

	map<pair<ll, ll>, int> ans;

	BIT bit(v.size());

	int idx = 0;
	for (auto p : sq){
		while (idx < n && vp[idx].first <= p.first){
			bit.add(vp[idx++].second, 1);
		}
		ans[p] = bit.sum(bit.n) - bit.sum(p.second-1);
	}

	for (auto p : query){
		cout << ans[p] << endl;
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int dp[105][305];
int main(){
    int n, w;
    scanf("%d%d", &n, &w);
    int w1 = 0;
    for(int i=1;i<=n;i++){
        int a, b;
        scanf("%d%d", &a, &b);
        if(i == 1) w1 = a;
        for(int j=n;j>=0;j--){
            for(int k=3*n;k>=0;k--){
                dp[j+1][k+(a-w1)] = max(dp[j+1][k+(a-w1)], dp[j][k] + b);
            }
        }
    }
    int ans = 0;
    for(int j=1;j<=n;j++){
        for(int k=0;k<=3*j;k++){
            ll wi = w1*1ll*j + k;
            if(wi <= w) ans = max(ans, dp[j][k]);
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void)
{
  int n;
  scanf("%d",&n);
  if(n==1){
    printf("1");
    return 0;
  }
  
  unsigned long long a = 2, b = 1,ans = 0;
  
  for(int i =0;i < n-1;i++){
    ans = a+b;
    a = b;
    b = ans;
  }
  
  printf("%lld",ans);
  
  return 0;
}

Measured memory_bytes: 128
from collections import Counter

N = int(input())
a = sorted(list(map(int, input().split())))

M = 10**6

table = [1] * (M + 1)

B = Counter(a)
Key = list(B.keys())

count = 0
for x in Key:
    if B[x] == 1 and table[x] == 1:
        count += 1

    for i in range(M):
        if i * x > M:
            break
        else:
            table[i * x] = 0

print(count)


Measured memory_bytes: 136832
#include <iostream>
#include <limits>

using namespace std;
using ll = long long;

#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"
const ll INF = numeric_limits<ll>::max();
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N;
  ll C;
  in(N); in(C);

  ll x[N], v[N];
  rep(i, N) {
    in(x[i]);
    in(v[i]);
  }
  ll sum_l[N+1], sum_r[N+1];
  sum_l[0] = sum_r[N] = 0;
  rep(i, N) sum_l[i+1] = sum_l[i] + v[i];
  rrep(i, N-1) sum_r[i] = sum_r[i+1] + v[i];
  rep(i, N) {
    sum_l[i+1] -= x[i];
    sum_r[i] -= C - x[i];
  }

  ll max_l[N+1], max_l2[N+1];
  max_l[0] = max_l2[0] = 0;
  rep(i, N) {
    max_l[i+1] = max(max_l[i], sum_l[i+1]);
    max_l2[i+1] = max(max_l2[i], sum_l[i+1] - x[i]);
  }

  ll ans = 0;
  chmax(ans, max_l[N]);
  rrep(r, N-1) {
    if (r == 0)
      chmax(ans, sum_r[r]);
    else {
      chmax(ans, sum_r[r] + max_l[r] - (C - x[r]));
      chmax(ans, sum_r[r] + max_l2[r]);
    }
  }
  out(ans);

  return 0;
}


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

using namespace std;

int main(){

	string in;

	cin >> in;

	if(in == "SUN"){
		cout << "7";
	}else if(in == "MON"){
		cout << "6";
	}else if(in == "TUE"){
		cout << "5";
	}else if(in == "WED"){
		cout << "4";
	}else if(in == "THU"){
		cout << "3";
	}else if(in == "FRI"){
		cout << "2";
	}else if(in == "SAT"){
		cout << "1";
	}

	return 0;
}

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

using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
    
  int n; cin >> n;
  vector<int> h(n), f(n,0);
  for(int i = 0; i < n; i++) cin >> h[i]; 
  f[1] = abs(h[1] - h[0]);
  for(int i = 2; i < n; i++){
    f[i] = min(abs(h[i] - h[i-1]) + f[i-1], abs(h[i] - h[i-2]) + f[i-2]);
  }
  cout << f[n-1] << "\n";
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,ct=0,oct=0;
    bool f[8];
    for(int i=0;i<8;i++) f[i]=true;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>=3200)oct++;
        else if(f[a/400]){
            f[a/400]=false;
            ct++;
        }
    }
    cout<<(ct==0?1:ct)<<" "<<ct+oct<<endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
base = [list(map(int,input().split())) for i in range(n)]

base.sort(key = lambda x:x[0])
sign = 0
ans = 0
judge = 0
for i in range(n):
  if  judge + base[i][1] <= m:
    judge = judge + base[i][1]
    ans = ans + base[i][1]*base[i][0]
  
  else:
    ans = ans + (m - judge)*base[i][0]
    break
    
print(ans)

Measured memory_bytes: 29028
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
bool psi_second_smaller(const psi& left, const psi& right) {
    return left.second < right.second;
}
string setwf(int num, int width, char fill){
    ostringstream oss;
    oss << setw(width) << setfill(fill) << num;
    return oss.str().c_str();
}
#endif


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

    int N, M; cin >> N >> M;
    vi P(M), Y(M); REP(i, M) cin >> P[i] >> Y[i];
    
    vector<vector<psi>> a(N, vector<psi>());
    REP(i,M) {
        a[P[i]-1].push_back(psi(to_string(P[i])+ to_string(Y[i]), Y[i]));
    }

    map<string, int> mp;
    REP(i,N) {
        vector<psi> b = a[i];
        sort(b.begin(), b.end(), psi_second_smaller);
        REP(i, b.size()) {
            mp[b[i].first] = i+1;
        }
    }

    REP(i,M){
        string key = to_string(P[i]) + to_string(Y[i]);     
        string ans = setwf(P[i], 6, '0') + setwf(mp[key], 6, '0');
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 19096
#include <stdio.h>
int n,A[2000];

int solve(int i, int m){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res = solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}

int main(){
  int q,m,i,j;

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

  scanf("%d",&q);

  for(j=0;j<q;j++){
    scanf("%d",&m);
    if(solve(0,m))printf("yes\n");
    else printf("no\n");
  }
  return 0;  
}



Measured memory_bytes: 2052
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;


int main()
{
    int N;
    long long K;
    cin >> N >> K;
    vector<pair<int,int>> num(N);
    for( int i = 0; i < N; ++i ){
        int a, b;
        cin >> a >> b;
        num[i] = make_pair( a, b );
    }


    sort( num.begin(), num.end() );
    long long sum = 0;
    for( int i = 0; i < N; ++i ){
        sum += num[i].second;
        if( K <= sum ){
            cout << num[i].first;
            break;
        } 
    } 

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int n,m;
  cin >> n >> m;
  vector<pair<int, ll>> yp;
  vector<int> data;


  rep(i,m) {
    ll t,s; cin >> t >> s;
    pair<int,ll> p = make_pair(s,i);
    yp.pb(p);
    data.pb(t);
  }

  sorti(yp);

  vector<int> sum(n+1,1);
  vector<pair<int,string>> ans;

  for (auto itr : yp) {
    int a,index;
    index = itr.second;

    // a:ken, t: junnbann
    a = data[index];
    int t = sum[a];
    sum[a]++;

    string str = "000000";
    string str1, str2;
    str1 = str + to_string(a);
    str2 = str + to_string(t);

    str1 = str1.substr(str1.size()-6,str1.size()-1);
    str2 = str2.substr(str2.size()-6,str2.size()-1);
    string res = str1 + str2;

    ans.pb({index,res});
  }

  sorti(ans);

  for (auto itr : ans) {
    cout << itr.second << endl;
  }
}


Measured memory_bytes: 10096
import numpy as np

s = input()[::-1]
length = len(s)
a = np.zeros(length, dtype=int)
d = np.zeros(length, dtype=int)
ans = np.zeros(2019, dtype=int)
x = 10

a[0] = int(s[0])
d[0] = a[0]
ans[d[0]] += 1

for i in range(1, length):
    a[i] = int(s[i]) * x % 2019
    d[i] = (d[i-1] + a[i]) % 2019
    ans[d[i]] += 1
    x = x * 10 % 2019

ans_c = ans[np.nonzero(ans)]

print(int(sum([ans_c[i] * (ans_c[i]-1) for i in range(ans_c.shape[0])]) / 2) + ans[0])

Measured memory_bytes: 30188
#include <iostream>

using namespace std;

int main(void)
{
	int h, n;
	cin >> h >> n;
	for (int i = 0; i < n && h > 0; ++i)
	{
		int a;
		cin >> a;
		h -= a;
	}

	if (h > 0)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int n,t,sum,maxn,maxn1,ans,a[100001];
int main()
{
    cin>>n>>t;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=n;i;i--)
    {
        maxn=max(a[i],maxn);
        sum=max(maxn-a[i],sum);
    }
    for(int i=n;i;i--)
    {
        maxn1=max(a[i],maxn1);
        if(maxn1-a[i]==sum) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
n,y=map(int,input().split())
for i in range(y//10000+1):
  for j in range((y-10000*i)//5000+1):
    if (y-(10000*i+5000*j))/1000==n-i-j:
      print(i,j,n-i-j)
      break
  else:
    continue
  break
else:
  print(-1,-1,-1)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int convPoints[51][51];
int sums[51][51];

int main()
{
    int N, K; cin >> N >> K;
    vector<pair<int, int>> points(N);
    set<int> xs, ys;
    for (int i = 0; i < N; ++i)
    {
        int x, y; cin >> x >> y;
        points[i] = { x, y };
        xs.insert(x);
        ys.insert(y);
    }
    // 座標を昇順に並べ替え2次元和にする
    map<int, int> x2IndexMap, y2IndexMap;
    map<int, LLONG> index2XMap, index2YMap;
    x2IndexMap.insert({ -2e9, 0 });
    y2IndexMap.insert({ -2e9, 0 });
    int index = 1;
    for (const int x : xs)
    {
        x2IndexMap.insert({ x, index });
        index2XMap.insert({ index, x });
        ++index;
    }
    index = 1;
    for (const int y : ys)
    {
        y2IndexMap.insert({ y, index });
        index2YMap.insert({ index, y });
        ++index;
    }
    for (int i = 0; i < N; ++i)
    {
        int xInd = x2IndexMap[points[i].first];
        int yInd = y2IndexMap[points[i].second];
        convPoints[xInd][yInd] = 1;
    }
    for (int i = 1; i < 51; ++i)
    {
        for (int j = 1; j < 51; ++j)
        {
            sums[i][j] = sums[i - 1][j] + sums[i][j - 1] - sums[i - 1][j - 1] + convPoints[i][j];
        }
    }
    // 2次元和を全探索:O(N^4)
    LLONG ans = 9223372036854775807;
    for (int x1 = 1; x1 <= N; ++x1) for (int x2 = x1; x2 <= N; ++x2)
        for (int y1 = 1; y1 <= N; ++y1) for (int y2 = y1; y2 <= N; ++y2)
        {
        int sum = sums[x2][y2] - sums[x1 - 1][y2] - sums[x2][y1 - 1] + sums[x1 - 1][y1 - 1];
        if (sum >= K)
        {
            LLONG area = (index2XMap[x2] - index2XMap[x1]) * (index2YMap[y2] - index2YMap[y1]);
            if (ans > area)
            {
                ans = area;
            }
        }
        }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S;
    cin >> S;
    string abc = "ABC", arc = "ARC";
    if (abc != S) cout << abc << '\n';
    else cout << arc << '\n';
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  rep(i,1,1000000){
    if((a*i-c)%b == 0){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,a[100005],num,b,minn; 
void dfs(int x){
	if(x==n||minn>=n-x) return;
	b=x;
	while(b<n) 
	{
		if(a[b]>=a[b+1]) num++;
		else break;
		b++;
	}
	minn=max(minn,num);
	num=0;
	dfs(x+1);
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    dfs(1);
    cout<<minn;
    return 0;
}

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

int main() {
    int N;
    cin>>N;
    vector<int> A(N);
    vector<bool> used(N, false);
    REP(i, 0, N) cin >> A[i];
    sort(A.begin(), A.end());

    long i = pow(2, 30);
    int count = 0;
    while(i > 1){
        int left = 0, right = N-1;
        while(left < right){
            if(A[left] + A[right] > i || used[right]) right--;
            else if(A[left] + A[right] < i || used[left]) left++;
            else{
                count++;
                used[left] = true;
                used[right] = true;
                right--; left++;
            }
        }
        i /= 2;
    }
    cout << count << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
	static void Main(string[] args)
	{
		long MOD = 1000000007;
		string[] input = Read();
		int n = int.Parse(input[0]);
		input = Read();
		long[] a = new long[n];
		for(int i=0;i<n;i++) a[i] = long.Parse(input[i]);

		long sum = 0;
		long buf = 0;
		for(int i=1; i<n; i++)
		{
			buf = (buf + a[i-1]) % MOD;
			sum = (sum + (buf * a[i]) % MOD) % MOD;
		}

		Write(sum);
	}

	static string[] Read()
	{
		return Console.ReadLine().Split(' ');
	}

	static void Write(object o)
	{
		Console.WriteLine(o.ToString());
	}
}



Measured memory_bytes: 46908
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n, k; cin>>n>>k;
    if(n%2==0){
        if(n/2>=k) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    else{
        if(n/2+1>=k) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  map<int,int> mp_count;
  for(int i=0;i<N;i++){mp_count[i+1] = 0;}
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a>> b;
    mp_count[a]+=1;
    mp_count[b]+=1;
  }
  for(int i=0;i<N;i++){
    cout << mp_count[i+1] << endl;
  }
}

Measured memory_bytes: 256
N, Q = map(int,input().split())
G = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)

W = [0 for _ in range(N)]
for _ in range(Q):
    p, x = map(int,input().split())
    p -= 1
    W[p] += x

ans = [0 for _ in range(N)]

F = [0]
ans[0] = W[0]
while F:
    v = F.pop()
    for c in G[v]:
        ans[c] = ans[v] + W[c]
        F.append(c)

print(" ".join(map(str,ans)))

Measured memory_bytes: 64852
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c == 17 && a*b*c == 175) {

		cout << "YES" << endl;
	}
	else { cout << "NO" << endl; }
}

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

int main(){
  int a,b[2];
  cin>>a;
  b[1]=a/100;
  b[0]=a%10;
  if(b[1]==b[0]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3560
import java.util.*;
import java.util.Scanner;

class Main{
	
	public static void main(String[] args){
		Scanner stdln = new Scanner(System.in);
		
		int[] a = new int [3];
		for(int i = 0;i <=2;i++){
			a[i] = stdln.nextInt();
		}
			
		int max = a[0];
		for(int i = 0;i <= 2;i++){
			if(max < a[i]) max = a[i];
		}
		
		System.out.print(((a[0] + a[1] + a[2]) - max));
	}
}

Measured memory_bytes: 22612
#include <stdio.h>
#include <stdlib.h>
#define N 100001

int A[N];
 
int partition(int, int);
 
int main(){
  int i,num,base;
  scanf("%d",&num);
  for(i=0; i<num; i++) scanf("%d",&A[i]);
  base = partition(0,num-1);
 
  for(i=0; i<num; i++){
    if(i == base) printf("[");
    printf("%d",A[i]);
    if(i == base) printf("]");
    if(i!=num-1) printf(" ");
  }
  printf("\n");
 
  return 0;
 
}



int partition(int p, int r){
  int x,i,j,temp;
  x = A[r];
  i = p - 1;
  for(j=p; j<r; j++){
    if(A[j] <= x){
      i++;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
    temp = A[i+1];
    A[i+1] = A[r];
    A[r] = temp;
   
  return i+1;
}

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

int main() {
  int H=0,W=0;
  cin >> H >> W;
  string unta="";
  vector<string> pic(H);
  for (int i=0;i<W+2;i++){
    unta+="#";
  }
  cout << unta << endl;
  for (int i=0;i<H;i++){
    cin >> pic.at(i);
    cout << "#"+pic.at(i)+"#" << endl;
  }
  cout << unta << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    static Scanner sc = null;
    static PrintWriter pw = null;

    static {

        try {
            sc = new Scanner(System.in);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static final long MOD = 1_000_000_007;

    private static String data;


    public static void main(String[] args) {
        data = sc.next();
        int [] dd = new int[2];
        int l = data.length() - 1;

        for (int endIndex = 0 ; endIndex < data.length() ; endIndex++) {
            int ii = data.charAt(endIndex) - '0';
            int [] dd1 = new int[2];
            for (int overcharge = 0 ; overcharge<= 1 ; overcharge++) {
                ii += overcharge;
                dd1[overcharge] = Math.min((endIndex == 0 ? 0 : dd[0]) + ii,
                        (endIndex == 0 ? 1 : dd[1]) + 10 - ii);
            }
            dd = dd1;

        }


        System.out.println(dd[0]);
    }





}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

ll num2(ll base){
  ll c = 0;
  while(base % 2 == 0){
	base /= 2;
	c += 1;
  }
  return c;
}


int main()
{
  ll n, a, c;
  cin >> n;
  forll(i, 0, n){
	cin >> a;
	c += num2(a);
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long int a[200001];
    int N;
    cin>>N;long int s=0;
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
        s^=a[i];
    }
    for(int i=0;i<N;i++)
    {long int b=s^a[i];cout<<b<<" ";}
    return 0;
}


Measured memory_bytes: 5064
import java.io.*;
import java.math.*;
import java.util.*;





public class Main {

    static MyScanner in = new MyScanner();
    static   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    int N;
    static int max = 200001;
    static int [] dr = {1,-1,0,0};
    static int [] dc={0,0,-1,1};
    public static void main(String args[]) throws IOException {
       int N = in.nextInt();
        boolean seven = false;
        while(N!=0){
            if(N%10==7)
                seven = true;
                N/=10;
        }
        out.println(seven?"Yes":"No");
        out.flush();
        }
       static boolean isEven(long a){
            return (a&1)==0;
        }
       static  void swap (int a, int b){

        int temmp = b;
        b=a;
        a = temmp;
        }
        static boolean same(int [] arr,int [] temp){
            Arrays.sort(arr);
           Arrays.sort(temp);
            for(int i=0;i<arr.length;i++){
                if(temp[i]!=arr[i])
                return false;
            }
            return true;
        }

 
  


    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
}

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define sz(s) (int)s.size()
#define all(v) v.begin(),v.end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef long double ld;
const ll inf = (ll)1e18;
const int N = (int)1e5+77;
const ll mod = (ll)1e9+7;

int n,a[N],b[N],c[N];
ll p[N],ans;

int main() {
    fast;
    cin >> n;
    forn(i, n) cin >> a[i];
    forn(i, n) cin >> b[i];
    forn(i, n) cin >> c[i];

    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    forn(i, n)p[i] = n - int(upper_bound(c, c + n, b[i]) - c);
    ford(i, n) p[i] += p[i + 1];

    forn(i, n) {
        auto pos = upper_bound(b, b + n, a[i]) - b;
        ans += p[pos];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
    double n;
    cin>>n;
    double s=0;
    for(int i=1;i<=n;i++){
        if(i%2!=0)
            s++;
    }
    cout<<fixed<<setprecision(10);
    cout<<s/n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
const int maxn = 2e5+5;
ll a[maxn];
map<ll,ll>mp, mp2;

int main(){
	int n; cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		mp[a[i]]++;
	}
	ll sum = 0;
	for(int i = 1; i <= n; i++){
		if(mp2[a[i]]) continue;
		sum += mp[a[i]] * (mp[a[i]]-1) / 2;
		mp2[a[i]] = 1;
	}
	for(int i = 1; i <= n; i++){
		cout << sum - mp[a[i]] + 1 << endl;
	}
}

Measured memory_bytes: 18944
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, A, B, C = sc.nextInt()
    val L = Array.fill(N)(sc.nextInt())

    // 先に合成した場合と, 後から合成した場合は同様.
    // N <= 8 なので, A, B, C, 合成に使わないという選択肢を全部に選んでも 4^8 = 2^16 = 65536 パターン

    def solve(): Int = {
      def dfs(i: Int, a: Int, b: Int, c: Int): Int =
        if (i < N)
          (dfs(i+1, a + L(i), b, c) + 10 ::
           dfs(i+1, a, b + L(i), c) + 10 ::
           dfs(i+1, a, b, c + L(i)) + 10 ::
           dfs(i+1, a, b, c)             :: Nil).min
        else if (a != 0 && b != 0 && c != 0)
          Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c) - 30
        else Int.MaxValue / 10

      dfs(0, 0, 0, 0)
    }

    println(solve())
  }

}


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

template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};

using namespace std;

void solve(){
    map<string ,int>m;
     int x;
     string s;
      cin>>x;
      int mx=0;
     for(int i=0;i<x;i++){
          cin>>s;
          m[s]++;
          mx=max(mx,m[s]);
     }
     for(auto r:m){
         if(r.second==mx)
             cout<<r.first<<"\n";
     }
}

int main(){
    std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   
 
    solve(); 
   
    return 0;
}


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

int main()
{
    using namespace std;
    string in;
    int c = 0;
    cin >> in;
    for(auto i = 0; i < 3; ++i){
        if(in[i] == '1'){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
L = 100000
dp = [[1000000001 for _ in range(L+1)] for _ in range(N+1)]
W, V = [], []
for _ in range(N):
    w, v = map(int, input().split())
    W.append(w)
    V.append(v)
dp[0][0] = 0
for i in range(N):
    for j in range(L+1):
        if j - V[i] >= 0:
            dp[i+1][j] = min(dp[i][j], dp[i][j-V[i]] + W[i])
        else:
            dp[i+1][j] = dp[i][j]
for i, d in enumerate(dp[N]):
    if d <= M:
        maxv = i
print(maxv)

Measured memory_bytes: 171400
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/
#include <bits/stdc++.h>
#define newline ("\n")
#define deb(x) cerr << (#x) << " = " << (x) << '\n'
#define MOD 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    long long count = 0;
    int n = s.size();
    int i = n - 1;
    int w_count = 0;
    for(;i >= 0;i--)
    {
        if(s[i] == 'W')
        {
            w_count++;
        }
        else
        {
            count += w_count;
        }
    }
    cout << count;

    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

typedef long long ll;
ll n, k, s, s1, s2, mx, a[N];
int main()
{
	ll i;
	cin >> n >> k;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]), s += max(0LL, a[i]);
	for (i = 0; i < k; i++) s1 += max(0LL, a[i]), s2 += a[i];
	mx = s - s1 + max(0LL, s2);
	for (i = k; i < n; i++) {
		s1 += max(0LL, a[i]) - max(0LL, a[i - k]);
		s2 += a[i] - a[i - k];
		mx = max(mx, s - s1 + max(0LL, s2));
	}
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int N, K, C;
    string S;
    cin >> N >> K >> C >> S;
    S = "x" + S;
    vector<int> L(K + 1, 0), R(K + 1, 0);
    int cnt = 1;
    for (int i = 1; i <= N; i++) {
        if (cnt == K + 1) {
            break;
        }
        if (S[i] == 'x') {
            continue;
        }
        L[cnt] = i;
        cnt++;
        i += C;
    }
    cnt = K;
    for (int i = N; i >= 1; i--) {
        if (cnt == 0) {
            break;
        }
        if (S[i] == 'x') {
            continue;
        }
        R[cnt] = i;
        cnt--;
        i -= C;
    }

    for (int i = 1; i <= K; i++) {
        if (L[i] == R[i]) {
            cout << L[i] << endl;
        }
    }
}


Measured memory_bytes: 3392
#include<iostream>
using namespace std;
int main(void)
{
	int D;
	int N;
	cin>>D;
	cin>>N;
	if(D==0)
	{
		if(N<=99)
		{
			cout<<N;
		}
		else if(N==100)
		{
			cout<<N+1;
		}
	}
	else if(D==1)
	{
		if(N<=99)
		{
			cout<<N*100;
		}
		else if(N==100)
		{
			cout<<(N+1)*100;
		}
	}
	else if(D==2)
	{
		if(N<=99)
		{
			cout<<N*100*100;
		}
		else if(N==100)
		{
			cout<<(N+1)*100*100;
		}
	}
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n;
    cin >> n;
    string ans;
    for (int i = 0; i < s.size(); i += n) {
        ans.push_back(s[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int a[SIZE];
int main(){
    int N,K;
    R(N,K);
    int ma=0;
    REP(i,K){
        R(a[i]);
        if(i)ma=max(a[i]-a[i-1],ma);
    }
    ma=max(ma,a[0]+N-a[K-1]);
    W(N-ma);
    return 0;
}


Measured memory_bytes: 1024
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))[:-X-1:-1]
q = sorted(list(map(int, input().split())))[:-Y-1:-1]
r = sorted(list(map(int, input().split())))[:-X-Y-1:-1]

p.extend(q)
p.extend(r)
print(sum(sorted(p)[:-X-Y-1:-1]))

Measured memory_bytes: 108780
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
#include<deque>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define double long double
	const int INF=0x3f3f3f3f;
	const ll LLINF=0x3f3f3f3f3f3f3f3fll;
	ll qread()
	{
		ll ans=0;char c=getchar();int f=1;
		while(c<'0' or c>'9') {if(c=='-') f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) {num=-num;putchar('-');}
		if(num>9) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);puts("");}
	#define FR first
	#define SE second
	#define MP make_pair
	#define pr pair<int,int>
	#define PB push_back
	#define vc vector
	void chmax(ll &x,const ll y) {x=x>y?x:y;}
	void chmin(ll &x,const ll y) {x=x<y?x:y;}
	const int MAX_N=3e2+10;
	const ll MOD=998244353;
	void add(int &x,int y){x+=y;if(x>=MOD) x-=MOD;if(x<0) x+=MOD;}
	ll qpower(ll x,int e)
	{
		ll ans=1;
		while(e)
		{
			if(e&1) ans=ans*x%MOD;
			x=x*x%MOD;e>>=1;
		}
		return ans;
	}
	ll inv(ll x){return qpower(x,MOD-2);}

	int f[MAX_N][MAX_N*MAX_N*2],g[MAX_N][MAX_N*MAX_N];
	#define F(i,j) f[i][MAX_N*MAX_N+j]
	#define G(i,j) g[i][MAX_N*MAX_N+j]
	void main()
	{
		int n=qread(),sum=0;F(0,0)=1;G(0,0)=1;
		for(int i=1;i<=n;i++)
		{
			int aa=qread();
			for(int s=-sum;s<=sum;s++)
			{
				add(F(i,s+aa),F(i-1,s));
				add(F(i,s-aa),1ll*F(i-1,s)*2%MOD);
				add(G(i,s+aa),G(i-1,s));
				add(G(i,s-aa),G(i-1,s));
			}
			sum+=aa;
		}
		int ans=qpower(3,n);
		for(int s=0;s<=sum;s++) add(ans,-(ll)F(n,s)*3%MOD);
		if(sum%2==0) add(ans,(ll)G(n,0)*3%MOD);
		write((ans+MOD)%MOD);
	}
};
signed main()
{
//	freopen("connect.in","r",stdin);
//	freopen("connect.out","w",stdout);
	srand(time(0));
	mine::main();
}


Measured memory_bytes: 340224
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int):
    if A == B and A != C:
        print('Yes')
    elif A == C and A != B:
        print('Yes')
    elif B == C and B != A:
        print('Yes')
    else:
        print('No')
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
int p[11]={};
int x,i;
i=0;x=0;
while(scanf("%d",&x)!=EOF)
{
if(x>0){p[i]=x;i++;}
else{i--;printf("%d\n",p[i]);}

}
return 0;
}

Measured memory_bytes: 1028
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_D
  * Structured Program I - Structured Programming
  */
object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    //Memory Limit Exceeded
    //    val result = (1 to n).filter(i => i % 3 == 0 || i.toString.contains('3'))
    //      .foldLeft("") { (str, i) => str + s" $i" }
    val result = " " + (1 to n).filter(i => i % 3 == 0 || i.toString.contains('3')).mkString(" ")
    println(result)
  }
}

Measured memory_bytes: 48496
num_of_d = 1
while True:

    n = input()
    n = int(n)

    score_a = 0
    score_b = 0

    if n < 0 or n > 10000:
        continue
    if n == 0:
        break
    if num_of_d > 5:
        break
        
    for i in range(0, n):


        a, b = list(map(int, input().split()))
        a = int(a)
        b = int(b)

        if a > b:
            score_a += a+b
        elif a < b:
            score_b += a+b
        else :
            score_a += a
            score_b += b

    num_of_d += 1
    print('{0} {1}' .format(score_a, score_b))
    


Measured memory_bytes: 5608
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
#define exist_in(list, value) (list.end() != std::find(all(list),value))
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
//template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
//template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
//template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
//template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
//template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }
//template<class T1, class T2> bool exist_in(const T1& list, const T2& v) { return (list.end() != std::find(list.begin(), list.end(), v)); }
//template<class T> bool exist_in(const T& c, const typename T::value_type& v) {	return (c.end() != std::find(c.begin(), c.end(), v));}

/*****/

void Main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int min = INF;
	chmin(min, a + b);
	chmin(min, a + c);
	chmin(min, c + b);
	cout << min;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
N = int(input())

work = [[] for i in range(N)]

for i in range(N):
    a,b = map(int,input().split())
    work[i] = [b,a]

work.sort()
total = 0
for i in range(N):
    total += work[i][1]
    if total > work[i][0]:
        print('No')
        exit(0)
print('Yes')

Measured memory_bytes: 38068
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
m = map(int,read().split())
AB = list(zip(m,m))

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

root = 1
parent = [0] * (N+1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

color = [-1] * (N+1)
for x in order:
    ng = color[x]
    c = 1
    for y in graph[x]:
        if y == parent[x]:
            continue
        if c == ng:
            c += 1
        color[y] = c
        c += 1

answer = []
append = answer.append
for a,b in AB:
    if parent[a] == b:
        append(color[a])
    else:
        append(color[b])

K = max(answer)
print(K)
print('\n'.join(map(str,answer)))

Measured memory_bytes: 38292
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np
from collections import Counter

N = int(input())

S = np.array(sys.stdin.readlines(), dtype=np.int64)

U = int(10 ** 3.4)
is_prime = np.zeros(U+1, dtype=np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3,U+1,2):
    if p*p > U:
        break
    if is_prime[p]:
        is_prime[p*p::2*p] = 0

primes = is_prime.nonzero()[0]

# 3乗で割る
for p in primes:
    tr = p*p*p
    while True:
        bl = (S % tr == 0)
        if bl.any():
            S[bl] //= tr
        else:
            break

square_part = np.ones_like(S)
free_part = S.copy() # 厳密には違うが
for p in primes:
    sq = p*p
    bl = (S % sq) == 0
    free_part[bl] //= sq
    square_part[bl] *= p
# 相手が自分より大きいならば必ず正しく計算できている
opposite = free_part * free_part * square_part

x_to_y = dict(zip(S,opposite))

counter = Counter(S)
answer = 0
for x,cx in counter.items():
    if x == 1:
        answer += 1
        continue
    y = x_to_y[x]
    if x > y:
        # とりあえずxを採用しておく
        answer += cx
        continue
    cy = counter[y]
    answer -= cy
    answer += max(cx,cy)

print(answer)

Measured memory_bytes: 40252
#include <iostream>

using namespace std;

int main(){
	int N;
	int *a = NULL;
	int min;
	int min_num;
	int min_length;

	cin >> N;

	a = new int[N];

	for(int i = 0; i < N; i++){
		cin >> a[i];
	}

	for(int i = 0; i < N; i++){
		min = a[i];
		min_num = i;
		for(int j = i; j < N; j++){
			if(min > a[j]){
				min = a[j];
				min_num = j;
			}
		}
		a[min_num] = a[i];
		a[i] = min;
	}

	min_length = a[N-1] - a[0];

	cout << min_length << endl;

	delete[] a;
	return 0;
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

template <typename T> class Vector2D
{
	public:
		T x, y;

		Vector2D(T x, T y)
		{
			this->x = x;
			this->y = y;
		}
};

template <typename T>
T inner(Vector2D<T> a, Vector2D<T> b)
{
	return a.x * b.x + a.y * b.y;
}

int main()
{
	vector<float> x(4);
	vector<float> y(4);
	for (; cin >> x.at(0) >> y.at(0) >> x.at(1) >> y.at(1) >> x.at(2) >> y.at(2) >> x.at(3) >> y.at(3);)
	{
		Vector2D<float> ab = Vector2D<float>(x.at(1) - x.at(0), y.at(1) - y.at(0));
		Vector2D<float> cd = Vector2D<float>(x.at(3) - x.at(2), y.at(3) - y.at(2));

		cout << (inner(ab, cd) == 0 ? "YES" : "NO") << endl;
	}
}


Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int k = scan.nextInt();
		int sum = 0;

		if(a <= k) {
			k -= a;
			sum += a;
		}else {
			sum += k;
			k = 0;
		}

		if(k == 0) {

		}else if(b <= k){
			k -= b;
		}else {
			k = 0;
		}

		if(k == 0) {

		}else if(c <= k){
			k -= c;
			sum -= c;
		}else {
			sum -= k;
			k = 0;
		}

		System.out.println(sum);
	}
}


Measured memory_bytes: 35740
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

const int MAX { 1000010 };
const ll MOD { 1000000007 };
const double PI = acos(-1.0);

int main(){
	ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;

    int sum_N = 0;
    int min = MAX;
    int aux_N = N;
    while(aux_N--){
        int aux;
        cin >> aux;
        sum_N+= aux;
        if(aux < min) min = aux;
    }
    X -= sum_N;

    cout << N + X/min << endl;

	return 0;
}

Measured memory_bytes: 3608