akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<int> X;

void input(){
    #ifdef __LOCAL
        fs::path path_to_file = __FILE__;
        fs::path input,output;
        input = output = path_to_file.parent_path();
        input += string("/input/") + string(path_to_file.stem()) + string(".txt");
        output += string("/output/") + string(path_to_file.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    REP(i,N){
        int x;
        cin >> x;
        X.push_back(x);
    }
}

int solve(){
    int p;
    p=accumulate(ALL(X),0)/N;
    ll sum1=0;
    for(auto x:X) sum1+= (x-p)*(x-p);
    p=accumulate(ALL(X),0)/N+1;
    ll sum2=0;
    for(auto x:X) sum2+= (x-p)*(x-p);
    ll ans=min(sum1,sum2);
    cout << ans << endl;


    return 0;    
}

int main(){
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<iomanip>
#include<bits/stdc++.h>
#include<cstdio>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define bll __builtin_popcountll
#define bufclr while((getchar())!='\n')
#define bufcl int ws=cin.get()
#define bl "\n"
#define mp make_pair
#define pb push_back
#define ll long long int
#define UI unsigned int
#define mod  1000000007 /*998244353*/ 
//#define fs first
//#define sc second
#define fora(i,a,x) for(int i=a; i<x; ++i)
#define fors(i,x,a) for(int i=x; i>a; --i)
using namespace std;
void op(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin);
    freopen("output.txt" , "w" , stdout);
    #endif
}
int C(pair<int,int> &a ,pair<int,int> &b){
    return a.first<b.first;
}
void dfs(vector<vector<int> > &vec, int i,int nw, int k,int n){
    //cout<<nw;
    ll res=1;
    if(i==n && nw==k){
        res = (res + 1)%mod;
        return;
    }
    else if(nw>k)
        return;
    else{
    //    vis[i]=1;
        for(auto itr: vec[i]){
         dfs(vec,itr,nw+1,k,n);    
    }
}    

    }
    

long long power(long long x, int y) 
{ 
    long long res = 1;    
   
    while (y > 0) 
    { 
      
        if (y & 1) 
            res = (res*x)%mod; 
   
        y = y>>1; 
        x = (x*x)%mod;  
    } 
    return res%mod; 
}

int main(){
	op();
	
    int n;
    cin>>n;

    ll ans=0;int i=1;
    while((n-1)/i >= i){
        ans += (1+ ((n-1)/i - i)*2);
        ++i;
    }
    cout<<ans;
    return 0;
}


        





            


Measured memory_bytes: 3640
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::string S;

  std::cin >> S;

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

  return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll a,b;
  cin >> a >> b;
  ll cnt = 0;
  ll sum = 1;
  while(sum<b){
    cnt++;
    sum += a-1;
  }
  cout << cnt<< endl;
  return 0;
}


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

long long mod=1000000007;

long long Fermat(long long A,long long B){
    if (B==0){
        return 1;
    } else if (B==1){
        return A%mod ;
    } else if (B%2==0){
        return (Fermat(A,B/2)*Fermat(A,B/2))%mod;
    } else {
        return (((Fermat(A,B/2)*Fermat(A,B/2))%mod)*A)%mod;
    }
}

int asort(const void *A,const void *B){
    return *(long long*)A>*(long long*)B?1:0;
}

int main(void){
    long long n,k,p[2500],q[2500];
    p[0]=1,p[1]=1,q[0]=1,q[1]=1;
    scanf("%lld%lld",&n,&k);
    for (int i=2; i<2500; i++){
        p[i]=(i*p[i-1])%mod;
        //printf("%d %lld\n",i,p[i]);
    }
    for (int i=2; i<2500; i++){
        q[i]=Fermat(p[i],mod-2);
        //printf("%lld\n",q[i]);
    }
    for (int i=1; i<=k; i++){
        if (i<=n-k+1){
            long long ans=1,tmp=1;
            ans=p[n-k+1];
            ans=(ans*q[i])%mod;
            ans=(ans*q[n-k+1-i])%mod;
            if (i!=1){  
                ans=(ans*p[k-1])%mod;
                ans=(ans*q[i-1])%mod;
                ans=(ans*q[k-i])%mod;
            }
            if (i!=1){
                tmp=(tmp*p[k-1])%mod;
                tmp=(tmp*q[i-1])%mod;
                tmp=(tmp*q[k-i])%mod;
            }
            printf("%lld\n",ans);
        } else {
            printf("0\n");
        }
    }
    return 0;
}

