akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>


#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;

#define INF 1e9+7
#define ARRAY_MAX 2010

int main(){

    int n;
    string s;
    cin >> n >> s;

    int tmp = 0;
    int mini = INF;
    int ds;
    REP(i,s.length()){
        if(s[i] == '('){
            tmp++;
        }else{
            tmp--;
        }
        mini = min(mini,tmp);
    }

    string ans;
    if(mini < 0){
        for(int i = 0;i < -mini;i++){
            ans.push_back('(');
        }
        tmp += -mini;
    }
    ans += s;
  
    REP(i,tmp){
        ans.push_back(')');
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;


int main()
{
    long N, K, tmp, min = LONG_MAX;
    vector<long> vec, diff;

    cin >> N >> K;
    
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        vec.push_back(tmp);
    }

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

    for (int i = 0; i < N-1; i++) {
        diff.push_back(vec[i+1]-vec[i]);
    }

    for (int i = 0; i < N-K+1; i++) {
        tmp = 0;
        for (int j = 0; j < K-1; j++) {
            tmp+=diff[i+j];
        }
        if (tmp < min) {
            min = tmp;
        }
    }

    cout << min << endl;
    
    return 0;
    
}


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

using namespace std;

double dp[3002][3002], p[3002];int  n;


int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> p[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j > 0)
        dp[i][j] = p[i] * dp[i - 1][j - 1] + ((double)1 - p[i]) * dp[i - 1][j];
      else
        dp[i][j] = ((double)1 - p[i]) * dp[i - 1][j];
    }
  }
  double ans = 0;
  for (int i = (n + 1) / 2; i <= n; i++)
    ans += dp[n][i];
  cout << fixed << setprecision(9) <<  ans;
  return 0;
}


Measured memory_bytes: 68992
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())
    S = [input().rstrip() for i in range(N)]

    Sset = set(S)

    res = len(Sset)

    print(res)



main()


Measured memory_bytes: 35636
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
 
int main(){

  int c,d;
  char a[4],b[4];
  (void) scanf("%s %s",a,b);
  
  strcat(a,b);
  
  c=atoi(a);
  
  d=sqrt(c);
  
  if (d*d == c)
  {
  printf("Yes");
    return 0;
  }
  
  printf("No");
 return 0; 
}

Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 2019;

//a^nを計算する
long long modpow(long int a, long int n, long int mod) {
    long int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    string S; cin >> S;
    ll N = S.size();
    ll DP[N];
    DP[N-1] = (int)S[N-1]-48;
    for(int i = 1; i < N; i++){
        int idx = N-1-i;
        DP[idx] = ( ( (modpow(10, i, MOD) * ((int)S[idx]-48)) ) % MOD + DP[idx+1] )%2019;
    }
    map<ll, ll> M;
    for(int i = 0; i < N; i++) M[DP[i]]++;
    M[0]++;
    ll ans = 0;
    for(auto m : M){
        int tag = m.first;
        int num = m.second;
        if(num >= 2) ans += (num*(num-1))/2;
    }
    cout << ans << endl;

}


Measured memory_bytes: 5232
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

int n;
int a[200010];

