akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

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

//�G���g�X�e�l�X���
vector<int> estora(vector<int> num) {
    int sel = 0;
    while (sel < num.size()) {
        int d = num[sel];
        for (int i = 0; i < num.size(); i++) {
            if (num[i] % d == 0 && num[i] != d && d != 1) {
                num.erase(num.begin() + i);
                i--;
            }
        }
        sel++;
    }
    return num;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
//i����ɑf���ɂ��Ă����Ȃ��Ƃ��܂��ł��Ȃ�&&�v�Z�ʃ��o�C
//�G�X�g���l�X��⿂őf����U����Ă����K�v�������肻��
vector<ll> fac(ll n, vector<ll> num) {
    ll kazu = n;
    for (int i = 2; i <= n; i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1)
        num[n]++;
    return num;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return num;
}
const int INF = 1001001001;

//mint�p�̒萔 (10��9�� + 7)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    string s;
    cin >> s;
    ll num = 0;
    ll ans = 0;
    rep(i, s.size()) {
        if (s[i] == 'W')
            ans += num;
        else
            num++;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;


int main() {
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int n = Integer.parseInt(br.readLine());
        int a = 0;
        int b = 0;
        
        String[] input = br.readLine().split(" ");
        Integer[] numbers = new Integer[n];
        
        for(int i = 0; i < n; i++){
            numbers[i] = Integer.valueOf(input[i]);
        }
        
        Arrays.sort(numbers, Collections.reverseOrder());
        
        for(int i = 0; i < n; i++){
            if(i % 2 == 0){
                a += numbers[i];
            }else{
                b += numbers[i];
            }
        }
        
        out.println(a - b);
        out.close();
        
    }
}

Measured memory_bytes: 32948
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m; cin >> n >> m;
  UnionFind UF(n);
  rep(i,m){
      ll x,y,z; cin >> x >> y >> z;x--; y--;
      UF.unionSet(x,y);
  }
  ll ans = 0;
  rep(i,n){
      if(i==UF.root(i))ans++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 640
n=int(input())

a=[int(input())-1 for _ in range(n)]
posi=[0]*n

for i in range(n):
    posi[a[i]]=i

cnt=0
ans=0
p=0

for i in range(n):
    if p<=posi[i]:
        cnt+=1
        p=posi[i]
        ans=max(ans,cnt)
    else:
        p=posi[i]
        cnt=1
    #print(i+1,ans)


print(n-ans)

Measured memory_bytes: 24940
#include <stdio.h>

int main(void)
{
	int H,W,i,a;
	
	while(1){
		scanf("%d%d",&H,&W);
		if( H==0 && W==0 ){
			break;
		}
		for( i=0 ; i<H ; i++){
			if(i%2==0){
			for( a=0 ; a<W ; a++){
				if( a%2==0){
					printf("#");
				}else{
					printf(".");
				}
			}
		}else{for( a=0 ; a<W ; a++){
				if( a%2==0){
					printf(".");
				}else{
					printf("#");
				}
			
			}
		}
		printf("\n");
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    string S;
    cin >> S;
    int N = int(S.length());
    ll ans = 0;
    ll w = 0;
    
    for (int i = N-1; i >= 0; i--) {
        if(S[i] == 'W') w++;
        else ans += w;
    }
    cout << ans << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 640
N, Y = map(int,input().split())
for x in range(N+1):
 for y in range(N-x+1):
  if 10000*x + 5000*y + 1000*(N-(x+y)) - Y==0:
   print(x, y, N-(x+y))
   exit()
print("-1 -1 -1")

Measured memory_bytes: 2940
n = gets.to_i
array = gets.split(" ").map(&:to_i)
combi = array.combination(3).to_a
cnt = 0
combi.each do |c|
  cnt += 1 if c[0] + c[1] > c[2] && c[1] + c[2] > c[0] && c[2] + c[0] > c[1] && c[0] != c[1] && c[1] != c[2] && c[2] != c[0]
end
puts cnt

Measured memory_bytes: 22636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,ara[1000],n=0,ara2[1000],k=0,c=1,max=0,mode,m;

    while (scanf ("%d",&m)!=EOF)
    {
        ara[n]=m;
        n++;
    }
    for (i=0;i<n-1;i++)
    {
        mode=0;
        for (j=i+1;j<n;j++)
        {
            if (ara[i]==ara[j])
            {
                mode++;
            }
        }
        if ((mode>max) && (mode!=0))
        {
            k=0;
            max=mode;
            ara2[k]=ara[i];
            k++;
        }
        else if (mode==max)
        {
            ara2[k]=ara[i];
            k++;
        }
    }
        sort(ara2,ara2+k);
        for (i=0;i<k;i++)
        {
            printf("%d\n",ara2[i]);
        }
        return 0;
}


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

int knapsack(vector<int> &v, vector<int> &w, int W) {
    vector<int> dp(W + 1, 0);
    for (int i = 0; i < (int)v.size(); ++i) for (int j = w[i]; j <= W; ++j) {
        dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
    }
    return dp[W];
}

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> v(N), w(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i] >> w[i];
    }
    cout << knapsack(v, w, W) << endl;
}


Measured memory_bytes: 3172
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int a,b;
int main(){
	cin>>a>>b;
	cout<<max(0,(b-1+a-2)/(a-1))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main ()
{
    int ara [1000], i, j, k, temp, n, q;

    scanf("%d %d", &n, &q);

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

    for (j = 0; j < n; j++)
    {

        for (k = j + 1; k < n; k++)
        {
            if (ara [j] > ara [k])
            {
                temp = ara[j];
                ara[j] = ara[k];
                ara[k] = temp;
            }
        }
    }

    int s  = 0;

    for (i = 0; i < q; i++){
        s += ara[i];
    }

    printf("%d", s);

    return 0;
}


Measured memory_bytes: 2096
function Main(input) {
    var AB = input.split('/n')[0].split(' ');
    var A = parseInt(AB[0], 10);
    var B = parseInt(AB[1], 10);
    
    var res = Math.max(A + B, A - B, A * B);
    console.log(res === +0 || res === -0 ? 0 : res)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
typedef pair<int, int> P;
int d[55];
signed main() {
	int a, b; cin >> a >> b;
	cout << max(0ll, a - 2 * b) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int A, B; cin >> A >> B;
  
  cout << max(A-B-B, 0) << endl;
  return 0;
}

Measured memory_bytes: 256
(function(stdin) {
     var lines = stdin.toString().split('\n');
     var param = lines[0].split(' ').map(Number);
     var a = param[0];
     var b = param[1];
 
    console.log(a * b,(a * 2) + (b * 2));                     
 
}(require('fs').readFileSync('/dev/stdin','utf8')));
 

Measured memory_bytes: 7376
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.ArrayDeque

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val aList = readIntegerList()
    val deque = ArrayDeque<Int>(n)
    var shouldAddLast = true
    for (a in aList) {
        if (shouldAddLast) {
            deque.addLast(a)
        } else {
            deque.addFirst(a)
        }
        shouldAddLast = !shouldAddLast
    }
    val ans = if (shouldAddLast) deque else deque.reversed()
    out.println(ans.joinToString(" "))
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 77740
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x, a, b = LI()
    if b <= a:
        print("delicious")
    elif b <= a + x:
        print("safe")
    else:
        print("dangerous")

    return

#B
def B():
    n = II()
    a = IR(n)
    check = [False] * (n + 1)
    check[1] = True
    now = a[0]
    for i in range(1,n+1):
        if check[now]:
            break
        if now == 2:
            print(i)
            return
        check[now] = True
        now = a[now - 1]
    print(-1)
    return

#C
def C():
    return

#D
def D():
    def find(x):
        if x == par[x]:
            return x
        par[x] = find(par[x])
        return par[x]
    def unite(x, y):
        x = find(x)
        y = find(y)
        if x == y: return False
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1
        return True
    n = II()
    par = [i for i in range(n)]
    rank = [0] * n
    xy = LIR(n)
    for i in range(n):
        xy[i].append(i)
    xy.sort(key=lambda x: x[0])
    edg = [None] * (2 * n - 2)
    a = 0
    for i in range(n-1):
        edg[i] = [xy[i + 1][0] - xy[i][0], xy[i][2], xy[i + 1][2]]
    xy.sort(key=lambda x: x[1])
    for i in range(n-1):
        edg[n + i - 1] = [xy[i + 1][1] - xy[i][1], xy[i][2], xy[i + 1][2]]
    ans = 0
    a = 0
    edg.sort(key=lambda x: x[0])
    for i in range(2 * n - 2):
        value, p0, p1 = edg[i]
        if a == n - 1:
            break
        if unite(p0, p1):
            a += 1
            ans += value
    print(ans)
    return

#Solve
if __name__ == '__main__':
    D()


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

using namespace std;

int main()
{
  string a,b,c,s;
  a="Sunny";
  b="Cloudy";
  c="Rainy";
  
  cin >>s;
  
  
 
  
  if(s==a)
    cout << b;
  else if(s==b)
    cout << c;
  else
    cout <<a;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long n,ans;
    ans=0;
    long long a=5;
    cin >>n;
    if(n%2==1){
        ans=0;
    }
    if(n%2==0){
        while(a<=1000000000000000000){
            ans+=n/(2*a);
            a*=5;
        }    
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    int l = 0, r = 0, d = 0, u = 0, k = 0, c = 0;
    while(x < l || x > r || y < d || y > u){
        if(k == 0){
            int dy = u-d+1;
            r += dy;
        }
        else if(k == 1){
            int dx = r-l+1;
            u += dx;
        }
        else if(k == 2){
            int dy = u-d+1;
            l -= dy;
        }
        else{
            int dx = r-l+1;
            d -= dx;
        }
        k = (k+1)%4;
        c = (c+1)%3;
    }
    cout << c+1 << endl;
    return 0;
}




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

constexpr int MAX_N = 30;
constexpr int MAX_M = 30;

int like[MAX_M+1];

int main() {
  int N, M, K, A;
  scanf("%d%d", &N, &M);

  for (int i{}; i < N; ++i) {
    scanf("%d", &K);
    for (int j{}; j < K; ++j) {
      scanf("%d", &A);
      like[A]++;
    }
  }

  int ans{};
  for (int i{1}; i <= M; ++i) {
    if (like[i] == N)
      ++ans;
  }

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------

int group(int c) {
  if (c == 2) {
    return 0;
  } else if (c == 4 || c == 6 || c == 9 || c == 11) {
    return 1;
  } else {
    return 2;
  }
}

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

  int x, y;
  cin >> x >> y;
  Yes(group(x) == group(y));
  return 0;
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
d = gets.split.map(&:to_i)
m = n
while true do
  dame = false
  s = m.to_s
  d.each do |c|
    if s.include?(c.to_s)
      dame = true
      break
    end
  end
  break if not dame
  m += 1
end
puts m


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define f(i,a,b) for(int i = a; i < b; i++)
#define fd(i,a,b) for(int i = a; i > b;i--)
#define long long ll;
#define fl(i,a,b) for(ll i = a; i < b; i++)
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VS vector<string>
#define VL vector<long long>
#define VC vector<char>
#define VF vector<float>
#define PB push_back
#define F first
#define S second
#define fa(i,skill) for(auto i : skill)
#define fr(i,skill) for(VI :: reverse_iterator i = skill.rbegin(); i != skill.rend(); i++)
using namespace std;
 void edit(VI &skill,int n)
{
    f(i,0,n)
        {
            int x;
            cin >> x;
            skill.PB(x);
        }
}

void achilles()
{
    string n; cin >> n;
    int ans = 0;
    int x = n.size();
    f(i,0,x)
    {
        ans += n[i] - '0';
    }
    if(ans % 9 == 0)
        cout << "Yes\n";
    else
        cout << "No\n";
}
int main()
{
    achilles();
    return 0;
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto x:v) cout<<" "<<x; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--){
		string s;
		cin>>s;
		int ans=0;
		for(int i=0;i<(int)s.length();i++){
			int cnt=0;
			while(s[i]=='R'&&i<(int)s.length()){
				cnt++;
				i++;
			}
			ans=max(cnt,ans);
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
#include <string>
#include <cstdlib>
#include <vector>
#include <cassert>
#include <cctype>
using namespace std;

const int MAXN=50+10;
int a[MAXN]={0};

int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    /*for(int i=1;i<=n;i++)
        cout<<a[i]<<endl;*/
    int sum=0;
    for(int i=n;i>=(n-k+1);i--)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
int h = 0, w, n = 0, m, s, ans = 1000, a[100] = {}, c[24] = {}, b[12] = {}, sum = 0, pos[2][2] = {}, dp[1000][1000] = {};
int flag = 0;
string str;

int main() {
	cin >> n;
	a[0]++;
	int cs = 0, num = 0;
	for (int i = 0; i < n; i++) {
		int aa;
		cin >> aa;
		ans = min(aa,ans);
		if (a[aa] == 0) {
			a[aa]++;
		}
		else if (a[24 - aa] == 1 || aa == 0) {
			cout << 0 << endl;
			return 0;
		}
		else {
			a[24 - aa]++;
			c[cs] = 24 - aa;
			cs++;
			c[cs] = aa;
			cs++;
		}
		if (aa == 12) {
			c[cs] = 12;
			cs++;
		}
	}
	if (true){
		//cout << ans << endl;
	
		ans = 0;
		for (int i = 1; i < 12; i++) {
			if (a[i]==1&&a[24-i]==0) {
				b[num] = i;
				num++;
			}
		}
		for (int i = 0; i < (2 << num); i++) {
			int cc[24] = {};
			for (int j = 0; j < cs; j++)
				cc[j] = c[j];
			for (int j = 0; j < num; j++) {
				bool aa = (i % (1 << (j + 1))) / (1 << (j));
				if (aa)cc[cs + j] = b[j];
				else cc[cs + j] = 24 - b[j];
			}
			cc[cs + num] = 0;
			cc[cs + num + 1] = 24;
			sort(cc, cc + cs + num + 2);
			int AAA = 100;
			for (int j = 0; j < cs + num + 1; j++)
				AAA = min(AAA, cc[j + 1] - cc[j]);
			ans = max(ans, AAA);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    String s;
    String[] w;

    void run(){
	s = sc.nextLine();
	w = s.split("[ ,.]");
	show();
    }

    void show(){
	boolean one = true;
	int i;
	for(i=0; i<w.length; i++)
	    if(w[i].length()>2 && w[i].length()<7)
		if(one) {
		    System.out.print(w[i]);
		    one = false;
		}
		else 
		    System.out.print(" "+w[i]);
	System.out.println();
    }
}

Measured memory_bytes: 15312
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <iomanip>
#include <malloc.h>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
#define LONGINF 1000000000000000000

int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	long long ans = LONGINF;
	ans = min(ans, a*b*(c % 2));
	ans = min(ans, a*c*(b % 2));
	ans = min(ans, b*c*(a % 2));
	cout << ans << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

const int MAX = 2000005;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
// 二項係数計算
ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

// https://atcoder.jp/contests/abc167/submissions/13094970
// 紙に書いて当てる
void solve() {
  int n, m;
  cin >> n >> m;
  n--;
  int k;
  cin >> k;

  COMinit();
  ll ans = 0;
  rep(i, k + 1) add(ans, m * modpow(m - 1, n - i, mod) % mod * COM(n, i) % mod);
  cout << ans << endl;
}


Measured memory_bytes: 50552
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
inline ll read(){
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
ll n,ans;
void check(ll x){
	if(!x)return;
	ans+=(n==n/x*(x+1)?x:0);
}
int main(){
	n=read();
	for(ll i=1;i*i<=n;++i){
		if(n%i==0){
			check(i-1);
			if(i*i!=n)check(n/i-1);
		}
	}
	printf("%lld\n",ans);
	return 0;
}




Measured memory_bytes: 3768
#include <iostream>

using namespace std;

typedef long long ll;

ll N,M,Q;
ll T[501][501];
int p[100001];
int q[100001];

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

    for (int i=0; i<M; i++) {
        int l,r;
        cin >> l >> r;
        T[l][r]++;
    }

    for (int i=0; i<Q; i++) {
        cin >> p[i] >> q[i];
    }

    for (int i=0; i<N+1; i++) {
        for (int j=0; j<N; j++) {
            T[i][j+1] += T[i][j];
        }
    }

    for (int i=0; i<Q; i++) {
        ll answer = 0;
        for (int j=p[i]; j<=q[i]; j++) {
            answer += T[j][q[i]] - T[j][p[i]-1];
        }
        cout << answer << endl;
    }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
static const int MAX_N = 100;
int N;
int A[MAX_N], x[MAX_N][MAX_N], y[MAX_N][MAX_N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N;
    rep(i, N)
    {
        cin >> A[i];
        rep(j, A[i])
        {
            int tmpx, tmpy;
            cin >> tmpx >> tmpy;
            tmpx--;
            x[i][j] = tmpx, y[i][j] = tmpy;
        }
    }
    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {
        vector<int> h(N);
        for (int n = 0; n < N; n++) {
            if (bit & (1 << n)) {
                h[n] = 1;
            }
        }
        int cnt = 0;
        rep(i, N)
        {
            if (h[i])
                cnt++;
        }
        bool flag = true;
        rep(i, N)
        {
            if (h[i]) {
                rep(j, A[i])
                {
                    if (h[x[i][j]] != y[i][j]) {
                        flag = false;
                    }
                }
            }
        }
        if (flag)
            ans = max(ans, cnt);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int ans;
int main()
{
	cin>>s;
	int k=s.size();
    for(int i=0;i<k/2;i++)
       if(s[i]!=s[k-1-i])ans++;
    cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
    ios :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector <int> x, y;
    for (int i = 0; i < n; ++ i) {
        int xx; cin >> xx; x.push_back(xx);
    }
    for (int i = 0; i < m; ++ i) {
        int yy; cin >> yy; y.push_back(yy);
    }
    for (int i = n - 1; i; -- i) x[i] -= x[i - 1];
    for (int i = m - 1; i; -- i) y[i] -= y[i - 1];
    int sumx = 0, sumy = 0;
    for (int i = 1; i < n; ++ i) (sumx += 1LL * x[i] * i % mod * (n - i) % mod) %= mod;
    for (int i = 1; i < m; ++ i) (sumy += 1LL * y[i] * i % mod * (m - i) % mod) %= mod;
    cout << 1LL * sumx * sumy % mod << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = a * c;
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
  int n,k,i,p[10001],a=0;
 scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  sort(p,p+n);
  for(i=0;i<k;i++){
    a+=p[i];
  }
  printf("%d\n",a);
  return 0;
}
    

Measured memory_bytes: 1708
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int k = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int odd = k / 2 + k % 2;
			int even = k / 2;
			//System.Diagnostics.Debug.WriteLine($"{odd} {even}");
			Console.WriteLine(odd * even);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 11092
line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for _ in range(b):
    axb_text += str(a)

bxa_text = ''
for _ in range(a):
    bxa_text += str(b)


print(axb_text if axb_text < bxa_text else bxa_text)

Measured memory_bytes: 3060
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;
int main()
{
    int n;
    int max = 0;
    int p;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> p;

        if (max < p)max = p;
        ans += p;
    }

    ans -= max / 2;

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



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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

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

  ll a;
  cin >> a;
  
  double b;
  cin >> b;

  b = b * 100;

  ll B = round(b);

  cout << a * B / 100 << endl;

  return 0;
}


Measured memory_bytes: 3776
#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;

int main() {
    int n;
    string s[100000];
    std::unordered_map<std::string, int> um;
    int sum = 0;

    cin >> n;
    for (int i=0; i<n; i++) {
        string name;
        cin >> name;

        if (um[name] > 0) {
            // um[name] += 1;
        } else {
            um[name] = 1;
            ++sum;
        }
    }

    cout << sum << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a > k)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long su[100005][2];
long long l1[100005];
long long l2[100005];
long long r1[100005];
long long r2[100005];
int main(){
    int n;
    long long m;
    scanf("%d%lld",&n,&m);
    long long ans = 0, mx = 0;
    su[0][0] = 0; su[n+1][0] = m;
    for(int i=1;i<=n;i++){
        scanf("%lld%lld",&su[i][0], &su[i][1]);
        ans += su[i][1];
    }
    ans -= m; ans += max(su[1][0], m - su[n][0]);
    if(ans < 0) ans = 0;
    long long now1, now2;
    l1[0] = l2[0] = 0;
    now1 = now2 = 0;
    for(int i=1;i<=n;i++){
        now1 += su[i][1];
        now2 += su[i][1];
        now1 -= su[i][0] - su[i-1][0];
        now2 -= su[i][0] - su[i-1][0];
        now2 -= su[i][0] - su[i-1][0];
        l1[i] = max(l1[i-1], now1);
        l2[i] = max(l2[i-1], now2);
    }
    r1[n+1] = r2[n+1] = 0;
    now1 = now2 = 0;
    for(int i=n;i>=1;i--){
        now1 += su[i][1];
        now2 += su[i][1];
        now1 += su[i][0] - su[i+1][0];
        now2 += su[i][0] - su[i+1][0];
        now2 += su[i][0] - su[i+1][0];
        r1[i] = max(r1[i+1], now1);
        r2[i] = max(r2[i+1], now2);
    }
    for(int i=0;i<=n;i++){
        ans = max(ans, max(l1[i] + r2[i+1], l2[i] + r1[i+1]));
    }
    printf("%lld\n", ans);
}


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

// 0--x-----k----  (1)
// 0-----x--k----  (2)
// 0-----k--x----  (3)

int main(int argc, char *argv[]) {
  int n, k;
  std::cin >> n >> k;

  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    if (abs(x - k) <= x) { // (2) or (3)
      sum += 2 * abs(x - k);
     } else { // (1)
      sum += 2 * x;
    }
  }

  std::cout << sum << std::endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      
      int Ans = C - (A-B);
      if (Ans < 0) {
    	  Ans = 0;
      }
      
      
      System.out.print(Ans);

  }
}

Measured memory_bytes: 21716
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll pow10(ll x) {
	ll a = 1;
	REP(i, 1, x) {
		a *= 10;
	}
	return a;
}

ll par(ll t, ll i) {
	return max(ll(0), 10 - abs(t) - (i == 0));
}

ll f(ll k,ll i) {
	return pow10(k - i) - pow10(i);
}

ll h(ll k, ll n, ll i) {
	if (i * 2 > k) {
		return (n == 0);
	}
	else if (i * 2 == k) {
		return (n == 0) * 10;
	}
	else {
		//cout << k << " " << n << " " << i << endl;
		ll t = n / f(k, i);
 		if (t >= 10) {
			return 0;
		}
		ll res = par(t, i)* h(k, n - t * f(k, i), i + 1);
		if (t != 9) {
			res += par(t + 1, i) * h(k, -n + (t + 1)*f(k, i), i + 1);
		}
		return res;
	}
}

ll g(ll k, ll n) {
	return h(k, n, 0);
}

int main() {
	ll n;
	cin >> n;
	if (n % 9 != 0) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	REP(k, 1, 20) {
		if (n < f(k, (k - 1) / 2)) {
			continue;
		}
		ans += g(k, n);
	}
	cout << ans << endl;
}


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

// #define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define pii pair<int,int>
#define e "\n"

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

    
void solve()
{
	double a,b,c,d;
	cin>>a>>b>>c>>d;
	int m = min((a/d),(c/b));
	a-=m*d;
	c-=m*b;
	if(c<=0){cout<<"Yes"<<e;}
	else if(a<=0){cout<<"No"<<e;}
	else
	while(1)
	{
		c-=b;
		if(c<=0){cout<<"Yes"<<e;break;}

		a-=d;
		if(a<=0){cout<<"No"<<e;break;}
	}



	// if((a/d)+1>=(c/b))cout<<"yes"<<e;
	// else cout<<"no"<<e;

}
int main()
{
	// c_p_c();
	// int t;cin>>t;
	// while(t--)
		solve();
	
}

Measured memory_bytes: 3720
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int count = 0;
  int N; cin >> N;
  vector<pair<int, int> > red(N);
  vector<pair<int, int> > usedred(N);
  for(int i=0; i<N; i++){
    cin >> red[i].first >> red[i].second;
    usedred[i].first = -1;
    usedred[i].second = -1;
  }
  vector<pair<int, int> > blue(N);
  for(int i=0; i<N; i++){
    cin >> blue[i].first >> blue[i].second;
  }
  sort(red.begin(), red.end());
  sort(blue.begin(), blue.end());
  for(int i=0; i<N; i++){
    int maxredsecond = -1;
    for(int j=0; j<N; j++){
      if(blue[i].first > red[j].first && blue[i].second > red[j].second && usedred[j].second == -1){
        if(maxredsecond < red[j].second){
          maxredsecond = red[j].second;
        }
      }
    }
    for(int j=0; j<N; j++){
      if(usedred[j].second == -1){
        if(maxredsecond == red[j].second){
          usedred[j].second = 0;
          count ++;
        }
      }
    }
  }
cout << count << endl;
return 0;
}


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

using namespace std;

int main() {
  int N, M; cin>>N>>M;
  vector<int> cnt(N+1,1);
  vector<bool> red(N+1,false);
  red[1] = true;
  for(int i = 0; i < M; i++) {
    int from, to; cin>>from>>to;
    if(red[from]) {
      red[to] = true;
      cnt[to]++;
      cnt[from]--;
      if(cnt[from] <= 0) red[from] = false;
    } else {
      cnt[to]++;
      cnt[from]--;
    }

  }
  int ans = 0;
  for(int i = 1; i <= N; i++) {
    if(red[i]) {
      ans++;
      //cout << i << " " << ans << endl;                                                
    }
  }
  cout << ans << endl;
  return 0;
}


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

pair<int, int> fair[50][50];
pair<int, int> change[50];
long long dp[100][50][2600];
vector<int> node[50];
bool flag[50];

long long INF = 4e18;

void debug(long long dp[50][2600])
{
  for (int i = 1; i < 3; i++)
  {
    cout << i << "###" << endl;
    for (int j = 0; j < 2600; j++) cout << dp[i][j] << " ";
    cout << endl;
  }
}

int main(void)
{
    int n, m, s;
    cin >> n >> m >> s;
    s = min(s, 2599);
    int u, v;
    for (int i = 0; i < m; i++)
    {
      int a, b;
      cin >> u >> v >> a >> b;
      u--; v--;
      node[u].push_back(v);
      node[v].push_back(u);
      fair[u][v].first = a;
      fair[u][v].second = b;
      fair[v][u].first = a;
      fair[v][u].second = b;
    }
    for (int i = 0; i < n; i++)
    {
      int c, d;
      cin >> c >> d;
      change[i].first = c;
      change[i].second = d;
    }
    for (int i = 0; i < 100; i++)
    {
      for (int j = 0; j < n; j++)
      {
        for (int k = 0; k < 2600; k++)
          dp[i][j][k] = INF;
      }
    }
    int counter = -1;
    dp[0][0][s] = 0;
    flag[0] = true;
    for (int i = 0; i < 2600; i++)
    {
      if (i + change[0].first < 2600)
          dp[0][0][i + change[0].first] = min(dp[0][0][i + change[0].first], dp[0][0][i] + change[0].second);
      else
          dp[0][0][2600] = min(dp[0][0][2600], dp[0][0][i] + change[0].second);
    }
    while (++counter < 99)
    {
      for (int i = 0; i < n; i++)
      {
        if (flag[i] == false) continue;
        for (int j = 0; j < node[i].size(); j++)
        {
          for (int k = 0; k < 2600; k++)
          {
            if (dp[counter][i][k] == INF) continue;
            dp[counter + 1][i][k] = min(dp[counter + 1][i][k], dp[counter][i][k]);
            if (k - fair[i][node[i][j]].first < 0) continue;
            //更新がなければスキップ
            if (dp[counter + 1][node[i][j]][k - fair[i][node[i][j]].first] <= dp[counter][i][k] + fair[i][node[i][j]].second)
              continue;
            flag[node[i][j]] = true;
            dp[counter + 1][node[i][j]][k - fair[i][node[i][j]].first] = dp[counter][i][k] + fair[i][node[i][j]].second;
          }
          for (int z = 0; z < 2600; z++)
          {
            if (z + change[node[i][j]].first < 2600)
            {
                dp[counter + 1][node[i][j]][z + change[node[i][j]].first] = min(dp[counter + 1][node[i][j]][z + change[node[i][j]].first], dp[counter + 1][node[i][j]][z] + change[node[i][j]].second);
            }
            else
            {
              dp[counter + 1][node[i][j]][2599] = min(dp[counter + 1][node[i][j]][2599], dp[counter + 1][node[i][j]][z] + change[node[i][j]].second);
            }
          }
        }
      }
    }
    for (int i = 1; i < n; i++)
    {
      long long tmp = INF;
      for (int j = 0; j < 2600; j++)
      {
        tmp = min(tmp, dp[counter][i][j]);
      }
      cout << tmp << endl;
    }
}

Measured memory_bytes: 105144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define rep(i, a, b) for (ll i = a; i < (b); ++i)
#define reb(i, a, b) for (ll i = a; i >= (b); --i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
multiset<ll> ch[200005];
multiset<ll> ans;
int main()
{
   
   ll n,sum=0;
   cin >> n;
   map<ll, ll> mp;
   ll a[n];
   rep(i,0,n)
   {
      cin >> a[i];
      mp[a[i]]++;
      sum += a[i];
   }
   ll q, b, c;
   cin >> q;
   rep(i,0,q)
   {
      cin >> b >> c;
      sum += (mp[b] * (c - b));
      mp[c] += mp[b];
      mp[b] = 0;
      
      cout << sum << endl;
   }

}


Measured memory_bytes: 19728
//
    //  main.cpp
    //  study_c++
    //
    //  Created by Hisaki Kobayashi on 2020/03/31.
    //  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
    //

    #include <iostream>
    #include <stdio.h>
    #include <string>
//    #include <bits/stdc++.h>
#include <bits/stdc++.h>

    using namespace std;

    int main(int argc, const char * argv[]) {
        
        int i,j,k,cnt=0,n;
        int sum=0;
        int N;
        cin >> N;
        for(n=1;n<=N;n=n+2){
            for(i=1;i<=n;i++){
                if(n%i==0)
                    cnt++;
            }
            if(cnt==8){
                sum++;
            }
            cnt=0;
        }
        cout << sum << endl;
   }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    string s,t;
    cin >> s >> t;
    if(s.length() +1 == t.length() && s == t.substr(0,s.length()))cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3628
L={'S':[],'H':[],'C':[],'D':[]}
for i in [input().split() for i in range(int(input()))]:
  L[i[0]].append(int(i[1]))
for i in ['S','H','C','D']:
  for j in range(1,14):
    if j not in L[i]:
      print(i,j)

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


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,sum=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                sum+=__gcd(__gcd(i,j),k);
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3596
def method2():
    nums = list(map(int, input().split()))
    result=0
    if(nums[0]>nums[1]):
        result = nums[0]*2-1
    elif(nums[0]<nums[1]):
        result = nums[1]*2-1
    else:
        result = nums[0]*2
    print(result)
        

if __name__ == "__main__":
    method2()

Measured memory_bytes: 3060