Measured memory_bytes: 256
'use strict'
function main(input) {
  input = input.trim().split(' ')
  let n = Number(input[0])
  let k = Number(input[1])
  let result = 0

  for (let i = 1; i <= n; i++) {
    if (i >= k) {
      result += 1 / n
    } else {
      let count = Math.ceil((Math.log(k / i) / Math.log(2)))
      result += Math.pow(0.5, count) / n
    }
  }

  console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 9420
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int N_MAX = 100000;
int main()
{
  int n,i,j;
  long long t,res=0;
  string s[N_MAX];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> s[i];
    sort(s[i].begin(),s[i].end());
  }
  sort(s,s+n);
  for(i=1,j=0;i<n;i++)
    if(s[i]!=s[i-1]){
      t=i-j;
      res+=t*(t-1)/2;
      j=i;
    }
  t=n-j;
  res+=t*(t-1)/2;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 9344
fun main(args: Array<String>) {
    val N = nextInt()
    val P = listOfInt()
    var ans = 0
    for (n in 1 until N-1) {
        if (P[n-1] < P[n] && P[n] < P[n+1]) ans++
        if (P[n-1] > P[n] && P[n] > P[n+1]) ans++
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 37908
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while(s.hasNext()) {
			double a = s.nextDouble();
			double b = s.nextDouble();
			double c = s.nextDouble();
			double d = s.nextDouble();
			double e = s.nextDouble();
			double f = s.nextDouble();
			
			double x = (e*c - b*f)/(a*e - d*b);
			double y = (d*c - a*f)/(b*d - a*e);
			if(x == -0.0) {
				x = 0;
			}
			if(y == -0.0) {
				y = 0;
			}
			System.out.printf("%.3f %.3f\n",x,y);
		}
		
	}
}

Measured memory_bytes: 20488
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
ll X, Y;
int main()
{
    cin >> X >> Y;
    if (X % Y == 0)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << X << endl;
    return 0;
}


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

int cnt = 2, seze = 5e4, A = 0, B = 1, tA, tB, A0, A1, B0, B1;
int pow2[110], wA[110], wB[110], tmp[110];

int main() {
	puts("32926");
	puts("+ 0 1 3");
	puts("+ 3 3 3");
	puts("< 1 3 3");
	pow2[0] = ++cnt;
	for (int i = 1; i <= 30; ++i) pow2[i] = ++cnt, printf("+ %d %d %d\n", pow2[i - 1], pow2[i - 1], pow2[i]);
	tA = ++cnt, tB = ++cnt;
	printf("+ %d %d %d\n", A, pow2[0], tA);
	printf("+ %d %d %d\n", B, pow2[0], tB);
	A0 = ++seze, A1 = ++seze, B0 = ++seze, B1 = ++seze;
	for (int i = 30; ~i; --i) {
		printf("+ %d %d %d\n", pow2[i], A0, A1);
		wA[i] = ++cnt;
		printf("< %d %d %d\n", A1, tA, wA[i]);
		tmp[0] = ++seze;
		printf("+ %d %d %d\n", wA[i], tmp[0], tmp[0]);
		for (int j = 1; j <= i; ++j) tmp[j] = ++seze, printf("+ %d %d %d\n", tmp[j - 1], tmp[j - 1], tmp[j]);
		printf("+ %d %d %d\n", A0, tmp[i], A0);
	}
	for (int i = 30; ~i; --i) {
		printf("+ %d %d %d\n", pow2[i], B0, B1);
		wB[i] = ++cnt;
		printf("< %d %d %d\n", B1, tB, wB[i]);
		tmp[0] = ++seze;
		printf("+ %d %d %d\n", wB[i], tmp[0], tmp[0]);
		for (int j = 1; j <= i; ++j) tmp[j] = ++seze, printf("+ %d %d %d\n", tmp[j - 1], tmp[j - 1], tmp[j]);
		printf("+ %d %d %d\n", B0, tmp[i], B0);
	}
	for (int i = 0; i <= 30; ++i)
		for (int j = 0; j <= 30; ++j) {
			tmp[0] = ++seze;
			printf("+ %d %d %d\n", wA[i], wB[j], tmp[0]);
			printf("< %d %d %d\n", pow2[0], tmp[0], tmp[0]);
			for (int k = 1; k <= i + j; ++k) tmp[k] = ++seze, printf("+ %d %d %d\n", tmp[k - 1], tmp[k - 1], tmp[k]);
			printf("+ %d %d %d\n", 2, tmp[i + j], 2);
		}
	return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	int ans = 0;
	string tmp = "";
	for(int i = 0; i < s.length() - 1; ++i){
        if(s[i] != s[i + 1]) ans++;
	}
	cout << ans;
	return 0;

}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

#define __ { \
	freopen("input.txt","r",stdin); \
	freopen("output.txt","w",stdout); \
}
#define _ { \
	ios_base::sync_with_stdio(false); \
    cin.tie(NULL); \
}

