akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int N;
    int a[214514];
    int pen[214514];
    cin >> N;
    int Ans=0;
    REP(i,N){
        cin >> a[i];
        pen[a[i]]=i+1;
    }
    //OREP(i,N){cout << pen[i] << " ";}cout << Endl;
    set<int> Tapris;
    Tapris.insert(0);
    Tapris.insert(N+1);
    OREP(i,N){
        auto l=Tapris.lower_bound(pen[i]);
        int r=i*(*l-pen[i])*(pen[i]-*(--l));
        Ans+=r;
        //cout << r << endl;
        Tapris.insert(pen[i]);
    }
    cout << Ans << endl;
    return 0;
}   


Measured memory_bytes: 12928
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;

typedef long long ll;



int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int A,B;
    cin >> A >> B;
    cout << (A+B)%24 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main( void ){
	long long s, c;
	long long result = 0;
	cin >> s >> c;

	if( s*2 >= c ){
		result = c / 2;
	} else {
		result = s + ( c - s * 2 ) / 4;
	}

	cout << result << endl;
	return 0;
}


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

template<typename T>
void fin (T a){
    cout<<a<<endl;
    exit(0);
}

template<typename S>
void print(S a){
    cout<<a<<endl;
}

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

    ll n;
    cin>>n;
    vector<ll> l(n);
    ll tmp;
    rep(i,n){
        cin>>tmp;
        l.at(i) = tmp;
    }

    ll ans = 0;
    ll cnt = 0;
    for(int i=0;i<=n-3;i++){
        for(int j=i+1;j<=n-2;j++){
            for(int k=j+1;k<=n-1;k++){
//                cout<<i<<j<<k<<endl;
                cnt++;
                ll a=l[i];
                ll b=l[j];
                ll c=l[k];
                if(a!=b&&b!=c&&c!=a){
                    if(a+b>c && b+c>a && c+a>b){
                    ans++;
//                cout<<i+1<<j+1<<k+1<<endl;
                    }
                }
            }
        }
    }
//    print(cnt);
    fin(ans);


    return 0;
}




Measured memory_bytes: 3648
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int cnt0 = 0, cnt1 = 0;
    rep(i, S.length()) {
        if(S[i] == '0') cnt0++;
        else cnt1++;
    }
    cout << min(cnt0, cnt1) * 2 << endl;

    return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;
using static System.Console;

static class Extensions {
   public static int ToInt(this string str) {
      return int.Parse(str);
   }
}

class Program {
   public static void Main(string[] args) {
      var n = ReadLine().ToInt();
      var a = new int[n];

      for (int i = 0; i < n; i++)
         a[i] = ReadLine().ToInt();

      WriteLine(a.GroupBy(x => x).Count());
   }
}


Measured memory_bytes: 13396
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n,m;
  cin>>n>>m;
  int a[50],b[50],c[50],d[50];
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  for(int i=0;i<m;i++){
    cin>>c[i]>>d[i];
  }
  for(int i=0;i<n;i++){
    int min_dis=abs(a[i]-c[0])+abs(b[i]-d[0]);
    int min_dis_num=1;
    for(int j=0;j<m;j++){
      int tmp=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(tmp<min_dis){
        min_dis=tmp;
        min_dis_num=j+1;
      }
      if(j==m-1){
        cout<<min_dis_num<<endl;
      }
    }
  }
  return 0;
}


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

using namespace std;

//Nayeem Shahriar Joy ,Applied Physics And Electronic Engineering , University of Rajshahi.