int main()
{
    cin >> n;
    rep(i, n) cin >> a[i];
    
    ll ans = 0;
    int xor_res = 0, sum_res = 0;
    int l = 0, r = 0;
    while( l < n ) {
        while ( r < n ) {
            if ( (xor_res^a[r]) == sum_res+a[r] ) {
                xor_res ^= a[r];
                sum_res += a[r];
                ++r;
            } else {
                break;
            }
        }

        ll tmp = r - l;
        ans += tmp;

        xor_res ^= a[l];
        sum_res -= a[l];
        ++l;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<algorithm>
using namespace std;
int e[110];
int f[110];
int main(){
	int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
	for(int i=0;i<d;i++)scanf("%d%d",e+i,f+i);
	int at=0;
	int pr=0;
	while(1){
		if(e[at]==0&&f[at]==0){
			break;
		}
		if(e[at]){
			e[at]--;b++;
			pr+=10;
		}else{
			f[at]--;pr+=100;
		}
		if(b>d)break;
		if(pr>=90){
			pr-=90;
			if(pr/10>b)break;
			e[at]+=pr/10;
			b-=pr/10;
			pr=0;
		}
		at=(at+1)%a;
	}
	printf("%d\n",at+1);
}

Measured memory_bytes: 1032
#include<cstdio>
#include<cmath>
int main(){
    int n,d,x[10][10];
    scanf("%d%d",&n,&d);
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            scanf("%d",&x[i][j]);
        }
    }
    int count=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int d2=0;
            for(int k=0;k<d;k++)d2+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            int t=static_cast<int>(std::sqrt(d2));
            if(t*t==d2)count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

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

void print(int a, int b, char str[]);
void rev(int a, int b, char str[]);
void rep(int a, int b, char str[], char repstr[]);

int main()
{
	char str[1000];
	int orderlen;
	cin >> str;
	cin >> orderlen;
	cin.clear();
	cin.ignore();
	for(int i=0; i<orderlen; i++)
	{
		char orderstr[1000], buf[1100],
			pripar[3][8]={
				"print",
				"reverse",
				"replace"
		};
		int a, b, j=0;
		enum __ORDER{PRI, REV, REP, NONE} ORDER;
		cin.getline(buf, sizeof(buf));
		while(true){
			if(buf[j]==' '){
				bool print=true, replace=true, reverse=true;
				for(int k=0; k<j; k++){
					if(print) if(pripar[0][k] != buf[k]) print = false;
					if(reverse) if(pripar[1][k] != buf[k]) reverse = false;
					if(replace) if(pripar[2][k] != buf[k]) replace = false;
					if(!print && !reverse && !replace) break;
				}
				if(print){
					ORDER = PRI;
				} else if(reverse){
					ORDER = REV;
				} else if(replace){
					ORDER = REP;
				} else {
					ORDER = NONE;
				}
				j++;
				{
					int num=0;
					char numbuf[4]="   ";
					while(true){
						numbuf[num] = buf[j];
						num++;
						j++;
						if(buf[j]== ' ' || buf[j]=='\0') break;
					}
					a = atoi(numbuf);
					j++;
					num = 0;
					while(true){
						numbuf[num] = buf[j];
						num++;
						j++;
						if(buf[j]== ' ' || buf[j]=='\0') break;
					}
					b = atoi(numbuf);
					j++;
				}
				break;
			}
			j++;
		}
		if(ORDER == REP){
			int num = 0;
			while(true){
				if(buf[j]=='\0') break;
				orderstr[num] = buf[j];
				num++;
				j++;
			}
		}
		switch(ORDER){
		case PRI:
			print(a, b, str);
			break;
		case REV:
			rev(a, b, str);
			break;
		case REP:
			rep(a, b, str, orderstr);
			break;
		default:
			break;
		}
	}
	return 0;
}

void print(int a, int b, char str[])
{
	for(int i=a; i<=b; i++){
		cout << str[i];
	}
	cout << endl;
}
void rev(int a, int b, char str[])
{
	char tmp;
	for(int i=a, j=b; i<j; i++){
		tmp = str[i];
		str[i] =str[j];
		str[j] = tmp;
		j--;
	}
}
void rep(int a, int b, char str[], char repstr[])
{
	int i=0;
	for(int j=a; j<=b; j++){
		str[j] = repstr[i];
		i++;
	}
}

Measured memory_bytes: 1172
s=input()
if not(1<=int(s[:2])<=12) and (1<=int(s[2:])<=12):print("YYMM")
elif not(1<=int(s[2:])<=12) and (1<=int(s[:2])<=12):print("MMYY")
elif (1<=int(s[2:])<=12) and (1<=int(s[:2])<=12):print("AMBIGUOUS")
else:print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}



int main(void) {
  ll N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--; B--; C--; D--;
  string s;
  cin >> s;
  ll i;
  
  if(C<D) {
    ll f=1;
    for(i=A; i<=C; i++) {
      if(s[i]=='#' && s[i+1]=='#') {
        f=0;
        break;
      }
    }
    
    for(i=B; i<=D; i++) {
      if(s[i]=='#' && s[i+1]=='#') {
        f=0;
        break;
      }
    }
    
    if(f) pt("Yes");
    else pt("No");
  
  }else {
    ll f=1;
    for(i=A; i<=C; i++) {
      if(s[i]=='#' && s[i+1]=='#') {
        f=0;
        break;
      }
    }
    
    for(i=B; i<=D; i++) {
      if(s[i]=='#' && s[i+1]=='#') {
        f=0;
        break;
      }
    }
    
    ll g=0;
    for(i=B-1; i<D; i++) {
      if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.') {
        g=1;
        break;
      }
    }
    
    if(f*g) pt("Yes");
    else pt("No");
    
  }
  
  
  
  
  
}












Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	var result int

	for i := a; i <= b; i++ {
		if c%i == 0 {
			result++
		}
	}

	fmt.Println(result)
}



Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; 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 comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll k, ans;