int main(){
   _;
   //__;
   map<int,vector<int> > m;
   for(int i=0;i<3;i++){
   	int a,b;cin>>a>>b;
    m[a].emplace_back(b);
    m[b].emplace_back(a);
   }
   vector<int> v(4);
   for(int i=0;i<4;i++)v[i]=i+1;
   	bool ok=1;
   	do{
   		for(int i=0;i<3;i++){
   			if(find(m[v[i]].begin(),m[v[i]].end(),v[i+1])==m[v[i]].end()){
                  break;
   			}
   			else if(i==2){cout<<"YES";return 0;}
   		}

   	}while(next_permutation(v.begin(),v.end()));
cout<<"NO";return 0;
}

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

#define mem(arr,x) memset(arr,x,sizeof(arr))
#define pb push_back
#define ll long long
#define mp make_pair
#define rep(i,n)  for(ll i=0;i<n;i++)
#define repi(i,n)  for(ll i=1;i<=n;i++)
#define all(x)   (x.begin(),x.end())

const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;  
int max(int a,int b)
{
	if(a>b)
	return a;
	return b;
}


int main()
{
	
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin>>s;
int ans=1;
int n=(int)s.length();
int f=0;
rep(i,n)
{
	if(s[i]=='R')
	{
		f=1;
		break;
	}
}
for(int i=0;i<n-1;i++)
{
	if(s[i]=='R' && s[i+1]=='R')
	{ans++;
		
	}
}
if(f==0)
cout<<0;
else
cout<<ans;





}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int oo = 1e18 + 7, mod = 1e9 + 7;
const int N = 2e5 + 5;
 
int n, k, arr[N], cnt[N], nxt[N], lst[N], mn[N], dist[N];
bool ck = 0, vis[N];
set<int> se;
vector<int> vc;
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
	    cin >> arr[i];
	    cnt[arr[i]]++;
	    if(!mn[arr[i]]) mn[arr[i]] = i;
	    if(cnt[arr[i]] >= 2) ck = 1;
	}
	if(!ck){
	    //cout << -1 << "\n";
	    for(int i = 1; i <= n; i++){
	        nxt[i] = (i % n) + 1;
	        dist[i] = 1;
	    }
	    dist[n] = 2;
	}
	else{
	    for(int i = 1; i <= (N - 5); i++) lst[i] = n + 1;
	    nxt[n + 1] = nxt[1] + n;
    	for(int i = n; i >= 1; i--){
            if(cnt[arr[i]] == 1){
                //cout << i << " " << (i % n) + 1 << "\n";
                nxt[i] = (i % n) + 1;
                //cout << i << " " << nxt[i] << "\n";
                if(i != n) dist[i] = 1;
                else dist[i] = 2;
            }
            else{
                if(lst[arr[i]] == (n + 1)){
                    nxt[i] = mn[arr[i]] + 1;
                    dist[i] = 1;
                }
                else{
                    nxt[i] = lst[arr[i]] + 1;
                    if(nxt[i] > n){
                        dist[i] = 1;
                        nxt[i] -= n;
                    }
                }
            }
            lst[arr[i]] = i;
    	}
	}
	//for(int i = 1; i <= n; i++) cout << nxt[i] << " " << dist[i] << "\n";
	int itr = 1;
	while(k > 1 && !vis[itr]){
	    //cout << itr << " ";
	    vis[itr] = 1;
	    k -= dist[itr];
	    itr = nxt[itr];
    }
    //cout << k << " " << itr << "\n";
    if(k > 1){
        int temp = itr, tol = 0;
        while(1){
            tol += dist[itr]; 
            itr = nxt[itr];
            if(itr == temp) break;
        }
        //cout << tol << "\n";
        k %= tol;
        if(!k) k += tol;
        itr = temp;
        while(k > 1){
            k -= dist[itr];
            itr = nxt[itr];
        }
    }
    //cout << itr << "\n";
    for(int i = itr; i <= n; i++){
        if(se.find(arr[i]) != se.end()){
            int pos;
            for(int j = vc.size() - 1; j >= 0; j--){
                se.erase(vc[j]);
                if(vc[j] == arr[i]){
                    pos = j;
                    break;
                }
            }
            vc.erase(vc.begin() + pos, vc.end());
        }
        else{
            se.insert(arr[i]);
            vc.pb(arr[i]);
        }
        //cout << vc.size() << "\n";
    }
    for(int i = 0; i < vc.size(); i++) cout << vc[i] << " ";
    return 0;
}
 