int main(){

  string s;

  cin>>s;

  reverse(s.begin(),s.end());

  cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 3168
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 2019
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc133/tasks/abc133_c
# i,jの2019倍は必ず2019で割り切れる
# i+2019a ≡ i (mod 2019)より iもjもそれぞれ2019で割った余りを採用すれば良い

L, R = read_ints()
if R - L >= MOD:
    print(0)
    exit()

L = L % MOD
R = R % MOD

if R <= L:
    R += MOD

ans = INF
for i, j in combinations(ra(L, R + 1), r=2):
    # print(i, j, i * j % MOD)
    ans = min(ans, i * j % MOD)
print(ans)


Measured memory_bytes: 40556
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

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

int N;
int main(){
    ios::sync_with_stdio(false);
    
    cin >> N;
    vector<ll> a(N *3);
    
    REP(i, N * 3) {
        cin >> a[i];
    }
    
    // 前半
    // 終端がN-1 ~ 2N-1 の N+1要素
    priority_queue<ll, vector<ll>, greater<ll> > rmin;
    vector<ll> dp_max(N+1, 0);
    REP(i, N) {
        dp_max[0]+=a[i];
        rmin.push(a[i]);
    }
    FOR(i, 0, N) {
        ll tmp = rmin.top();
        if (a[N+i] > tmp) {
            dp_max[i+1] = dp_max[i] - tmp + a[N+i];
            rmin.pop();
            rmin.push(a[N+i]);
        } else {
            dp_max[i+1] = dp_max[i];
        }
    }
    
    // 後半
    // 終端が 2N-1 * 3N-1 の N+1要素
    vector<ll> dp_min(N+1, 0);
    priority_queue<ll> rmax;
    FOR(i , 2 * N, 3 * N) {
        dp_min[0] += a[i];
        rmax.push(a[i]);
    }
    REP(i, N) {
        ll tmp = rmax.top();
        if (a[2 * N - 1 - i] < tmp) {
            dp_min[i+1] = dp_min[i] - tmp + a[2 * N - 1 - i];
            rmax.pop();
            rmax.push(a[2 * N - 1 - i]);
        } else {
            dp_min[i+1] = dp_min[i];
        }
    }
    
    ll ans = - INF * INF;
    REP(i, N+1) {
        ans = max(ans, dp_max[i] - dp_min[N-i]);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 6516
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  int n;
  cin>>n;
  vector<long long int> c(5);
  rep(i,5) c[i]=0;
  rep(i,n){
    string s;
    cin>>s;
    if(s[0]=='M'){
      c[0]++;
    }else if(s[0]=='A'){
      c[1]++;
    }else if(s[0]=='R'){
      c[2]++;
    }else if(s[0]=='C'){
      c[3]++;
    }else if(s[0]=='H'){
      c[4]++;
    }
  }
  
    long long int ans=0;
    for(int i=0;i<3;i++){
      for(int j=i+1;j<4;j++){
        for(int k=j+1;k<5;k++){
          ans+=c[i]*c[j]*c[k];
        }
      }
    }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 0;
        for(int i = 0; i < 3;i++){
            if(s[i] == '1')ans++;
        }
        
        System.out.println(ans);
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 20948
MOD = 10**9 + 7
n, a, b = map(int, input().split())

def comb(n, k):
    x, y = 1, 1
    for i in range(n, n-k, -1):
        x = x * i % MOD
    for i in range(2, k+1):
        y = y * pow(i, MOD-2, MOD) % MOD
    return x*y % MOD

ans = (pow(2, n, MOD)-1-comb(n,a)-comb(n,b)) % MOD

print(ans)

Measured memory_bytes: 64792
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){

    string s[3];
    inrep(3,s);

    cout << s[0][0] << s[1][1] << s[2][2] << endl;
    
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e9;

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

  int n;
  vector<string>x = {"SAT" , "SUN" , "MON" , "TUE" , "WED" , "THU" , "FRI","SAT" , "SUN" , "MON" , "TUE" , "WED" , "THU" , "FRI" , "SAT"};

  string s;
  cin >> s;
  for(int i=0;i<x.size();i++){
    if(x[i] == s){
      int cnt = 0;
      for(int j=i+1;j<x.size();j++){
        cnt++;
        if(x[j] == "SUN"){
          cout << cnt << '\n';
          return 0;
        }
      }
    }
  }

}

Measured memory_bytes: 256
/*{{{*/
#include "bits/stdc++.h"
using namespace std;

#define MT make_tuple
#define all(x) begin(x), end(x)
#define putchar(x) cout << (x)
static int fastio = [](){ ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(17); return 0; }();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename ...T> string format(const string& fmt, T&&... args) {
    size_t sz = snprintf(nullptr, 0, fmt.c_str(), args...) + 1;
    unique_ptr<char[]> buf(new char[sz]);
    snprintf(buf.get(), sz, fmt.c_str(), args...);
    return string(buf.get(), buf.get() + sz - 1);
}

template<class T> struct rge { T b, e; auto begin() const { return b; } auto end() const { return e; } };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
template<class T> auto dud(T* x) -> decltype(cerr << *x, 0);
template<class T> char dud(...);

struct debug {
#if DEBUG == 2
    debug(int line) {
        if(line) cerr << "LINE(" << line << ") -> ";
    }
    template<class T> typename enable_if<sizeof dud<T>(0) != 1, debug&>::type operator<<(T i) {
        cerr << boolalpha << i; return * this;
    }
    template<class T> typename enable_if<sizeof dud<T>(0) == 1, debug&>::type operator<<(T i) {
        return *this << range(begin(i), end(i));
    }
    template<class T, class U> debug& operator<<(pair<T, U> d) {
        return *this << "(" << d.first << ", " << d.second << ")";
    }
    debug& operator<<(tuple<>&) { return *this << "()"; };
    template<class ...T> debug& operator<<(tuple<T...> d) {
        *this << "("; debug_tuple<sizeof...(T), 0>(d);
        return *this << ")";
    }
    template<size_t L, size_t I, class T> void debug_tuple(const T& t) {
        *this << (I == 0 ? "" : ", ") << get<I>(t);
        if(I + 1 < L) debug_tuple<L, (I + 1) % L>(t);
    }
    template<class T> debug & operator <<(rge<T> d) {
        *this << "[";
        for(auto it = d.b; it != d.e; ++it)
            *this << (it != d.b ?  ", " : "") << *it;
        return *this << "]";
    }
    debug& operator<<(ostream&(*pf)(std::ostream&)) {
        cerr << pf; return *this;
    }
#else
    debug(int) {}
    template<class T> debug& operator<<(T&&) { return *this; }
    debug& operator<<(ostream&(*)(std::ostream&)) { return *this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ << ": " << (__VA_ARGS__) << "] "

#define debug0()  debug(__LINE__)
#define debug1(x) debug(0)
#define GET_MACRO(_0, _1, NAME, ...) NAME
#define debug(...) GET_MACRO(_0, ##__VA_ARGS__, debug1, debug0)(__VA_ARGS__)
/*}}}*/
using LL = long long;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
const int MAX_N = 200005;

void solve(int) {
    string N;
    cin >> N;
    int sum = 0;
    for(int c : N) {
        sum += (c - '0');
        sum %= 9;
    }
    if(sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    int T = 1;
    //cin >> T;
    for(int i = 1; i <= T; ++i) {
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s=="RRR")cout << 3 << endl;
    else if(s=="SRR" || s=="RRS")cout << 2 << endl;
    else if(s=="SSS")cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int d = scanner.nextInt();
        int number = n / (2 * d + 1);
        if (n % (2 * d + 1) != 0) {
            ++number;
        }
        System.out.println(number);
    }

}


Measured memory_bytes: 22612
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

#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++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
//#define __DBG__



void solve(void){
  
  ll A, B, N;
  cin >> A >> B >> N;
  
  ll ans;
  
  if(B==1){
    ans=0;
  }
  else if(N<B){
    ans = A*N/B;
  }
  else{
    ans = A*(B-1)/B - A*((B-1)/B);
  }
  
  cout << ans << endl;
  return;
}



#define TESTCASES 1

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X,i=0;
  vector<int>a={1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,243,256,289,324,343,361,400,441,484,512,529,576,625,676,729,784,841,900,961,1000,1001};
  cin>>X;
  while(a.at(i+1)<=X)i++;
  cout<<a.at(i)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main() {
    ll n, x;
    cin >> n >> x;
    ll ans = 0;
    if(x>n/2){x = n-x;}
    ll a, r = -1;
    while(r != 0){
        a = n/x;
        if(r == -1){a--;}
        r = n%x;
        ans += a*3*x;
        n = x;
        x = r;
    }

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


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
struct goods {
  int profit;
  int weight;
};
int **C;
struct goods *item;
int knapsack(int size, int limit);
int main(void)
{
  int i, n, w;
  scanf("%d%d", &n, &w);
  C = (int**)malloc(sizeof(int*) * (n + 1));
  item = (struct goods*)malloc(sizeof(struct goods) * (n + 1));
  for (i = 0; i <= n; i++) {
    C[i] = (int*)malloc(sizeof(int) * (w + 1));
    C[i][0] = 0;
    if (i) scanf("%d %d", &item[i].profit, &item[i].weight);
  }
  for (i = 0; i <= w; i++) C[0][i] = 0;
  printf("%d\n", knapsack(n, w));
  for (i = 0; i <= n; i++) free(C[i]);
  free(C);
  free(item);
}
int knapsack(int size, int limit)
{
  int i, j;
  for (i = 1; i <= size; i++) {
    for (j = 1; j <= limit; j++) {
      C[i][j] = C[i-1][j];
      if (item[i].weight > j) continue;
      if (item[i].profit + C[i-1][j-item[i].weight] > C[i-1][j]) {
        C[i][j] = item[i].profit + C[i-1][j-item[i].weight];
      }
    }
  }
  return C[size][limit];
}
/*#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
struct knapsack {
  int profit;
  int weight;
};
struct knapsack *goods;
int maxprofit, n;
int cmp(const void *a, const void *b);
void backtrack(int phase, int p, int w);
int main (void)
{
  int i, limit;
  scanf("%d %d", &n, &limit);
  goods = (struct knapsack*)malloc(sizeof(struct knapsack) * (n + 1));
  for (i = 0; i < n; i++) scanf("%d %d", &goods[i].profit, &goods[i].weight);
  goods[n].profit = 0;
  goods[n].weight = INT_MAX;
  qsort(goods, n, sizeof(struct knapsack), cmp);
  backtrack(0, 0, limit);
  printf("%d\n", maxprofit);
  free(goods);
}
int cmp (const void *a, const void *b)
{
  struct knapsack ta = *(struct knapsack*)a, tb = *(struct knapsack*)b;
  if ((double)ta.profit / ta. weight < (double)tb.profit / tb.weight) return 1;
  else if ((double)ta.profit / ta. weight > (double)tb.profit / tb.weight) return -1;
  else return 0;
}
void backtrack(int phase, int p, int w)
{
  if (phase >= n) {
    if (p > maxprofit) maxprofit = p;
  } else {
    double z = 0.0, u = w;
    int i = phase + 1;
    if (goods[phase].weight <= w) {
      backtrack(phase + 1, p + goods[phase].profit, w - goods[phase].weight);
    }
    while (goods[i].weight <= u) {
      u -= goods[i].weight;
      z += goods[i].profit;
      i++;
    }
    z += u * goods[i].profit / goods[i].weight;
    if (z + p > maxprofit) {
      printf("maxprofit: %d, z + p: %f, u: %f\n", maxprofit, z + p, u);
      backtrack(phase + 1, p, w);
    }
  }
}
*/


Measured memory_bytes: 5488
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        int n = int.Parse(input.ReadLine());
        var hh = ToLongArray(input.ReadLine(), n);

        int p = 0;
        int max = 0;
        int count = 0;

        while (p < n-1) {
            if(hh[p] >= hh[p + 1]) {
                count++;
            } else {
                max = Math.Max(max, count);
                count = 0;
            }
            p++;
        }
        max = Math.Max(max, count);
        return max;
    }

    static long[] ToLongArray(string strs, int n) {
        long[] ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++) ret[i] = long.Parse(spl[i]);
        return ret;
    }
}

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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << (n + x - 1) / x * t << endl;
  return 0;
}


Measured memory_bytes: 3620
# -*- coding: utf-8 -*-
from sys import stdin, stdout


def read():
    x = stdin.readline().rstrip()
    return x


def __main__():

    k, n = map(int, read().split())
    A = [int(i) for i in read().split()]

    A.sort()
    d = []
    a0 = A[0]
    for a in A[1:]:
        d.append(abs(a-a0))
        a0 = a
    d.append(abs(k - A[-1]) + A[0])

    print(sum(d)-max(d))

__main__()

Measured memory_bytes: 82420
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<pair<ll,ll> > vec(0);
    vec.push_back(pair<ll,ll> (0,0));
    ll p = 2;
    while(N > 1 && p < 1000001){
        if (N % p == 0){
            if (vec[vec.size() - 1].first == p){
                vec[vec.size() - 1].second++;
            }
            else{
                vec.push_back(pair<ll,ll> (p,1));
            }
            N /= p;
        }
        else{
            p++;
        }
    }
    if (N > 1000001){
        vec.push_back(pair<ll,ll> (N,1));
    }
    ll ans = 0;
    rep(i,vec.size()){
        if (vec[i].second >= 45) ans += 9;
        else if (vec[i].second >= 36) ans += 8;
        else if (vec[i].second >= 28) ans += 7;
        else if (vec[i].second >= 21) ans += 6;
        else if (vec[i].second >= 15) ans += 5;
        else if (vec[i].second >= 10) ans += 4;
        else if (vec[i].second >= 6) ans += 3;
        else if (vec[i].second >= 3) ans += 2;
        else if (vec[i].second >= 1) ans += 1;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main() {
	int X, t;
	cin >> X >> t;
	if (X  >= t) {
		cout << X - t;
	}
	else if (X  < t) {
		cout << 0;
	}
}

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

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    ll A,B,C=0;
    cin>>A>>B;
    for(int i=3;i<=n;i++){
        ll tmp;
        cin>>tmp;
        C^=tmp;
    }
    ll D=A+B-C>>1;
    if(A+B-C&1||D<0||D>A||D&C){
        cout<<"-1\n";
        return 0;
    }
    ll a=D;
    for(int i=60;i>=0;i--){
        if(C>>i&1&&D>>i&1^1&&(a|1ll<<i)<=A){
            a|=1ll<<i;
        }
    }
    if(a==0){
        cout<<"-1\n";
        return 0;
    }
    cout<<A-a<<endl;

    return 0;
}

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

/*----------------------------- DEFINES ------------------------------*/

#define eps 1e-9
#define mod 1000000007
#define ump unordered_map // operations take less time compared to map
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define mp make_pair
#define ps(x) push(x) // for stack and queue
#define T top() //  for stack
#define FR front()// for queue
#define BA back()// for queue
#define PP pop()// for queue and stack
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define MAE max_element
#define MIE min_element
#define cnt(x) count(x)
#define lb(x) lower_bound(x) // returns an it ptng to the element >=x if no such returns end
#define ub(x) upper_bound(x) // returns an it ptng to the element >x if no such returns end
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define reps(i,x,y,k) for(int i=x;i<y;i+=k)
#define sper(i,x,y,k) for(int i=x;i>y;i-=k) 
#define all(x) ((x.B),(x.E))
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x) // easy method to iterate through a ds
#define sq(a) (a)*(a)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)// compute fib(n) in O(1)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}// fast i/o
#define dig(n) (int)(log10(n)+1) // num of digits
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define f(x) find(x)
#define set(x,k) memset(x,k,sizeof x)