void solve() {
	cin >> k;
	for (ll i = 1; i <= k; i++) {
		for (ll j = 1; j <= k; j++) {
			for (ll l = 1; l <= k; l++) {
				ans += gcd(i, gcd(j, l));
			}
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

int in(string s) {
    int cnt = 0;
    rep (i, s.length() - 1)
        if (s.substr(i, 2) == "AB") cnt++;
    return cnt;
}

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

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

    int inlin = 0;
    int a = 0, b = 0, ab = 0;
    rep (i, N) {
        bool frontb = s[i][0] == 'B';
        bool backa = s[i].back() == 'A';
        if (frontb and backa)
            ab++;
        else if (frontb)
            b++;
        else if (backa)
            a++;

        inlin += in(s[i]);
    }

    print(inlin + (a + b == 0 ? max(ab - 1, 0LL) : ab + min(a, b)));

    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(char, c);
  switch (c) {
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
      print("vowel");
      return;
  }
  print("consonant");
}


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

using namespace std;

int mi = 1, N, tmp, ans = 1;

int main( ) {
	scanf( "%d", &N );
	for( register int i = 1; i <= N; i++ ) {
		scanf( "%d", &tmp );
		if( !( tmp % 2 ) ) mi *= 2;
		ans *= 3;
	}
	printf( "%d\n", ans - mi );
	return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
using namespace std ;
#define ld long double
#define int long long
#define _ ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL);
#define dbg(x) cerr << #x << " is " << x << endl;
#define F(i,b) for(int i = 0 ; i < (int)(b) ; i++)
#define RF(j,b) for(int j = (int)(b)-1 ; j >= 0 ; j--)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 2e5+7 ;
const int INF = 1e9 ;
const int MOD = INF + 7 ;
string s ;
int n ;
void solve(){
	cin >> n >> s ;
	s.pb('#') ;
	int cnt = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(s[i] != s[i+1]) cnt++ ;
	}
	cout << cnt << endl ;
}

int32_t main(){_
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}

}


Measured memory_bytes: 512
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_D&lang=jp
*/
//最長増加部分列
#include<iostream>
#include<climits>
using namespace std;

int n;
int L[100000];
int dp[100000];

//O(n^2)アルゴリズム
/*
int LIS(){
  int length=0;
  for(int i=0;i<n;i++){
    dp[i]=1;
    for(int j=0;j<i;j++){
      if(L[i]>L[j]) dp[i]=max(dp[i],dp[j]+1);
    }
    length=max(length,dp[i]);
  }
  return length;
}
*/
int LIS(){
  fill(dp,dp+n,INT_MAX);
  for(int i=0;i<n;i++){
    *lower_bound(dp,dp+n,L[i])=L[i];
  }
  return lower_bound(dp,dp+n,INT_MAX)-dp;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>L[i];
  }
  cout<<LIS()<<"\n";
}



Measured memory_bytes: 3892
import bisect
 
n = int(input())
l = [int(_) for _ in input().split()]
 
l.sort()
 
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a, b = l[i], l[j]
        k = bisect.bisect_right(l, a+b-1)
        ans += k - j - 1
print(ans)