Measured memory_bytes: 21908
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClarss
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		string[] s = Input();
		long max = -10;
		for(int i = 0; i < n; i++)
		{
			long h = long.Parse(s[i]);
			if(h-1>=max)
			{
				max=h-1;
				continue;
			}
			if(max <= h)
			{
				max=h;
				continue;
			}
			h-=1;
			
			if(max>h)
			{
				Console.WriteLine("No");
				return;
			}
			max=h;
			
		}
		Console.WriteLine("Yes");
	}

	
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 26592
#include<iostream>
#include<string>
#include <bits/stdc++.h>
#include<vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <math.h>
#include <iomanip>
using namespace std;
using ll = long long;

int main(){
  int n,k,p[1010],i,sum=0;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  sort(p,p+n);

  for(i=0;i<k;i++){
    sum += p[i];
  }
  cout << sum << endl;

return 0;

}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll> x(n), y(n), h(n);
	rep(i, n) cin >> x[i] >> y[i] >> h[i];
	for (ll cx = 0; cx <= 100; cx++) {
		for (ll cy = 0; cy <= 100; cy++) {
			set<ll> s, a;
			rep(i, n) {
				if (h[i] != 0) {
					s.insert(h[i] + abs(x[i] - cx) + abs(y[i] - cy));
				}
				else {
					a.insert(abs(x[i] - cx) + abs(y[i] - cy));
				}
			}
			if (s.size() == 1 && (*begin(s) <= *begin(a)||a.size()==0)) {
				cout <<cx<<" "<<cy<<" "<< *rbegin(s) << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <utility>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;

double dp[301][301][301];
int flag[301][301][301];

double solve(int n, int c1, int c2, int c3) {
  // cout << "c1: " << c1 << endl;
  // cout << "c2: " << c2 << endl;
  // cout << "c3: " << c3 << endl;
  if (flag[c1][c2][c3] == 1) {
    return dp[c1][c2][c3];
  }
  flag[c1][c2][c3] = 1;
  if (c1 == 0 & c2 == 0 & c3 == 0) {
    return dp[c1][c2][c3] = 0;
  }
  double div = double(c1 + c2 + c3) / double(n);
  // cout << "div: " << div << endl;
  double res = 1.0 / div;
  // cout << "res: " << res << endl;
  if (c1 > 0) {
    res += solve(n, c1 - 1, c2, c3) * c1 / n / div;
  }
  if (c2 > 0) {
    res += solve(n, c1 + 1, c2 - 1, c3) * c2 / n / div;
  }
  if (c3 > 0) {
    res += solve(n, c1, c2 + 1, c3 -1) * c3 / n / div;
  }
  return dp[c1][c2][c3] = res;
}

int main() {
  int n;
  cin >> n;
  // vector<int> a(n);
  int c1 = 0;
  int c2 = 0;
  int c3 = 0;
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    if (j == 1) c1++;
    if (j == 2) c2++;
    if (j == 3) c3++;
  }
  double ans;
  ans = solve(n, c1, c2, c3);
  // cout << fixed;
  // cout << setprecision(10) << ans << endl;
  printf("%.10f\n",ans);
}


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

int main()
{
  string s;
  vector<queue<char>> vq(3);
  for (int i = 0; i < 3; i++)
  {
    cin >> s;
    for (int j = 0; j < s.size(); j++)
      vq.at(i).push(s[j]);
  }
  char turn = 0;
  while (true)
  {
    char nxt_turn = vq[turn].front() - 'a';
    vq[turn].pop();
    turn = nxt_turn;
    if (vq[turn].empty())
      break;
  }
  cout << (char)('A' + turn) << endl;
}

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

int main(){
    int m,f,r,sum=0;
    cin>>m>>f>>r;
    while(1){
        if(m==-1&&f==-1&&r==-1) break;
        sum=m+f;
        if(m==-1||f==-1) cout<<"F"<<endl;
        else if(sum>=80) cout<<"A"<<endl;
        else if(65<=sum&&sum<80) cout<<"B"<<endl;
        else if(50<=sum&&sum<65) cout<<"C"<<endl;
        else if(30<=sum&&sum<50){
            if(r>=50) cout<<"C"<<endl;
            else cout<<"D"<<endl;
        }
        else cout<<"F"<<endl;
        sum=0;
        cin>>m>>f>>r;
    }
}


Measured memory_bytes: 3088
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/

int main(void){
  long N;
  cin >> N;
  vector<long> a(N), b(N), c(N);
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
  rep(i, N) cin >> c[i];
  
  sort(a.begin(), a.end());
  sort(c.begin(), c.end());
  long count = 0;
  
  rep(i, N) {
    long a_low = (long)(upper_bound(ALL(a), b[i]-1)-a.begin());
    long c_low = (long)(c.end() - lower_bound(ALL(c), b[i]+1));
    //cout << "a_low:" << a_low << ", c_low: " << c_low << endl;
   	count += a_low * c_low;
  }
  cout << count << endl;
  	


}


Measured memory_bytes: 2560
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		HashSet<Integer> paper = new HashSet<>();
		for (int i=0; i<N; i++) {
			int ai = sc.nextInt();
			if(paper.contains(ai)) {
				paper.remove(ai);
			}else {
				paper.add(ai);
			}
		}
		System.out.println(paper.size());
		sc.close();
	}
}