/*------------------------------ TYPEDEFS-----------------------------*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef ump<int,int> umpii;

/*-----------------------------START FROM HERE -----------------------*/

int main(){
	FIO
	
	int n,x=0;cin>>n;int ans=0;
	str s;cin>>s;
	rep(i,0,SZ(s)){
		if(s[i]=='D'){
			x--;
			ans=max(ans,x);
		}
		else{
			x++;
			ans=max(ans,x);
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
s = int(input())
mod = 10**9 + 7
dp = [0] * (s+1)
dp[0] = 1
for i in range(1, s+1):
    for j in range((i-3) + 1):
        dp[i] += dp[j]
        dp[i] %= mod
print(dp[s])


Measured memory_bytes: 9120
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<vector<vector<bool> > > wall(5, vector<vector<bool> >(5, vector<bool>(4, false)));

    for(int i=0; i<5; ++i){
        for(int j=0; j<4; ++j){
            char a;
            cin >> a;
            if(a == '1')
                wall[i][j][0] = wall[i][j+1][2] = true;
        }
        if(i < 4){
            for(int j=0; j<5; ++j){
                char a;
                cin >> a;
                if(a == '1')
                    wall[i][j][1] = wall[i+1][j][3] = true;
            }
        }
    }

    char dir[] = {'R', 'D', 'L', 'U'};
    int dy[] = {0, 1, 0, -1};
    int dx[] = {1, 0, -1, 0};

    int y = 0;
    int x = 0;
    int d = 0;
    do{
        if(wall[y][x][d]){
            y += dy[d];
            x += dx[d];
            cout << dir[d];
            d += 3;
            d %= 4;
        }else{
            ++ d;
            d %= 4;
        }
    }while(y != 0 || x != 0);

    cout << endl;
    return 0;
}

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

int main()
{
    int n, i, a[20], b[20];
    cin >> n;
    for(i = 0; i < n; i++)
        cin >> a[i];
    for(i = 0; i < n; i++)
        cin >> b[i];

    int ans = 0;

    for(i = 0; i < n; i++)
        ans += max(0, a[i] - b[i]);

    cout << ans;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch AtCoDeerAndElection | diff AtCoDeerAndElection.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address AtCoDeerAndElection.cpp && ./a.out

/*
 
 5/2/2020
 
 16:14-
 
 */

const int MAX_N=1e3+1;
LL A[MAX_N],B[MAX_N];
int N;

bool ok(LL x) {
  LL a=x*A[N-1],b=x*B[N-1];
  for(int i=N-2; i>=0; --i) {
    LL aa=A[i],bb=B[i];
    LL co=min(a/aa,b/bb);
    if(co<1) return false;
    a=aa*co,b=bb*co;
  }
  return true;
}
void solve() {
  LL good=1e18/(A[N-1]+B[N-1]),bad=0;
  while(abs(good-bad)>1) {
    LL mid=(good+bad)/2;
    bool res=ok(mid);
    (res?good:bad)=mid;
  }
  cout<<good*(A[N-1]+B[N-1])<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N) cin>>A[i]>>B[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>
#include <queue>
#include <string.h>
using namespace std;

#define N 20000
#define lim 30000

int ret[N];
int gcd(int x,int y) {
  if(x==0) {
    return y;
  }
  return gcd(y%x,x);
}
void solve() {
  int n;scanf("%d ", &n);

  int pos = 0;
  if(n*2<=lim) {
    if(n==3) {
      printf("2 5 63\n");
      return;
    } else {
      ret[pos++] = 3;
      ret[pos++] = 9;
      int parity = 0;
      for(int i=2;i<=lim && pos<n;i+=2) {
        ret[pos++] = i;
        parity += i;
      }
      parity = parity%3;
      if(parity==1) {
        ret[pos-1] += 2;
      } else if(parity==2){
        ret[pos-1] +=4;
      }
    }
  } else {
    for(int i=2;i<=lim;i+=2) {
      if(i==6 && (n&1)) {
        continue;
      }
      ret[pos++] = i;
    }
    for(int i=3;i<=lim && pos<n;i+=3) {
      if(i%2==0) continue;
      ret[pos++] = i;
    }
  }
  for(int i=0;i<pos;++i) {
    printf("%d\n", ret[i]);
  }
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


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

#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(ll i=n;i<=N;++i)
#define rap(i,n,N) for(ll i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 1e2+5;
const ll MAX2 = 11;
const ll MOD = 1000000000;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 450;

ll tc,n,k,x[128],y,z,a,b,sz,tmp,id,res;
string s,t;

int main(){
//	cout<<fixed<<setprecision(10);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>s;
    for(auto i:s)x[i]++;
    sort(x+'a',x+'d');
    if(x['c']-x['a']>1)cout<<"NO\n";
    else cout<<"YES\n";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair < pair <int, int> , int> ppi;
typedef pair < pair <int, int> , ll> ppll;
typedef pair <ll, ll> pll;
typedef string str;

# define endl		 '\n'
# define sep		 ' '
# define F 			 first
# define S 			 second
# define pb			 push_back
# define fast_io 	 ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll md = 1e9+7;

ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a%b);}
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b);}
ll pw(ll a, ll b){
	if (b == 1) return (a+md)%md;
	if (b%2 == 0) return (pw(a*a, b/2)+md)%md;
	else return (a*pw(a*a, b/2)+md)%md;
}

const int xn = 1e6+10;
const int xm = 5e4+10;

int a[xn];

int main(){
	fast_io;
	
	int n;
	cin >> n;
	for (int i=0; i<n; i++) cin >> a[i];
	
	int t = 1;
	for (int i=0; i<n; i++){
		if (a[i] == t) t++;
	}
	if (t == 1){
		cout << -1 << endl;
		return 0;
	}
	cout << n-t+1 << endl;
	
	return 0;
}



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

using namespace std;

int a[10];

int main(void)
{
	scanf("%d %d %d", &a[0], &a[1], &a[2]);
	
	sort(a, a + 3);
	
	if(a[0] == a[1] && a[1] == a[2])
	{
		printf("No");
		return 0;
	}
	
	else if(a[0] == a[1] || a[1] == a[2])
	{
		printf("Yes");
	}
	
	else
	{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
typedef long long ll;
using namespace std;
const int maxn = 200009,MOD = 1e9+7;
const double pi = acos(-1.0);
ll n,k,ans;
int main(){
    scanf("%lld%lld",&n,&k);
    for(ll i = k; i <= n+1; i++){
        ll a = (2*n-i+1)*i/2, b = (i-1)*i/2;
        ans = (ans + a - b + 1) % MOD;
    }
    printf("%lld",(ans % MOD + MOD) % MOD);
    return 0;
}

Measured memory_bytes: 3816
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
signed main() {
	int n, m; cin >> n >> m;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		int p; cin >> p;
		a += p;
	}
	for (int i = 0; i < m; i++) {
		int p; cin >> p;
		b += p;
	}
	cout << a * b << endl;
}


Measured memory_bytes: 3100
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-8;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int N, a[128], b[128];
	char mes[128];
	
	while (scanf("%d", &N), N)
	{
		scanf("%s", mes);
		for (int i = 0; i < N; ++i)
			scanf("%d%d", a + i, b + i);

		for (int i = N-1; i >= 0; --i)
		{
			--a[i], --b[i];
			int sub = abs(a[i] - b[i]);
			mes[a[i]] = (mes[a[i]]-'a'+sub)%26 + 'a';
			mes[b[i]] = (mes[b[i]]-'a'+sub)%26 + 'a';
			swap(mes[a[i]], mes[b[i]]);
		}

		printf("%s\n", mes);
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second
using ll = long long;
using namespace std;

int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> score(n + 1, 0);
    int x;
    while(q--) cin >> x, ++score[x];
    int sum = accumulate(score.begin(), score.end(), 0);
    for(int i = 1; i <= n; ++i) {
        if(sum - score[i] >= k) cout << "No\n";
        else cout << "Yes\n";
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  ll n;
  cin>>n;
  vecll dp(1<<n, 0);
  dp[0] = 1;
  constexpr ll MOD = 1000000007;
  vector<vecint> t(n, vecint(n));
  for(auto&& i:irange(0l,n)) {
    for(auto&& j:irange(0l,n)) {
      cin>>t[i][j];
    }
  }
  for(auto&& k:irange(0,1<<n)) {
    int cnt = 0;
    for(auto&& l:irange(0l,n)) {
      if((k>>l) & 1) ++cnt;
    }
    for(auto&& j:irange(0l,n)) {
      if(((k>>j) & 1) == 0 && t[cnt][j]) {
        dp[k | (1 << j)] += dp[k];
        dp[k | (1 << j)] %= MOD;
      }
    }
  }
  cout<<dp.back()<<endl;
  return 0;
}


Measured memory_bytes: 16640
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::vec::Vec;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: isize,
        b: isize,
    }
    if a.is_positive() {
        println!("Positive")
    } else if a.is_negative() && b.is_positive() {
        println!("Zero")
    } else {
        let neg_count = b - a + 1;
        if neg_count % 2 == 0 {
            println!("Positive")
        } else {
            println!("Negative")
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
ll N;
#define pow5(x) ((x)*(x)*(x)*(x)*(x))
int main()
{
	ll n;
	ll all = 1;
	ll base = 1e18;
	int flg = 0;

	cin >> n;
	rep(i, n) {
		ll ai;
		cin >> ai;

		if ( ai == 0 )
		{
			cout << 0 << endl;
			return 0;
		}

		if ( base / all < ai ) {
			flg = 1;
		}
		else
		{
			all *= ai;
		}
	}

	if ( flg == 1 )
	{
		cout << -1 << endl;
	}
	else
	{
		cout << all << endl;
	}


	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int r,g,b,n;


main(){
  int ans=0;
  cin>>r>>g>>b>>n;

  for(int i=0;i<=n;i+=r){
    for(int j=0;j<=n-i;j+=g){
      int k=n-i-j;
      if(k%b==0) ans++;
    }
  }

  cout<<ans<<endl;
}


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

int main(){
	int S[1005];
	int n,sum;
	while(1){
		cin>>n;
		if(n==0) break;
		sum=0;
		for(int i=0;i<n;i++) cin>>S[i];
		sort(S,S+n);
		for(int i=1;i<n-1;i++) sum+=S[i];
		cout<<sum/(n-2)<<endl;
	}
	return 0;
}


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

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    rep(i, N) A[i] = -A[i];
    sort(all(A));
    ll val = -1;
    ll lo = 0, hi = 1e12;
    while(lo <= hi) {
        ll mid = (lo + hi) >> 1;
        ll cnt = 0;
        rep(i, N) {
            cnt += upper_bound(all(A), -mid - A[i]) - A.begin();
        }
        if(cnt >= M) {
            val = -mid;
            lo = mid + 1;
        } else hi = mid - 1;
    }
    ll sum = 0, cnt = 0;
    rep(i, N) {
        ll c = upper_bound(all(A), val - A[i]) - A.begin();
        sum += -A[i] * c;
        cnt += c;
    }
    sum *= 2;
    sum += (M - cnt) * -val;
    cout << sum << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S, T;
    cin >> S;
    cin >> T;

    int count = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) {
            count++;
        }
    }

    cout << count << "\n";

    return 0;
}


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

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<int>delta(N);

    rep(i, N-1) delta[i] = A[i+1] - A[i];
    delta[N-1] = A[0] + (K - A[N-1]);
    sort(delta.begin(), delta.end()); 

    int ans = 0;
    rep(i, N-1) ans += delta[i];

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1792