Measured memory_bytes: 3188
import java.io.*;
import java.text.DecimalFormat;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
//        int t = in.nextInt();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) throws IOException {
            int n = in.nextInt();
            double ans = Math.pow((n/3.0), 3);
            DecimalFormat df = new DecimalFormat("0.000000000000");
            out.print(df.format(ans));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public String nextLine() throws IOException {
            return reader.readLine().trim();
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
 
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define hello777 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#include <string>
#define pie 3.14159265358979323846
constexpr int MOD = 1e9+7;
const int N= 50000;
using namespace std;


//ll gcd(int a, int b)
//{ 
//    if (a == 0) 
//        return b;  
//    return gcd(b % a, a);  
// } 
// 
//ll lcm(int a, int b)  
// {  
//    return a/gcd(a, b) *b;  
// }
//  
//int prime(int n)
//{
//	rep(i,2,n+1)
//	{
//		if(n%i==0)return i;
//	}
//	
//}


void solve() 
{
	string s;
	cin>>s;
	int ans=0,temp=0;
	if(s.length()==0)return ;
	if(s[0]=='R')temp=1;
	ans=temp;
	for(int i=1;i<s.length();i++)
	{
		if(s[i]=='R')
		{
			temp++;
		}
		else temp=0;
		ans=max(temp,ans);
	}
	cout<<ans<<endl;
}

int main()
{
	hello777;
	int q=1;
//    cin>>q;
    while(q--)
    {   
      solve();
    }
}

Measured memory_bytes: 3656
#include<iostream>

using namespace std;

#define N 100001

#define SENTINEL 999999998

//Merge function
void Merge(int a[],char c[],int left,int mid,int right){
  
  int n1,n2,i,j;
  int L[N],R[N];
  char Lc[N],Rc[N];
  n1=mid-left;
  n2=right-mid;

  for(i=0;i<n1;i++){
    L[i]=a[left+i];
    Lc[i]=c[left+i];
  }

  for(i=0;i<n2;i++){
    R[i]=a[mid+i];
    Rc[i]=c[mid+i];
  }

  //L[n1]=SENTINEL,R[n2]=SENTINEL
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;

  i=0;
  j=0;
  for(int k=left;k<right;k++){

    if(L[i]<=R[j]){
      a[k]=L[i];
      c[k]=Lc[i];
      i++;
    }
    else{
      a[k]=R[j];
      c[k]=Rc[j];
      j++;
    }
  }

}

//MergeSort function
void MergeSort(int a[],char c[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(a,c,left,mid);
    MergeSort(a,c,mid,right);
    Merge(a,c,left,mid,right);
  }

}


int Partition(int a[],char c[],int p,int r){
  int x,i,j,st;
  char stc;

  x=a[r];
  i=p-1;

  for(j=p;j<=r-1;j++){
    if(a[j]<=x){
      i++;

      //exchange a[i] and a[j]
      st=a[i];
      a[i]=a[j];
      a[j]=st;

      stc=c[i];
      c[i]=c[j];
      c[j]=stc;

    }
  }

  //exchange a[i] and a[j]
    st=a[i+1];
    a[i+1]=a[r];
    a[r]=st;

    stc=c[i+1];
    c[i+1]=c[r];
    c[r]=stc;

    return i+1;

}


void QuickSort(int a[],char c[],int p,int r){
  int q;
  if(p<r){
    q=Partition(a,c,p,r);
    QuickSort(a,c,p,q-1);
    QuickSort(a,c,q+1,r);
  }
}

int main(){
 
  int n,i,a1[N],a2[N];
  char c1[N],c2[N];
  bool flag=true;
  cin >>n;

  for(i=0;i<n;i++){
    cin >>c1[i]>>a1[i];
    a2[i]=a1[i];
    c2[i]=c1[i];
  }


  QuickSort(a1,c1,0,n-1);
  MergeSort(a2,c2,0,n);

  for(i=0;i<n;i++){
    if(c1[i]!=c2[i]){
      cout <<"Not stable"<<endl;
      flag=false;
      break;
    }
  }

  if(flag==true) cout <<"Stable"<<endl;

  for(i=0;i<n;i++){
    cout <<c1[i]<<" "<<a1[i]<<endl;;
  }

  /*  cout <<endl;
  for(i=0;i<n;i++){
    cout <<c2[i]<<" "<<a2[i]<<endl;;
    }*/
  return 0;
}

Measured memory_bytes: 2348
H, W, K = map(int, input().split())

arr = [list(input()) for _ in range(H)]

ans = 0
for row in range(2**H):
  for col in range(2**W):
    count = 0
    for i in range(H):
      if not ((row >> i) & 1): continue
      for j in range(W):
        if not ((col >> j) & 1): continue
        if arr[i][j] == '#':
          count += 1
    if count == K:
      ans += 1
print(ans)

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


int main(){

    string S;
    cin >> S;

    int price = 700;
    
    for( int i = 0; i < 3; i ++ ){
        if( S[i] == 'o' ) price += 100;
    }

    cout << price << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int A, B, C, N;
int X[300];
int I[1000], J[1000], K[1000], L[1000];
int main()
{
	while (true){
		scanf("%d%d%d", &A, &B, &C);
		if (A == 0 && B == 0 && C == 0)return 0;
		scanf("%d", &N);
		for (int i = 0; i < A + B + C; i++)X[i] = 2;
		for (int i = 0; i < N; i++){
			scanf("%d%d%d%d", &I[i], &J[i], &K[i], &L[i]);
			I[i]--; J[i]--; K[i]--;
		}
		for (int CC = 0; CC < N; CC++){
			for (int i = 0; i < N; i++){
				if (L[i] == 1){
					X[I[i]] = 1;
					X[J[i]] = 1;
					X[K[i]] = 1;
				}
				else{
					if (X[I[i]] == 1 && X[J[i]] == 1)X[K[i]] = 0;
					if (X[J[i]] == 1 && X[K[i]] == 1)X[I[i]] = 0;
					if (X[K[i]] == 1 && X[I[i]] == 1)X[J[i]] = 0;
				}
			}
		}
		for (int i = 0; i < A + B + C; i++){
			printf("%d\n", X[i]);
		}
	}
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    long A[N], B[N], C[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
    }
    sort(A, A + N);
    sort(B, B + N);
    sort(C, C + N);
    long ans = 0;
    for (int i = 0; i < N; i++)
    {
        long an = lower_bound(A, A + N, B[i]) - A;
        long cn = N - (upper_bound(C, C + N, B[i]) - C);
        ans += an * cn;
    }

    cout << ans << endl;
}


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

can_be_ans = False
for k in range(1, 10 ** 5):
    if 2 * N == k * (k - 1):
        can_be_ans = True
        break
    elif 2 * N < k * (k - 1):
        break
        
if not can_be_ans:
    print("No")
else:
    print("Yes")
    print(k)
    s_grid = [[0 for i in range(k - 1)] for j in range(k)]
    for i in range(1, k + 1):
        for j in range(k - i):
            s_grid[i - 1][i - 1 + j] = (i - 1) * k - i * (i - 1) // 2 + 1 + j
            s_grid[i + j][i - 1] = (i - 1) * k - i * (i - 1) // 2 + 1 + j
            
    for row in s_grid:
        print(k - 1, end=" ")
        print(" ".join(map(str, row)))

Measured memory_bytes: 12176
n=int(input())
x=[]
f_l_checker=True
x.append(input())
for i in range(1,n):
    x.append(input())
    if f_l_checker:
        if x[i][0]==x[i-1][-1]:
            for j in range(i):
                if x[i]==x[j]:
                    f_l_checker=False
        else:
            f_l_checker=False
if f_l_checker:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 300001
vector<int>dp;
void solve()
{
    int n,w; cin>>n>>w;dp.clear();
    vector<int> val(n),weight(n);int sum=0;
    for(int i=0;i<n;i++)
    cin>>weight[i]>>val[i],sum+=val[i];
    dp.assign(sum+1,INT_MAX); int ans=0;
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=sum-val[i];j>=0;j--)
        {
            dp[j+val[i]]=min(dp[j+val[i]],weight[i]+dp[j]);
        }
    }
    for(int i=0;i<=sum;i++)
    if(dp[i]<=w)
    ans=max(ans,i);
    cout<<ans<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    int i,sum,a,n,ave;
    double no;
    for(i=0,sum=0,no=0.0;scanf("%d,%d",&a,&n)!=EOF;i++){
        sum+=a*n;
        no+=n;
    }
    ave=no/i+0.6;
    printf("%d\n%d\n",sum,ave);
    return 0;
}

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