Measured memory_bytes: 62244
#include <stdio.h>

int main(void) {
  int n, i, x, min, max;
  long long int sum;

  scanf("%d", &n);

  scanf("%d", &x);
  min = max = sum = x;

  for (i = 1; i < n; i++) {
    scanf("%d", &x);

    if (x > max) {
      max = x;
    }

    if (x < min) {
      min = x;
    }

    sum += x;
  }

  printf("%d %d %lld\n", min, max, sum);

  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;
struct edge { ll to, cost; };
std::vector<edge>v[100010], w[100010];
typedef std::vector<std::vector<int>>ma;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
bool f = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
	std::string s, t, r;
	std::cin >> s >> t >> r;
	if (s[s.size() - 1] == t[0] && t[t.size() - 1] == r[0])std::cout << "YES" << std::endl;
	else std::cout << "NO" << std::endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);

int main(){ 
  int n, l;
  cin >> n >> l;
  vector<string> s;
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    s.emplace_back(t);
  }
  sort(s.begin(), s.end());
  for (auto e : s) cout << e;
  cout << endl;
  return 0;  
} 

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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

void solve() {

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


	vvl dp(n + 1, vl(n + 1, 0));

	// dp[i][j] = max(score of frts person - score of second person) for interval (i,j);

	for (int i = n - 1; i >= 0; i--) {
		for (int j = i; j < n; j++) {
			if (i == j) {
				dp[i][j] = a[i];
			} else {
				dp[i][j] = max(a[i]-dp[i+1][j], a[j]-dp[i][j-1]);
			}
		}
	}

	cout << dp[0][n-1] << endl;

}

int32_t main()
{
	IOS
	// int T; cin >> T; while (T--)
	solve();
	return 0;
}


