akhauriyash/Code-Regression huggingface dataset:
N, K = [int(x) for x in input().split()]

result = {}
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    if a in result:
        result[a] += b
    else:
        result[a] = b

result = sorted(result.items())

now = 0
for key, value in result:
    now += value

    if now >= K:
        print(key)
        exit()


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

int main() {
  int N, C; cin >> N >> C;
  vector<vector<int>> D(C, vector<int>(C));
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) cin >> D.at(i).at(j);
  }
  vector<vector<int>> c(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int color;
      cin >> color;
      c.at(i).at(j) = color - 1;
    }
  }
  vector<vector<int>> cnt(3, vector<int>(C));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cnt.at((i + j) % 3).at(c.at(i).at(j))++;
    }
  }
  long long ans = 1LL << 50;
  for (int x = 0; x < C; x++) {
    for (int y = 0; y < C; y++) {
      for (int z = 0; z < C; z++) {
        if (x == y || y == z || z == x) continue;
        long long tmp = 0;
        for (int i = 0; i < C; i++) {
          tmp += D.at(i).at(x) * cnt.at(0).at(i);
        }
        for (int i = 0; i < C; i++) {
          tmp += D.at(i).at(y) * cnt.at(1).at(i);
        }
        for (int i = 0; i < C; i++) {
          tmp += D.at(i).at(z) * cnt.at(2).at(i);
        }
        ans = min(ans, tmp);
      }
    }
  }
  cout << ans << endl;
}

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