#define LEN 100005

typedef struct pp {
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main(){
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; ++i) {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1; tail = n+1;

    while (head != tail){
        u = dequeue();
        c = min(q,u.t);
        u.t -= c;
        elaps += c;
        if(u.t > 0) enqueue(u);
        else{
            printf("%s %d\n",u.name,elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 11928
#include "bits/stdc++.h"
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;*/
#define int long long
#define fastr ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,a,b) for(int i = (a-1); i >= b; i--) 
#define fi first
#define se second
#define tit(v,i,c) get<c>(v[i])
#define mt make_tuple 
#define pb push_back
#define mp make_pair
double jk=0.4;
#define power(x,y) pow(x,y)+jk
#define endl "\n"
#define mod 1000000007
#define N 1000000000
int in(){
int n;cin>>n;
return n;}

void _do_(){
		int a,b,n;
		cin>>a>>b>>n;
		if(b>n){
			cout<<((a*n)/b)-a*(n/b)<<endl;
		}
		else if(b<=n){
			int z=b-1;
			cout<<((a*z)/b)<<endl;
		}


}signed main(){fastr
//int tc=in();
int tc=1;
while(tc--)_do_();
cerr<<"Time elapsed:";
cerr<<1000*clock()/CLOCKS_PER_SEC<<" ms\n";
return 0;}

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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back

typedef long long ll;

const int N = 1010;
const int M = 1e9 + 7;

int h, w;

char a[N][N];

ll dp[N][N];

bool valid(int i, int j) {
    return a[i][j] != '#' && 0 <= i && i < h && 0 <= j && j < w;
}
ll calc(int i, int j) {
    if(i == h - 1 && j == w - 1) return 1;
    ll &r = dp[i][j];

    if(r != -1) return r;

    ll res = 0;
    if(valid(i + 1, j)) res += calc(i + 1, j);
    if(valid(i, j + 1)) res += calc(i, j + 1);
    res %= M;
    return r = res;
}

int main() {
    cin >> h >> w;
    fore(i, 0, h) {
        cin >> a[i];
    }
    memset(dp, -1, sizeof dp);
    cout << calc(0, 0) << endl;
}

Measured memory_bytes: 9344
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
ll in(){ll x; cin >> x; return x;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Graph graph;

bool acsy(const pair<P, ll> &a, const pair<P, ll> &b){
	ll y1 = a.fs.sc, y2 = b.fs.sc;
	return y1 < y2;
}

struct UnionFind{
	Vec par;

	UnionFind(ll n) : par(n){
		rep(i, n) par[i] = i;
	}

	ll root(ll x){
		if(par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(ll x, ll y){
		x = root(x), y = root(y);
		if(x != y) par[x] = y;
	}

	bool same(ll x, ll y){
		return root(x) == root(y);
	}
};

int main(void){
	ll n;
	cin >> n;
	graph.resize(n);
	Vec1<pair<P, ll> > p(n);
	rep(i, n){
		cin >> p[i].fs.fs >> p[i].fs.sc;
		p[i].sc = i;
	}

	sort(all(p));
	rep(i, n-1){
		graph[p[i].sc].pb({abs(p[i].fs.fs-p[i+1].fs.fs), p[i+1].sc});
		graph[p[i+1].sc].pb({abs(p[i].fs.fs-p[i+1].fs.fs), p[i].sc});
	}
	sort(all(p), acsy);
	rep(i, n-1){
		graph[p[i].sc].pb({abs(p[i].fs.sc-p[i+1].fs.sc), p[i+1].sc});
		graph[p[i+1].sc].pb({abs(p[i].fs.sc-p[i+1].fs.sc), p[i].sc});
	}

	ll ans = 0;
	UnionFind uf(n);
	using pa = pair<ll, P>;
	priority_queue<pa, Vec1<pa>, greater<> > que;
	for(P i : graph[0]) que.push({i.fs, {0, i.sc}});
	while(!que.empty()){
		pa i = que.top(); que.pop();
		if(uf.same(i.sc.fs, i.sc.sc)) continue;
		uf.unite(i.sc.fs, i.sc.sc);
		ans += i.fs;
		for(P o : graph[i.sc.sc]){
			que.push({o.fs, {i.sc.sc, o.sc}});
		}
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 23024
#include<bits/stdc++.h>
#define N 10

using namespace std;

char c1[N], c2[N];

int main(){
	scanf("%s", c1);
	scanf("%s", c2);
	int c=0;
	for(int i=0;i<3;i++) if(c1[i]==c2[i]) c++;
	printf("%d\n", c);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
string S;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;

    int N = S.length();
    vector<int> v;
    char p1 = S[0]; int p2 = 0;
    rep(i, 1, N) if (S[i] != p1) v.push_back(i - p2), p2 = i, p1 = S[i];
    v.push_back(N - p2);

    //fore(i, v) printf("[%d]\n", i);

    deque<int> d;
    fore(i, v) d.push_back(i);

    int ans = N;
    while (1 < d.size()) {
        int a = d.front();
        int b = d.back();

        if (d.size() == 2) {
            ans = min(ans, max(a, b));
            break;
        }

        if (a < b) {
            int x1 = d.front(); d.pop_front();
            int x2 = d.front(); d.pop_front();

            ans = min(ans, N - a);
            d.push_front(x1 + x2);
        } else {
            int x1 = d.back(); d.pop_back();
            int x2 = d.back(); d.pop_back();

            ans = min(ans, N - b);
            d.push_back(x1 + x2);
        }
    }

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

Measured memory_bytes: 720
import sys


n = int(input())
l = [[int(i) for i in input().split()] for j in range(n)]


for i in range(0, 101):
    for j in range(0, 101):
        ans = 1
        for k in range(n):
            if l[k][2] != 0:
                h = l[k][2] + abs(i - l[k][0]) + abs(j - l[k][1])
                break
        for k in range(n):
            if l[k][2] != max(h - abs(i - l[k][0]) - abs(j - l[k][1]), 0):
                ans = 0
        if ans:
            print(i, j, h)
            sys.exit()


Measured memory_bytes: 3188
def factorial(n):
    res = 1
    for i in range(1, n + 1):
        res *= i
    return res


def combination(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r))


n = int(input())
s = [input()[0] for _ in range(n)]

march = [0] * 5
for c in s:
    if c in 'MARCH':
        march['MARCH'.index(c)] += 1

k = sum(x > 0 for x in march)
if k < 3:
    print(0)
    exit()


print(march[0] * march[1] * march[2]
    + march[0] * march[1] * march[3]
    + march[0] * march[1] * march[4]
    + march[0] * march[2] * march[3]
    + march[0] * march[2] * march[4]
    + march[0] * march[3] * march[4]
    + march[1] * march[2] * march[3]
    + march[1] * march[2] * march[4]
    + march[1] * march[3] * march[4]
    + march[2] * march[3] * march[4])

Measured memory_bytes: 4012
#include <iostream>
#include <cstring>
#include <string>
using namespace std;

int main() {
	string S, T; cin >> S >> T;
	
	if (S == T) {//最初からそろっていれば終了
		cout << "Yes";
		return 0;
	}

	for (int i = 0; i < S.size(); i++) {
		//cout << S[S.size()-1];
		S = S.back() + S.substr(0,S.size()-1);//最後尾と部分文字列を接続
		//cout << S.c_str() << endl;
		if (S == T) {
			cout << "Yes" << endl;
			return 0;
		}
		//cout << S.c_str() << endl;
	}
	cout << "No" << endl;
	return 0;

}

Measured memory_bytes: 256
/* C */

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long int n, m, l, r, a, b;
	cin >> n >> m;
	l = 0, r = n;
	for(int i = 0; i < m; i++){
		cin >> a >> b;
		l = max(a, l);
		r = min(b, r);
	}
	if(r - l + 1 >= 0) cout << r - l + 1 << endl;
	else cout << 0 << endl;

}

Measured memory_bytes: 256
from collections import deque

S = deque()


def main():
    N = int(input())

    while N:
        if (abs(N % -2) == 1):
            S.appendleft('1')
            N -= 1
        else:
            S.appendleft('0')
        N //= -2

    if not S:
        S.append('0')

    print(''.join(list(S)))
    return


main()


Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
    int N;
    string S;
    cin>>N>>S;
    map<char, int> a;
    a['R'] = 0;
    a['B'] = 0;
    for(int i = 0; i < N; i++){
        a[S[i]]++;
    }
    
    if(a['B'] < a['R']){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int A[5];
#define INF 100000000
#define _for(i,j,N) for(int i = (j);i < (N);i++)

int get_res(){
    int ret_val = 0;
    _for(i,0,5){
        ret_val+=A[i];
        if(ret_val%10 && i!=4) {
            ret_val/=10;
            ret_val++;
            ret_val*=10;
        }
    }
    return ret_val;
}

int main()
{
    scanf("%d %d %d %d %d",&A[0],&A[1],&A[2],&A[3],&A[4]);
    int minn = INF;

    sort(A,A+5);
    do{
        minn = min(minn,get_res());
    }while(next_permutation(A,A+5));


    printf("%d\n",minn);

    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 ul;
typedef pair<ul, ul> P;

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

int main(){
    int K, S, counter = 0;
    
    cin >> K >> S;

    rep(i,K + 1){
        int t = 0;
        rep(j,K + 1){
            t = S - i - j;
            if(t >= 0 && t <= K) counter++;
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
using namespace std;
const int inf=0x3f3f3f3f;
int n,m,bx,by,ex,ey,s,t,cnt,tot,id[105][105],head[100005],dep[100005],to[1000005],nxt[1000005],dd[1000005];
char str[105][105];
queue<int> q;
void adde(int u,int v,int d){
    to[++cnt]=v;
    nxt[cnt]=head[u];
    dd[cnt]=d;
    head[u]=cnt;
    to[++cnt]=u;
    nxt[cnt]=head[v];
    dd[cnt]=0;
    head[v]=cnt;
}
bool bfs(){
    for(int i=s;i<=t;i++){
        dep[i]=0;
    }
    dep[s]=1;
    q.push(s);
    while(!q.empty()){
        int u=q.front(),v;
        q.pop();
        for(int i=head[u];i;i=nxt[i]){
            v=to[i];
            if(dd[i]&&!dep[v]){
                dep[v]=dep[u]+1;
                q.push(v);
            }
        }
    }
    return dep[t];
}
int dfs(int u,int f){
    if(u==t||!f){
        return f;
    }
    int v,tmp,flow=0;
    for(int i=head[u];i&&f;i=nxt[i]){
        v=to[i];
        if(dd[i]&&dep[v]==dep[u]+1&&(tmp=dfs(v,min(f,dd[i])))){
            dd[i]-=tmp;
            dd[i^1]+=tmp;
            f-=tmp;
            flow+=tmp;
        }
    }
    if(!flow){
        dep[u]=0;
    }
    return flow;
}
int maxflow(){
    int flow=0;
    while(bfs()){
        flow+=dfs(s,inf);
    }
    if(flow>=inf){
        puts("-1");
        exit(0);
    }
    return flow;
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%s",str[i]+1);
        for(int j=1;j<=m;j++){
            if(str[i][j]=='S'){
                bx=i;
                by=j;
            }else if(str[i][j]=='T'){
                ex=i;
                ey=j;
            }else if(str[i][j]=='o'){
                tot++;
                id[i][j]=n+m+tot;
            }
        }
    }
    if(bx==ex||by==ey){
        puts("-1");
        return 0;
    }
    s=0,t=n+m+2*tot+1,cnt=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(str[i][j]=='o'){
                adde(id[i][j],id[i][j]+tot,1);
                adde(id[i][j]+tot,i,inf);
                adde(i,id[i][j],inf);
                adde(id[i][j]+tot,j+n,inf);
                adde(j+n,id[i][j],inf);
            }
        }
    }
    adde(s,bx,inf);
    adde(s,by+n,inf);
    adde(ex,t,inf);
    adde(ey+n,t,inf);
    printf("%d\n",maxflow());
    return 0;
}

Measured memory_bytes: 11008
a,b,c=map(int,input().split())

if a==1 and b==0 and c==0:
    print('Close')
if a==0 and b==1 and c==0:
    print('Close')
if a==1 and b==1 and c==0:
    print('Open')
if a==0 and b==0 and c==1:
    print('Open')
if a==0 and b==0 and c==0:
    print('Close')



Measured memory_bytes: 5596
<?php

fscanf(STDIN, "%d %d %d", $a,$b,$c);

echo 1/2 * $a * $b * sin(deg2rad($c)),PHP_EOL;
// echo sin(deg2rad(90));
echo $a + $b + sqrt($a**2 + $b**2 - 2 * $a * $b * cos(deg2rad($c))),PHP_EOL;

echo $b * sin(deg2rad($c));


Measured memory_bytes: 9248
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

int main() {
  ll x=0,y=0,z=0,k,n,m,h,w,sum=0,ans=0,Max=1,Min=1e9+1;
  string s,t,u;
  bool ok = true;
  cin >> n;
  VI c(n);
  VS a(n);
  map<string, int> b;
  rep(i,n) cin >> a[i];
  rep(i,n){
    auto itr = b.find(a[i]); //findは見つからなければend()を返す。
    if(itr != b.end()){
      itr -> second++;
    }
    else
      b.insert(make_pair(a[i],1));
  }
  for( auto i = b.begin(); i != b.end();i++ ) { 
    chmax(Max,i->second);
  }
  for( auto i = b.begin(); i != b.end();i++ ) { 
    if(Max == i->second){
      cout << i->first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 27520
#include <stdio.h>

int main(){
	int N;
	int V[20];
	int C[20];
	int i;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&V[i]);
	}
	for(i=0;i<N;i++){
		scanf("%d",&C[i]);
	}
	int m;
	m=0;
	for(i=0;i<N;i++){
		if(V[i]>C[i]){
			m=m+V[i]-C[i];
		}
	}
	printf("%d",m);
}

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

int main(){
	string s; cin >> s;
	int n = s.size();
  	map<ll,ll> mp;
  	mp[0] = 1;
	reverse(s.begin(), s.end());
  	int ten = 1; int x = 0;
  	for(int i = 0; i < n; i++){
    	x = ((s.at(i)-'0')*ten + x)%num;
      	ten = ten*10;
      	ten = ten%num;
      	mp[x]++;
    }
  	
  	int sm = 0;
  	for(auto c: mp){
		if(c.second >= 2) sm += c.second*(c.second-1)/2; 
    }
  	cout << sm << endl;
} 

Measured memory_bytes: 3744
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    List<long> input = IO.GetLongList();
	    long a = input[0];
	    long b = input[1];
	    long k = input[2];
	    
	    long ra = Math.Max(a-k,0);
	    long rb = Math.Max(b-Math.Max(k-a,0),0);
	    
	    Console.WriteLine(ra + " " + rb);
	    
	}
    
}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}


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

int main(){
    string s,s2,s3;
    cin >> s;
    int l;
    l=s.size();
    s2=s;
    s3=s[l-1];
    if(s3=="s"){
        s2=s2+"es";
    }
    else{
        s2=s2+"s";
    }

    cout << s2 << endl;

    

    return 0;
}

Measured memory_bytes: 3632