Measured memory_bytes: 73680
#include<stdio.h>
int main(void)
{
  int num, ing,min=1000;
  scanf("%d%d", &num,&ing);
  int grm[num],i,count=0;
  for(i=0;i<num;i++)
  {
    scanf("%d",&grm[i]);
    ing=ing-grm[i];
    if(min>grm[i]) min=grm[i];
    count++;
  }
  while(min<=ing)
  {
    ing=ing-min;
    count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool B[1000100];
signed main(){
  int N;
  cin>>N;
  int n=N;
  vector<int> A(N);
  int g=0;
  for(int &i:A){
    cin>>i;
    g=__gcd(g,i);
    if(i==1)n--;
  }
  if(g!=1){
    puts("not coprime");
    return 0;
  }
  if(n>78500){
    puts("setwise coprime");
    return 0;
  }
  for(int i=0;i<=1000000;i++)B[i]=false;
  for(int &i:A){
    for(int j=2;j<=i/j;j++){
      if(i%j)continue;
      if(B[j] || B[i/j]){
        puts("setwise coprime");
        return 0;
      }
      B[j]=B[i/j]=true;
    }
    if(i==1)continue;
    if(B[i]){
      puts("setwise coprime");
      return 0;
    }
    B[i]=true;
  }
  puts("pairwise coprime");
}

Measured memory_bytes: 11724
#include <iostream>
#include <array>

using namespace std;

int main(void){
    int N;
    cin >> N;
    int num[4] = {};
    int size = 3;
    while (N) {
        num[size]  = N%10;
        N =N/10;
        size--;
    }
  int lm[2] = {1, -1};
  string s = "+-";
  for(int i = 0; i < 2; ++i)
  for(int j = 0; j < 2; ++j)
  for(int k = 0; k < 2; ++k){
       int ans = 0;
       ans = num[0] + lm[i]*num[1] + lm[j]*num[2] + lm[k]*num[3]; 
       if (ans == 7){
           cout << num[0] << s[i] << num[1] << s[j] << num[2] << s[k] << num[3] << "=7"<< endl; 
           return 0;
       }
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define ll long long int
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)

const int inf = -1000;
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a /gcd(a, b) *b;
}
const int mod = 1e9+7;
int main() {

   int n,m;
   cin>>m>>n;



   unordered_map<int ,int> ump;
   fo(i,n)
{
    int x;
    cin>>x;
    ump[x] = 1;

}

    int dp[m+5];
    fo(i,m+5)
     dp[i] = 0;

    dp[0] = 1;

    if(ump.find(1)==ump.end())
        dp[1] = 1;

    Fo(i,2,m+3){
        if(ump.find(i)==ump.end())
            dp[i] = (dp[i-1]+dp[i-2])%mod;
    }
    cout<<dp[m];






























    return 0;

      }


Measured memory_bytes: 4772
#include <iostream>
using namespace std;
int main(void){
    int x,y,s;
    while(cin>>x>>y>>s,x){
        int ans=0;
        for(int i=1; i<=s-1; i++){
            for(int j=i; j<=s-1; j++){
                if(i*(100+x)/100+j*(100+x)/100==s)
                ans=max(ans,i*(100+y)/100+j*(100+y)/100);
            }
        }
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3104
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


A_max = 0
B_sum = 0
B_max = 0
best_num = 0

flag = True # Aだけ読んで時間が尽きるかどうか

# Aを最大まで読んだ時の冊数と時間
A_max = N
A_sum = 0
for i in range(N):
    A_sum += A[i]
    if A_sum > K:
        A_sum -= A[i]
        A_max = i
        break
A = A[0:A_max]
now_num = A_max # 今の読んだ数
mixsum = A_sum # A,Bを合わせた時間
b_num = 0 # bを読んだ数
if flag:
    now_num += M
    b_num = M
    for i in range(M):
        mixsum += B[i]
        if mixsum > K:
            mixsum -= B[i]
            now_num = A_max + i
            b_num = i  #i冊読んだので次取るならi番目から
            break
A.reverse()
best_num = now_num
for i in range(A_max):
    mixsum -= A[i]
    now_num -= 1
    for j in range(b_num, M):
        mixsum += B[j]
        now_num += 1
        if mixsum > K:
            mixsum -= B[j]
            now_num -= 1
            b_num = j #miss
            break
    if now_num > best_num:
        best_num = now_num
print(best_num)


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

int n;
int l[100];
int t[100];
int dp[1 << 16];

int main()
{
	while (scanf("%d", &n), n){
		memset(l, 0, sizeof(l));
		memset(t, 0, sizeof(t));
		memset(dp, 0, sizeof(dp));
		
		for (int i = 0; i < n; i++){
			int m;
			scanf("%d %d", &m, &l[i]);
			for (int j = 0; j < m; j++){
				int s, e;
				scanf("%d %d", &s, &e);
				s -= 6;
				e -= 6;
				for (int k = s; k < e; k++){
					t[i] |= (1 << k);
				}
			}
		}
		
		for (int i = 0; i < n; i++){
			for (int j = 0; j < (1 << 16); j++){
				if (j & t[i]) continue;
				dp[j | t[i]] = max(dp[j | t[i]], dp[j] + l[i]);
			}
		}
		
		int maxi = 0;
		for (int i = 0; i < (1 << 16); i++){
			maxi = max(maxi, dp[i]);
		}
		
		printf("%d\n", maxi);
	}
}

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

int a , b , c , x ;

int main(){

    ios_base :: sync_with_stdio(false) ;

    cin >> a >> b >> c >> x ;

    int ans = 0 ;

    for( int i = 0 ; i <= a ; ++ i ){
        for( int j = 0 ; j <= b ; ++ j ){
            for( int k = 0 ; k <= c ; ++ k ){
                if( i * 500 + j * 100 + k * 50 == x ) ans ++ ;
            }
        }
    }

    cout << ans << endl ;

    return 0 ;
}


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

int main()
{
    int N;
    int T;
    int startTime, finishTime;
    
    while(cin >> N, N){
        cin >> T;
        for(int i = 0; i < T; i++){
            cin >> startTime >> finishTime;
            N -= finishTime - startTime;
        }
        
        if(N <= 0) std::cout << "OK" << std::endl;
        else cout << N << endl;
        
    }
}


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

int main() {
  int A, B;
  cin >> A >> B;
  if (A == B) {
    cout << "Draw\n";
  }
  else {
    if (A == 1) A = 14;
    if (B == 1) B = 14;
    cout << (A>B?"Alice":"Bob")<<"\n";
  }
  return 0;
}


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

void textIO()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

}

int main()
{

    textIO();
    fastIO();
    long long a;
    long double b;
    cin >> a >> b;
    b=round(b*100);

    a=a*b;

    cout << a/100 << '\n';

    return 0;
}


Measured memory_bytes: 3800
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 1987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

int a[100000];
int main() {
	int n;
	scanf("%d",&n);
	fup(i,0,n-1,1)scanf("%d",a+i);
	a[0]--;
	fup(i,1,n-1,1)
	{
		if(a[i]<a[i-1])return !printf("No");
		if(a[i]>a[i-1])a[i]--;
	}
	puts("Yes");
}

Measured memory_bytes: 640
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
c = int(inputs[2])

y = 7*c / (7*a + b)
if y - int(y) > 0:
    x = int(y) + 1
else:
    x = int(y)


while True:
    if a*x + int(x/7) * b >= c:
        print(x)
        break
    else:
        x+=1


Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int cnt = 0, ans = 0;
    Rep(i, 1, n)
    {
        if (a[i] <= a[i - 1])
            cnt++;
        else
        {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	int X, Y, A, B, C; cin >> X >> Y >> A >> B >> C; 
	long long P[114514], Q[114514], R[114514];
	for(int i = 0; i < A; i++) cin >> P[i]; 
	for(int i = 0; i < B; i++) cin >> Q[i]; 	
	for(int i = 0; i < C; i++) cin >> R[i]; 
	sort(P, P+A, greater<long long>()); 
	sort(Q, Q+B, greater<long long>()); 
	sort(R, R+C, greater<long long>()); 
	priority_queue<long long, vector<long long>, greater<long long>> que; 
	for(int i = 0; i < X; i++) que.push(P[i]); 
	for(int i = 0; i < Y; i++) que.push(Q[i]);
	for(int i = 0; i < C; i++){
		long long p = que.top(); 
		if(R[i] <= p) break; 
		que.pop(); que.push(R[i]); 
	} 
	long long ans = 0; 
	while(que.size()){
		long long p = que.top(); 
		ans += p; que.pop(); 
	}
	cout << ans << endl; 
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> H(N);
    for(int i = 0; i < N; i++)
        cin >> H[i];
    
    vector<vector<int>> hen(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        hen[a].push_back(b);
        hen[b].push_back(a);
    }
    
    int ans = 0;
    for (int i = 0; i < N; i++) {
        bool flag = true;
        for (int j = 0; j < hen[i].size(); j++) {
            if (H[i] <= H[hen[i][j]]) {
                flag = false;
                break;
            }
        }
        if (flag)
            ans++;
    }
    cout << ans;
}

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

int main() {
	int N, M;
	cin >> N >> M;
	int r[110];
	for(int i=0; i<2*M; ++i) cin >> r[i];
	int a[55]={0};
	for(int i=0; i<2*M; ++i) ++a[r[i]];
	for(int i=1; i<=N; ++i) cout << a[i] << endl;
	return 0;
}


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

/*int main(){
      char a[4];
      cin>>a[0]>>a[1]>>a[2]>>a[3];

      int c=0;
            if(a[0]==a[1]||a[0]==a[2]||a[0]==a[3]){
                  c+1;
            }
      
}*/

int main(){
      int n;
      cin>>n;
      int c=0;
      int a[n+2];
      for(int i=1;i<=n;i++){
            cin >>a[i];
      }

      for(int j=2;j<n;j++){
            if(a[j]<a[j+1]&&a[j-1]<a[j]||a[j]<a[j-1]&&a[j+1]<a[j]){
                  c=c+1;
            }
      }
      cout<<c<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;


public class Main { 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int [] [] Arr = new int [12] [10] ;
       int n = sc.nextInt();
       for(int k = 0; k<n; k++){
           int b = sc.nextInt();
           int f = sc.nextInt();
           int r = sc.nextInt();
           int B = (b-1) * 3+ f;
           Arr [B-1] [r-1] += sc.nextInt();
       }
       for(int j = 0; j<12; j++){
           for(int i = 0; i<10; i++){
            System.out.print(" "+Arr[j][i]);
           
           }
           if( j == 2||j == 5|| j == 8){
            System.out.print("\n####################");
            }
             System.out.println();  
        }
    }
}




Measured memory_bytes: 29652
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    REP(i, 10) {
        REP(j, 10) {
            if (i * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

#define COUT(x) cout << x << endl
#define CIN(x) cin >> x
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define EXIST(s, e) (s.find(e) != s.end())
#define SORT(c) sort(c.begin(), c.end())
#define ERASEUNIQE(v) v.erase(unique(v.begin(), v.end()), v.end())

// conversion
inline int toInt(string s)
{
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x)
{
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
template <class T>
inline T sqr(T x) { return x * x; }

// typedef
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

// container util
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()

// constant
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

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

int main(int argc, char const *argv[])
{
  int n;
  double x[10], ans = 0.0;
  string s[10];

  cin >> n;

  for(int i = 0; i < n; i++) {
    cin >> x[i] >> s[i];
  }

  for(int i = 0; i < n; i++) {
    if(s[i] == "JPY") {
      ans += x[i];
    } else {
      ans += x[i] * 380000.0;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define w(t) int t;cin>>t; while(t--)
using namespace std;

int main(){
    string s;
    cin>>s;
    if(s[1] == 'R'){
        s[1] = 'B';
    }
    else {
        s[1] = 'R';
    }
    cout<<s<<endl;
}

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

#define int long long
#define forn(i,a,n) for (int i=a; i<n; i++)

int a[200001];

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

	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	int n,cnt=0;
	cin>>n;
	forn(i,0,n) cin>>a[i];
	forn(i,1,n){
		if (a[i]<a[i-1]){
			cnt+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 5216
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();
		if(a + b == 15) {
			System.out.println("+");
		}else if(a * b == 15) {
			System.out.println("*");
		}else {
			System.out.println("x");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1e8;

int cal(vector<P> A) {
  sort(A.begin(), A.end());
  int res = INF;
  for (int i = 1; i < sz(A); i++) {
    if (A[i-1].second == 0 && A[i].second != 0) {
      res = min(res, A[i].first - A[i-1].first);
    }
  }
  return res;
}

int F(map<int, vector<P>>& mp) {
  int res = INF;
  for (auto p : mp) {
    res = min(res, cal(p.second));
  }
  return res;
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N), Y(N), dir(N);
  // URDL → 0123
  rep(i, N) {
    char c;
    cin >> X[i] >> Y[i] >> c;
    if (c == 'U') dir[i] = 0;
    if (c == 'R') dir[i] = 1;
    if (c == 'D') dir[i] = 2;
    if (c == 'L') dir[i] = 3;
  }
  int ans = INF;
  rep(_, 4) {
    { // UD
      map<int, vector<P>> mp;
      rep(i, N) {
        if (dir[i] != 0 && dir[i] != 2) continue;
        mp[X[i]].emplace_back(Y[i], dir[i]);
      }
      ans = min(ans, F(mp));
    }
    { // UR
      map<int, vector<P>> mp;
      rep(i, N) {
        if (dir[i] != 0 && dir[i] != 1) continue;
        mp[X[i]+Y[i]].emplace_back(Y[i], dir[i]);
      }
      ans = min(ans, F(mp) * 2);
    }
    {
      // rotate clockwise
      rep(i, N) {
        int px = X[i], py = Y[i];
        X[i] = py;
        Y[i] = -px;
        dir[i] = (dir[i]+1)%4;
      }
    }
  }
  if (ans < INF) cout << ans * 5 << '\n';
  else puts("SAFE");
  return 0;
}

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

#define COUT(x) cout << x << endl
#define CIN(x) cin >> x
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define EXIST(s, e) (s.find(e) != s.end())
#define SORT(c) sort(c.begin(), c.end())
#define ERASEUNIQE(v) v.erase(unique(v.begin(), v.end()), v.end())

// conversion
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

// math
template <class T>
inline T sqr(T x) { return x * x; }

// typedef
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

// container util
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()

// constant
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

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

int main(int argc, char const *argv[])
{
    int t, h, m, s;
    CIN(t);
    h = t / 3600;
    m = (t % 3600) / 60;
    s = ((t % 3600) % 60);
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
int main() {
	string s, t;
	cin >> s >> t;
	if (s.size() > t.size())cout << "GREATER" << endl;
	else if (s.size() < t.size())cout << "LESS" << endl;
	else {
		for (int i = 0; i < s.size(); i++) {
			if (s[i]-'0' > t[i]-'0') {
				cout << "GREATER" << endl;
				return 0;
			}
			else if (s[i] -'0'< t[i]-'0') {
				cout << "LESS" << endl;
				return 0;
			}
	
		}

		cout << "EQUAL" << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    char[]ss = S.toCharArray();

    int an = 0;
    for(int i=0; i<S.length(); i++){
        an = ss[i]+N;
        if(an>90){
            an=ss[i]-26+N;
        }
    
	System.out.print((char)an);
    }
}
}
      

Measured memory_bytes: 39768