int main() {
	long n;
	cin >> n;
	int fn = 0, N = n;
	while (n > 0) {
		fn += n % 10;
		n /= 10;
	}
	
	if (N % fn == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
  
signed main() {
    fast;
    int x;
    cin>>x;
    int y=x/500;
    x=x%500;
    int sum=1000*y;
    x=x/5;
    sum+=(x*5);
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	long long int a, b, div_a, div_b, mul, r;

	while (scanf("%lld %lld", &a, &b) != EOF){
		div_a = a;
		div_b = b;
		while (div_a % div_b != 0){
			r = div_a % div_b;
			div_a = div_b;
			div_b = r;
		}
		mul = (a * b) / div_b;
		printf("%lld %lld\n", div_b, mul);
	}
	
	return (0);
}

Measured memory_bytes: 596
#include <stdio.h>
#define MAX 100
#define BLACK 2
#define GRAY 1
#define WHITE 0

int n,A[MAX][MAX],d[MAX],p[MAX],color[MAX],cnt = 0;

int main(){
  int i,j,k,u,min;

  scanf("%d",&n);

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

  for(i = 0; i < n; i++){
    color[i] = 0;
    p[i] = -1;
    d[i] = 99999;
  }

  d[0] = 0;
  while(1){
    min = 99999;
    u = -1;
    for(i = 0; i < n; i++){
      if(color[i] != BLACK && d[i] < min){
	min = d[i];
	u = i;
      }
    }

    if(u == -1) break;

    color[u] = BLACK;

    for(k = 0; k < n; k++){
      if(color[k] != BLACK && A[u][k] != -1){
	if(A[u][k] < d[k]){
	  d[k] = A[u][k];
	  p[k] = u;
	  color[k] = GRAY;
	}
      }
    }
  }

  for(i = 0; i < n; i++){
    if(p[i] != -1) cnt += A[i][p[i]];
  }

  printf("%d\n",cnt);
}





Measured memory_bytes: 2048
# -*- coding:utf-8 -*-
n = int(input())
S = []
ans = []
for factor in range(n):
    S.append(input())
for tmp in "abcdefghijklmnopqrstuvwxyz":
    l = []
    for tmp2 in range(n):
        l.append(S[tmp2].count(tmp))
    factor = min(l)
    for tmp3 in range(factor):
        ans.append(tmp)
s = ''.join(ans)
print(s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int n,i,t[805],nr,j,k,poz;
map <int,int> fv;
set < pair <int, pair <int,int> >> st;
int main()
{   cin>>n;
    for (i=1; i<=n; i++)
        {
            cin>>k;
            //if (fv[k]==0) t[++poz]=k,fv[k]=1;
            t[++poz]=k;
        }
    n = poz;
    sort(t+1,t+n+1);
    for (i=1; i<=n-2; i++)
        for (j=i+1; j<=n-1; j++)
         for (k=j+1; k<=n; k++)
          if (t[i]+t[j]>t[k] && t[i]!=t[j] && t[i]!=t[k] && t[j]!=t[k] && t[j]+t[k]>=t[i] && t[i]+t[k]>=t[j]) nr++;
    cout<<nr;
    return 0; }

Measured memory_bytes: 3528
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する
ll mod = 1000000007;

int arr[201];//iはi-100の出現回収を表す

int func(int k){
    int ret = 0;
    for(int i = -100 ; i <= 100; i++){
        int app = arr[i + 100];
        ret += (app) * (k - i) * (k - i);
    }
    return ret;
}

int main() {
    int N;
    cin >> N;
    REP(i,0,N){
        int inp;
        cin >> inp;
        arr[inp+100]++;
    }
    int ans = (1 << 25);
    REP(i,0,201){
        int k = i - 100;
        ans = min(ans,func(k));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main()
{
  char s1[3] = {0};
  char s2[3] = {0};
  char buf;
  
  scanf("%s", s1);
  scanf("%s", s2);
  
  buf = s2[0];
  s2[0] = s2[2];
  s2[2] = buf;
  
  if(strcmp(s1, s2) == 0){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	int a, b, ans = 1;
	cin >> a >> b;
	for (int i = 0;; i++) {
		if (ans >= b) {
			cout << i << endl;
			return 0;
		}
		ans = ans + a - 1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int n, a[10009], sum;
 
int main() {
	cin >> n;
  //not giving the statement clear is atcoders culture mf
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		while (a[i] % 2 == 0) { a[i] /= 2; sum++; }
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n = _i()
    a = _ia()
    ret = [0]*n
    for ai in a:
        ret[ai-1] += 1
    return "\n".join(map(str, ret))


if __name__ == "__main__":
    print(main())


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

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

    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    vector<int> ans(N);

    vector<int> temp(N);
    for (int i = 0; i < N; i++) {
        temp.at(i) = A.at(i);
    }

    sort(temp.begin(), temp.end());
    int maxvalue = temp.at(N - 1);
    int secondvalue = temp.at(N - 2);

    int pos_maxvalue;
    for (int i = 0; i < N; i++) {
        if (maxvalue == A.at(i)) pos_maxvalue = i;
    }

    for (int i = 0; i < N; i++) {
        if (i == pos_maxvalue) cout << secondvalue << endl;
        else cout << maxvalue << endl;
    }

    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int a[1000001];

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

    for (int i = 1;; i++) {
        if (a[s]) {
            cout << i << endl;
            exit(0);
        }
        a[s] = i;
        s = s % 2 == 0 ? s / 2 : 3 * s + 1;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    //#define int long long
    typedef long long ll;
    #define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
    #define forn(i, n) fore(i, 0, n)
    #define fori(i, l, r) fore(i, l, (r) + 1)
    #define sz(v) int((v).size())
    #define all(v) (v).begin(), (v).end()
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    using namespace std; 
     
    const double PI = atan(1)*4;

    int dx[8]={1,0,-1,0,1,-1,-1,1};
    int dy[8]={0,1,0,-1,1,1,-1,-1};
     
     
    bool isprime(int n)
    {
        for(int i=2;i*i<=n;i++)
            if(n%i==0)
                return false;
        return true;
    }
     
    bool comp(pair<int,int> a, pair<int,int> b)
    {
        return b.ff < a.ff ;
    }
     
    int modpow(int b,int p,int m)
    {
        if(p==0) return 1%m;
        if(p%2) return (b*modpow(b,p-1,m))%m;
        int u=modpow(b,p/2,m);
        return (u*u)%m;
    }
     
    int fn(int x,int y,int z)
    {
        int ans=((x-y)*(x-y) + (y-z)*(y-z) + (z-x)*(z-x) );
        //cout<<x<<" "<<y<<" "<<z<<"\n";
        return ans; 
    }
     
    /*void bsearch(int max,int min)   //  for function 
    //void bsearch(int a,int n, int x)     // for array
    {
        int k=min;
     
        //  for array
     
    /*    for(int b=n/2; b>=1; b/=2)
        {
            while(k+b<n && arr[k+b]<=x) k+=b; 
        }
     
        if(arr[k]==x)
            cout<<"found at "<<k+1;
        else
            cout<<"not found";
    */
     
        //  for function 
     
    /*    for(int b=max; b>=1; b/=2)
        {
            while( !fn(b+k) ) k+=b;
        }
        cout<<k+1;
     
    }*/
     
     
    int main()
    {
     
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
     
        int t=1;
        //cin>>t;
     
        while(t--)
        {
            int n,m,x;
            cin>>n>>m>>x;

            int a[n][m+1];
            forn(i,n)
            {
                forn(j,m+1)
                    cin>>a[i][j];
            }    
            
            ll min=LLONG_MAX;

            for(int i=1;i< (1<<n) ; i++)
            {
                int sum[m+1]={0};
                for(int j=0 ; j<n+1 ; j++)
                {
                    if((1<<j) & i)
                    {
                    //    cout<<i<<" "<<j<<"\n";
                        forn(k,m+1) sum[k]+=a[j][k];
                    }
                }
                int ok=1;
                for(int z=1;z<=m;z++)
                    if(sum[z] < x)
                        ok=0;
                if(ok)   
                    if(min>sum[0])
                        min=sum[0];
            }

            if(min==LLONG_MAX)
                cout<<-1;
            else
                cout<<min;
        }
        return 0;
    }

Measured memory_bytes: 3636
from collections import deque
def main4():
    S = input()

    i = 0
    tmp = ""
    sub = deque()
    while True:
        j = 1
        while i + j <= len(S):
            if S[i:i+j] != tmp:
                sub.append(S[i:i+j])
                tmp = S[i:i+j]
                i = i + j
                break
            else:
                j += 1

        if i + j > len(S):
            if S[i:i+j] != "":
                if sub[-1] == S[i:i+j]:
                    e = sub.pop()
                    sub.append(e + S[i:i+j])
                else:
                    sub.append(S[i:i+j])
            break
    
    print(len(sub))
    
if __name__ == "__main__":
    main4()

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {
    string s;
    cin>>s;
    
    if(s.size()==2) cout << s << endl;
    else cout << s[2] << s[1] << s[0] << endl;
    
    return 0;
}


Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

def dfs(y0, y1, x0, x1):
    global k
    m = 0
    tmp = []
    for i in range(y0, y1):
        for j in range(x0, x1):
            a[i][j] = k
            if s[i][j] == '#':
                tmp.append([i, j])
                m += 1
            if m == 2:
                break
        else:
            continue
        break
    if m == 1:
        k -= 1
    else:
        if tmp[0][0] != tmp[1][0]:
            pos = max(tmp[0][0], tmp[1][0])
            dfs(y0, pos, x0, x1)
            dfs(pos, y1, x0, x1)
        else:
            pos = max(tmp[0][1], tmp[1][1])
            dfs(y0, y1, x0, pos)
            dfs(y0, y1, pos, x1)

h, w ,k = MAP()
s = []
a = [[0]*w for i in range(h)]
for i in range(h):
    s.append(input())

dfs(0, h, 0, w)
for i in range(h):
    print(*a[i][:])

Measured memory_bytes: 78384
list = list(map(int,input().split(" ")))
if(list[0]>list[1]):
    max= max(list[0]+list[1],list[0]+(list[0]-1))
    print(max)
else :
    max = max(list[0] + list[1], list[1] + (list[1] - 1))
    print(max)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

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
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    string s; cin >> s;
    ll L = s.size();

    auto ans = s.substr(0, L-8);
    p(ans);
    
    return 0;
}

Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N, M;
    cin >> N; vector<string> blue(N);
    for(int i=0; i<N; i++) cin >> blue[i];
    cin >> M; vector<string> red(M);
    for(int i=0; i<M; i++) cin >> red[i];

    int ans = 0;
    for(int i=0; i<N; i++) {
        string target = blue[i];
        int score = 0;
        for(int j=0; j<N; j++) {
            score += (target == blue[j]);
        }
        for(int j=0; j<M; j++) {
            score -= (target == red[j]);
        }
        chmax(ans, score);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
    int A, B; cin >> A >> B;
    int ans;

    if(A > B) {
        ans = A + (A-1);
    } else if(B > A){
        ans = B + (B-1);
    } else {
        ans = A + B;
    }
    cout << ans << endl;
}

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

int main() {
  int n, a, b, c, d;
  cin >> n;
  a = n / 1000;
  b = (n - a * 1000) / 100;
  c = (n - a * 1000 - b * 100) / 10;
  d = n - a * 1000 - b * 100 - c * 10;
  
  if (a == b && b == c){
    cout << "Yes" << endl;
  }
  else if (d == b && b == c){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))


int main() {
    int N, M, X;
    cin >> N >> M >> X;
    int A[M];
    for(int i=0; i<M; i++) {
        cin >> A[i];
    }
    int num_left = 0; 
    int num_right = 0;
    for(int i=0; i<M; i++) {
        if(A[i] < X) {
            num_left++;
        }
        else {
            num_right++;
        }
    }
    int result = num_left < num_right? num_left:num_right;
    cout << result << endl;
    return 0;
}



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

int main() {
  int N;
  int lower, upper; 
  cin >> N;
  lower = ceil(N / 1.08);
  upper = floor((N+1)/1.08 - .001);
  
  if (upper >= lower) cout << lower << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>

#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
using P = std::pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvP = vector<vector<P>>;
using vP = vector<P>;
//using bint = boost::multiprecision::cpp_int;



// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

const int INF = 1001001001;


int main(){
    int h,n;
    cin >> h >> n;
    vector<int> dp(h+1,INF);
    dp[0] = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        rep(j,h){
            int nj = min(j+a,h);
            dp[nj] = min(dp[nj],dp[j]+b);
        }
    }
    cout << dp[h] << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	long long n;
	scanf("%lld", &n);
	long long x;
	long long min = 1000000000000000;
	for(int i = 0; i < 5; i++){
		scanf("%lld", &x);
		if(x < min){
			min = x;
		}
	}
	long long cnt = (n/min) + 4;
	if(n % min != 0){
		cnt++;
	}
	printf("%lld", cnt);
}

Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll mod=1e+9;
int check(int a){
    int res=0;
    while(a!=0){
        res+=a-(a/10)*10;
        a/=10;
    }
    return res;
}
int main(){
int a;
cin>>a;
int b=check(a);
if(a%b==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919810893;
const ll MOD = 1000000007;
const ll NUM = 101010;

// サイズ可変mod
class mod{
    public:
    ll N, M;
    vector<ll>fact;
    vector<ll>inv;
    vector<ll>finv;

    ll m_plus(ll a, ll b){return (a + b) % M;}
    ll m_minus(ll a, ll b){return (a + M - b) % M;}
    ll m_times(ll a, ll b){return (a * b) % M;}
    ll m_pow(ll a, ll b){
        ll ret = 1;
        while(b > 0){
            if(b & 1)(ret *= a) %= MOD;
            (a *= a) %= MOD;
            b >>= 1;
        }
        return ret;
    }

    void update(ll n){
        if(N > n)return;
        for(ll i = N; i <= n; i++){
            fact.push_back(m_times(fact[i - 1], i));
            inv.push_back(m_pow(i, M - 2));
            finv.push_back(m_times(finv[i - 1], inv[i]));
        }
        N = n + 1;
    }

    // 除算
    ll m_divs(ll a, ll b){
        if(N <= b)update(b);
        return m_times(a, inv[b]);
    }

    // N種の要素を並び替えてできる通りの数
    ll m_fact(ll a){
        if(N <= a)update(a);
        return fact[a];
    }

    // 階乗で割る
    ll m_finv(ll a){
        if(N <= a)update(a);
        return finv[a];
    }

    // N種の要素からk個取り出して並べる通りの数
    ll m_nPk(ll n, ll k){
        return m_times(m_fact(n), m_finv(n - k));
    }
    // N種の要素からk個を選ぶ通りの数
    // a個の赤い玉とb個の青い球を並び替える通りは(a+b)C(a)
    ll m_nCk(ll n, ll k){
        return m_times(m_nPk(n, k), m_finv(k));
    }
    // N種の要素からk個を選ぶ通りの数(重複して良い)
    ll m_nHk(ll n, ll k){
        return m_nCk(n + k - 1, k);
    }
    
    mod(ll m){
        M = m;
        N = 1;
        fact = vector<ll>(1, 1);
        inv = vector<ll>(1, 1);
        finv = vector<ll>(1, 1);
    }
};

int main(){
    mod m(MOD);

    ll H, W, h, w;
    cin >> H >> W >> h >> w;
    ll ans = 0;
    for(ll x = w + 1; x <= W; x++){
        ll y = H - h;
        ll tmp = (m.m_nCk(y + x - 1 - 1, x - 1) * m.m_nCk(h - 1 + W - x, W - x)) % MOD;
        ans = (ans + tmp) % MOD;
    }
    cout << ans << endl;

    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    string S;
    cin >> S;
    ll N = S.size();

    vector<pll> len;
    if(S[0] == '>') len.push_back({0, 0});
    REP(i, N){
    	int j = i;
    	while(j<N && S[i]==S[j]) j++;
    	len.push_back({j-i, (S[i]=='<' ? 0 : 1)});
        i = j-1;
    }
    if(S[N-1] == '<') len.push_back({0, 1});

    ll M = len.size();
    ll res = 0;
    REP(i, M/2){
    	ll ma = max(len[2*i].first, len[2*i+1].first);
        ll mi = min(len[2*i].first, len[2*i+1].first);
    	res += ma*(ma+1)/2;
        res += (mi-1)*(mi)/2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5524
// A - A+...+B Problem
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, w, ans = 0, count = 0;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> n >> a >> b;

  if (a > b)
  {
    cout << 0 << endl;
  }
  else if (n == 1 && a != b)
  {
    cout << 0 << endl;
  }
  else if (n == 1 && a == b)
  {
    cout << 1 << endl;
  }
  else
  {
    c = b - a + 1;
    ans = c * (n - 2) - (n - 3);
    cout << ans << endl;
  }
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1)
        a += 13;
    if (b == 1)
        b += 13;
    if (a > b)
        cout << "Alice" << endl;
    else if (a == b)
        cout << "Draw" << endl;
    else
        cout << "Bob" << endl;
    return 0;
}

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

int main() {

	int a, b;
	char op;

	while(1) {
		scanf("%d %c %d", &a, &op, &b);

		if (op == '?') {
			break;
		}

		if (op == '+') {
			printf("%d\n", a + b);
		} else if (op == '-') {
			printf("%d\n", a - b);
		} else if (op == '*') {
			printf("%d\n", a * b);
		} else if (op == '/') {
			printf("%d\n", a / b);
		}
	}

	return 0;
}

Measured memory_bytes: 1028
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long l, long long r, long long d){
    int t1 = (l - 1) / d;
    int t2 = r / d;
    cout << t2 - t1 << endl;
}


signed main(){
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    long long d;
    scanf("%lld",&d);
    solve(L, R, d);
    return 0;
}


Measured memory_bytes: 3684
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	while (1) {
		int x, y, s;
		int ret = 0;
		scanf("%d%d%d", &x, &y, &s);
		if (x == 0)break;
		for (int i = 1; i < s; i++) {
			for (int j = 1; j < s; j++) {
				int ci = (i*(100 + x)) / 100;
				int cj = (j*(100 + x)) / 100;
				int di = (i*(100 + y)) / 100;
				int dj = (j*(100 + y)) / 100;
				if (ci + cj == s)ret = max(ret, di + dj);
			}
		}
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 2692
a, b=map(int, input().split())
ans1=[]
ans2=[]
if b<=a:
    for i in range(a):
        ans1.append(b)
else:
    for i in range(b):
        ans2.append(a)

if b<=a:
    ans1=int("".join(map(str, ans1)))
    print(ans1)
else:
    ans2=int("".join(map(str, ans2)))
    print(ans2)

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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream &operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }
template<typename T>
T lcm(T a, T b) { if(a==0 or b==0) return 0; return a/gcd(a, b)*b; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 1e15;
const int modn = 1e9+7;
const int maxn = 1<<16;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    int n;
    cin>>n;
    int limit = 1<<n;
    vvi a(n, vi(n));
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            cin>>a[i][j];
        }
    }
    vi pre(limit);
    for(int i=0; i<limit; i++) {
        for(int j=0; j<n; j++) {
            if(i&(1<<j))
            for(int k=j+1; k<n; k++){
                if(i&(1<<k)) {
                    pre[i] += a[j][k];
                }
            }
        }
    }
    vi dp(limit);
    for(int i=1; i<limit; i++) {
        for(int j=i; j>0 ; j=((j-1)&i)) {
            dp[i] = max(dp[i], pre[j] + dp[i^j]);
        }
    }
    cout << dp.back() << "\n";
    return 0;
}



Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(void)
{
    int a,ans=1;
    cin >> a;
    vector<int> b(a);
    for(int i =0;i < a;i++)
        cin >> b[i];

    sort(b.begin(),b.end());

    for(int i = 1;i < a;i++){
        if(b[i] > b[i-1])
            ans++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int H, W;
#define INF pow(2,15)
/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main() {

    ////////////////////////////////////////
    /* 入力受け取り */
    ////////////////////////////////////////

    /* 縦と横の長さ */
    int H, W;
    cin >> H>>W;
    /* スタート地点とゴール地点 */
    int sx, sy, gx, gy;
    //cin >> sy>> sx;
    //cin >> gy>>gx;
    sx=0;
    sy=0;
    gx=W-1;
    gy=H-1;
    /* 盤面 */
    vector<string> field(H);
    REP(i, H) cin >> field[i];
    /*
    REP(i, H){
        REP(j, W){
            if(field[i][j] == 'S') {
                sx = j; sy=i;
            }
            if(field[i][j] == 'G'){
                gx = j; gy =i;
            }
        }
    }
    */

   int cnt=0;
    REP(i, H){
        REP(j, W){
            if (field[i][j]=='.') cnt++;
        }
    }
    ////////////////////////////////////////
    /* 幅優先探索の初期設定 */
    ////////////////////////////////////////

    // 各セルの最短距離 (訪れていないところは -1 としておく)
    vector<vector<int>> dist(H, vector<int>(W, -1));
    dist[sy][sx] = 0; // スタートを 0 に

    // 探索中に各マスはどのマスから来たのかを表す配列 (最短経路長を知るだけなら、これは不要)
    vector<vector<int>> prev_x(H, vector<int>(W, -1));
    vector<vector<int>> prev_y(H, vector<int>(W, -1));

    // 「一度見た頂点」のうち「まだ訪れていない頂点」を表すキュー
    queue<pair<int,int>> que;
    que.push(make_pair(sy, sx)); // スタートを push


    ////////////////////////////////////////
    /* 幅優先探索を実施 */
    ////////////////////////////////////////    

    /* キューが空になるまで */
    while(!que.empty()){
        pair<int, int> current_pos = que.front();
        // キューの先頭を見る (C++ ではこれをしても pop しない)
        int y = current_pos.first;
        int x = current_pos.second;
        // キューから pop を忘れずに
        que.pop();
        // 隣接頂点を探索
        REP(direc, 4){
            int nx = x + dx[direc];
            int ny = y + dy[direc];
            if(nx<0||nx>=W||ny<0||ny>=H) continue; // 場外アウトならダメ
            if (field[ny][nx] == '#') continue;// 壁はダメ

            // まだ見ていない頂点なら push
            if(dist[ny][nx] == -1){
                que.push(make_pair(ny, nx));
                dist[ny][nx] = dist[y][x] + 1;// (next_x, next_y) の距離も更新
                prev_x[ny][nx] = x; // どの頂点から情報が伝播して来たか、縦方向の座標をメモ
                prev_y[ny][nx] = y; // どの頂点から情報が伝播して来たか、横方向の座標をメモ
            }
        }
    }

    int dist_g = dist[gy][gx];
    //cout << "dist= " << dist_g << endl;
    if (dist_g==-1) cout << -1 << endl;
    else{
    //cout << "cnt = " << cnt-1 << endl;
    cout << cnt -1 - dist_g << endl;

    }
    ////////////////////////////////////////
    /* 結果出力 */
    ////////////////////////////////////////    
    /* 
    int x = gx, y = gy;
    while (x != -1 && y != -1) {
        field[y][x] = 'o'; // 通過したことを示す

        // 前の頂点へ行く
        int px = prev_x[y][x];
        int py = prev_y[y][x];
        x = px, y = py;
    }
    REP(i, H) {
        REP(j,W){
            cout << std::setw(1) << field[i][j];
        }
        cout << endl;
    } */
    
}

Measured memory_bytes: 256
a,b,c,d,e,f = map(int, input().split())

w = [i+j for i in range(0,f+1,100*a) for j in range(0,f+1,100*b) if i+j <= f]
s = [i+j for i in range(0,f+1,c) for j in range(0,f+1,d) if i+j <= f]

W = w[-1]
S = 0
for ww in w :
    for ss in s :
        if ww+ss > f or ww == 0:
            continue
        elif ss/(ss+ww) > S/(W+S) and e >= 100*ss/ww:
            W = ww
            S = ss

print(W+S, S)

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

//long long
using ll = long long;

// pair<int, int>
using PII = pair<int, int>;

//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;

//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

// a = max(a, b), a = min(a, b)
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; }

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









int main(){
  int N;
  cin >> N;
  vector<pair<ll, ll>>A(N);
  REP(i, N){
    ll a, b;
    cin >> a >> b;
    A.at(i).first = a + b;
    A.at(i).second = a - b;
  }
sort(all(A));
int ans = 0;
ll pos = -INF;
REP(i, N){
  if(pos <= A.at(i).second){
    pos = A.at(i).first;
    ans++;
  }
}
print(ans);

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <stack>

using namespace std;

int main()
{
    string s;

    cin >> s;

    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    }
    else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    }
    else {
        cout << "Sunny" << endl;
    }
}


Measured memory_bytes: 764
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	var to, tp, order, point int
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	for i := 0; i < n; i++ {
		sc.Scan()
		s := sc.Text()
		fmt.Sscanf(s, "%d %d", &to, &tp)
		if to > order {
			order = to
			point = tp
		}
	}
	fmt.Println(order + point)
}


Measured memory_bytes: 5504
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn gcd(mut a: i64, mut b: i64) -> i64 {
    while b != 0 {
        let r = a % b;
        a = b; b = r;
    }
    a
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        a: i32, b:i32,
    }
    let ans = gcd(a as i64, b as i64);
    println!("{}", ans);
    
}
fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int sum=0;
  for (int i=A;i<B+1;i++){
    if(i%10==i/10000 && (i/1000)%10==(i/10)%10){
      sum++;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int R,G,B,N;
		R = nextInt();
		G = nextInt();
		B = nextInt();
		N = nextInt();

		long cnt=0;
		for(int i=0;i<=N;i+=R) {
			for(int j=0;j<=N-i;j+=G) {
				if((N-i-j)%B==0)cnt++;
			}
		}
		out.println(cnt);
	}
	@SuppressWarnings("unused")
	private int min(int a, int b) {
		return Math.min(a, b);
	}
	@SuppressWarnings("unused")
	private int nextInt() {
		return Integer.parseInt(next());
	}
	@SuppressWarnings("unused")
	private long nextLong() {
		return Long.parseLong(next());
	}
	private String next() {
		return sc.next();
	}
}


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

using namespace std;

int64_t solve(const vector<int64_t>& a, vector<int64_t>& b) {
  int64_t num = 0;
  for (int i = a.size() - 1; i >= 0; --i) {
    auto aa = a[i] + num;
//    auto next_m = ((aa + b[i] - 1) / b[i]) * b[i];
//    num += next_m - aa;
      if (aa % b[i] != 0) {
        num += b[i] - aa % b[i];
      }
  }
  
  return num;
}

int main() {
  int32_t n;
  cin >> n;
  
  vector<int64_t> a(n), b(n);
  for (int32_t i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  
  cout << solve(a, b) << endl;

  return 0;
}

Measured memory_bytes: 1792