akhauriyash/Code-Regression huggingface dataset:
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N;
	cin >> N;
	vector<int>data(N);
	for (int i = 0; i < N; i++) {
		cin >> data[i];
	}
	sort(data.begin(), data.end());
	int L = 0;
	for (int i = 0; i < N - 1; i++) {
		L += data[i];
	}
	if (L > data[N - 1]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int  A = sc.nextInt();
     int B = sc.nextInt();
     int C = sc.nextInt();
     int ans;
     if(A-B>=C){
       ans=0;
     }else{
       ans = C-(A-B);
     }
     System.out.println(ans);
   }
}


Measured memory_bytes: 23508
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int a,b,c,d;
 	cin >> a>>b>>c>>d;
 	if(a>=b&&a>=c){
 		for (int i = 0; i < d; i++) {
 			a=a*2;
 		}
 		cout << a+b+c << endl;
 		return 0;
 	}else if(b>=a&&b>=c){
 			for (int i = 0; i < d; i++) {
 			b=b*2;
 		}
 		cout << a+b+c << endl;
 		return 0;
 	}else{
 		for (int i = 0; i < d; i++) {
 			c=c*2;
 		}
 		cout << a+b+c << endl;
 		return 0;
 	}
 }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if (S[0] == 'S') {
		cout << "Cloudy" << endl;
	}
	else if (S[0] == 'C') {
		cout << "Rainy" << endl;
	}
	else {
		cout << "Sunny" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long LL;
const int maxn=300000+50;
int n,L;
int t[maxn];
int x[maxn];
bool le[maxn];
bool ri[maxn];
bool mark[maxn];
int solve()
{
	int an=n;
	for(int i=1;i<=n;++i)
	{
		an+=t[i]/(L<<1);
		t[i]%=(L<<1);
		if(t[i]==0)
		{
			--an;
			mark[i]=1;
		}
		else
		{
			le[i]=(x[i]<<1)>=t[i];
			ri[i]=((L-x[i])<<1)>=t[i];
			if(!le[i]&&!ri[i])
			{
				mark[i]=1;
			}
		}
	}
	int p=1;
	while(p<n&&!(le[p]==1&&ri[p]==0))
	{
		++p;
	} 
	int tot=0,top=0;
	for(int i=1;i<p;++i) if(!mark[i])
	{
		if(!le[i])
		{
			if(top)
			{
				--top,--an;
			}
		}
		else
		{
			++top;
		}
	}
	tot+=top,top=0;
	for(int i=n-1;i>=p;--i) if(!mark[i])
	{
		if(!ri[i])
		{
			if(top)
			{
				--top,--an;
			}
		}
		else
		{
			++top;
		}
	}
	tot+=top;
	an-=tot>>1;
	if(!ri[n]) ++an;
	return an;
}
int main()
{
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&x[i]);
	}
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&t[i]);
	}
	printf("%lld\n",(LL)solve()*(L<<1));
	return 0;
} 

Measured memory_bytes: 3456
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
int have[1000000+1];
int a[1000000+1];
int main(){
	int n;
	R(n);
	rb(i,1,n){
		R(a[i]);
	}
	int all_gcd=a[1];
	rb(i,1,n)
		all_gcd=__gcd(all_gcd,a[i]);
	rb(i,1,n){
		if(have[a[i]]&&a[i]!=1){
			if(all_gcd==1){
				cout<<"setwise coprime\n";
			}
			else{
				cout<<"not coprime\n";
			}
			return 0;
		}
		have[a[i]]++;
	}
	rb(i,2,1000000){
		int cnt=have[i];
		for(int j=i+i;j<=1000000;j+=i)
		{
			cnt+=have[j];
		}
		if(cnt>1){
			if(all_gcd==1){
				cout<<"setwise coprime\n";
			}
			else{
				cout<<"not coprime\n";
			}
			return 0;
		}
	}
		
	cout<<"pairwise coprime\n";
	return 0;
}


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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define FI ios::sync_with_stdio(false); cin.tie(0);

#define LL long long

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e3 + 5;

int dxx[] = {-1, 0, 0, 1};
int dyy[] = {0, -1, 1, 0};

int h,w;
int sx,sy;
int dx,dy;
int inp[MX][MX];

int dist[MX][MX];

bool isValid(int x, int y) {
	if(x >= 0 && x < h && y >= 0 && y < w && inp[x][y] == 0) {
		return true;
	}
	return false;
}

int main() {
	cin >> h >> w;
	cin >> sx >> sy;
	sx--;
	sy--;
	cin >> dx >> dy;
	dx--;
	dy--;

	string s;
	for(int i=0;i<h;i++) {
		cin >> s;
		for(int j=0;j<s.size();j++) {
			inp[i][j] = s[j] == '.'? 0 : 1;
		}
	}

	for(int i=0;i<h;i++) {
		for(int j=0;j<w;j++) {
			dist[i][j] = INF;
		}
	}

	dist[sx][sy] = 0;
	deque<pair<int,int>> d;

	d.push_front({sx,sy});
	while(!d.empty()) {
		pair<int,int> v = d.front();
		d.pop_front();

		int x,y;
		x = v.first;
		y = v.second;

		//adjacent edges
		for(int i=0;i<4;i++) {
			int nx = x + dxx[i];
			int ny = y + dyy[i];

			if(isValid(nx, ny)) {
				if(dist[nx][ny] > dist[x][y] + 0) {
					dist[nx][ny] = dist[x][y] + 0;
					d.push_front({nx, ny});
				}
			}
		}

		//magic edges
		int nx = x - 2;
		int ny = y - 2;
		for(int i=nx;i<nx+5;i++) {
			for(int j=ny;j<ny+5;j++) {
				if(isValid(i, j)) {
					if(dist[i][j] > dist[x][y] + 1) {
						dist[i][j] = dist[x][y] + 1;
						d.push_back({i,j});
					}
				}
			}
		}
	}

	if(dist[dx][dy] == INF) {
		cout << -1 << endl;
	} else {
		cout << dist[dx][dy] << endl;
	}

	return 0;
}


Measured memory_bytes: 11468
#include<iostream>
 using namespace std;
 
int main()
{
    char cup[4];
    int ans[4]={1,0,0,0};
    int i=0;
     
      while(cin >> cup[i])
    {
        i++;
        if(i==3)
        {
            int a;
            a=ans[cup[0]-'A'];
            ans[cup[0]-'A']=ans[cup[2]-'A'];
            ans[cup[2]-'A']=a;
            i=0;
        }
    }
    for(i=0;i<3;i++)
    {
        if(ans[i]==1)
        {
            char a;
            a='A'+i;
            cout << a << endl;
        }
    }
}

Measured memory_bytes: 1136
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b, c; readV(a, b, c);
  writeln(a <= c && c <= b ? "Yes" : "No");
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

vector<ld> p(6),q(6);

ld prob(ld x){
    ld res=0;
    rep(i,6){
        res+=max(p[i]*x,q[i]*(1-x));
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    rep(i,6){
        cin >> p[i];
        p[i]/=100;
    }
    rep(i,6){
        cin >> q[i];
        q[i]/=100;
    }
    ld ans=1;
    ld minr=0,maxr=1;
    while(abs(minr-maxr)>1e-9){
        ld smallr=(2*minr+maxr)/3;
        ld bigr=(2*maxr+minr)/3;
        if(prob(smallr)<prob(bigr)){
            ans=min(ans,prob(smallr));
            maxr=bigr;
        }
        else{
            ans=min(ans,prob(bigr));
            minr=smallr;
        }
        //cout << ans << " " << maxr << " " << minr << endl;
    }
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll> >;

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define F first
#define S second

int main(){
    string s; cin >> s;
    if(s == "RRR"){
        cout << 3 << endl;
    }
    else if (s == "RRS" || s == "SRR"){
        cout << 2 << endl;
    }
    else if (s == "SSS"){
        cout << 0 << endl;
    }
    else cout << 1 << endl;
    
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<double> v;
    for(int i=0;i<n;i++){
        int w;
        cin >> w;
        v.push_back(w);
    }
    sort(v.begin(),v.end());

    if(v.size()<2){
        cout << (v[0]+v[1])/2 << endl;
        return 0;
    }
    double tmp=(v[0]+v[1])/2;
    for(int i=2;i<n;i++){
        tmp=(tmp+v[i])/2;
        //cout << tmp << endl;
    }

    cout << tmp << endl;
}

Measured memory_bytes: 3788
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

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

int main() {
    int N;
    cin >> N;
    int ans = 0;
    rep(i, N + 1) if (i) ans += i;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  vector<int> B(N, 0);
  vector<int> ans(N, 0);
  for (int i=0; i<N; i++) cin >> B[i];
  for (int i=0; i<N; i++) {
    for (int j=N-i-1; j>=0; j--) {
      if(j+1==B[j]) {
        ans[N-1-i] = B[j];
        B.erase(B.begin()+j);
        break;
      }
      else {
        if(j==0) {          
          cout << -1 << "\n"; 
          return 0;
        }
        else continue;
      }
    }
  }
  for (int i=0; i<N; i++) cout << ans[i] << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

int main(){
  string s;
  cin >> s;
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]){
    cout << "Bad" << endl;
  }
  else cout << "Good" << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
hmax = H[0]
flag = 0
for i in range(1,N):
    if H[i]>=hmax:
        hmax = H[i]
    else:
        if hmax-H[i]>=2:
            flag = 1
            break
if flag==1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 85088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  for(ll i=0;i<n;i++){
    cin >> x[i];
  }
  ll ans=0;
  for(ll i=0;i<n-1;i++){
    if(a*(x[i+1]-x[i])>b){
      ans+=b;
    }
    else{
      ans+=a*(x[i+1]-x[i]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

#define MAX_LSIZE 100  // 一行の最大の長さ 
char buff[MAX_LSIZE+2];  // 一行の文字列を格納する配列     
// 行末の改行文字、NULL 文字も格納される 
char stack[MAX_LSIZE];  // スタック 
int sp;    // スタックポインタ 
 
int main() {   
    char c;  // 処理する文字を入れる変数   
    int match; // 括弧のバランス状況を表す   // 1 -> バランス,  0 -> 非バランス, -1 -> まだ不明   
    int i;   
    while(1){     
        fgets(buff, MAX_LSIZE+2, stdin); // 標準入力より配列 buff に１行読み込む     
        if(buff[0] == '.') break; // 先頭の文字が '.' なら終了     
        match = -1;  // バランス状況はまだ不明     
        sp = 0;   // stack pointer sp を初期化     
        for(i=0; ; i++){ // 文字列の先頭から順に１文字ずつ以下の処理を行う       
            c = buff[i];  // c = 処理対象の文字       
            switch(c){       
                case '(':       
                case '[':  
                        stack[sp++] = c; 
                        break;  // stack に 左括弧 を入れる       
                case ')': // stack が空か、 // stack から取り出した文字が '(' でなければバランスしていない  
                    if(sp==0) match=0;  
                    else if(stack[--sp] != '(') match = 0;  
                    break;       
                case ']': // stack が空か、 // stack から取り出した文字が '[' でなければバランスしていない  
                    if(sp==0) match=0;  
                    else if(stack[--sp] != '[') match = 0;  
                    break;       
                case '.': // stack が空ならバランス、そうでなければ非バランス  
                    if(sp==0) match=1;  
                    else match=0;       
            }       
            if(match != -1) break; // 結果が判明したので終了    
        } 
        if(match) printf("yes\n"); // 結果を出力     
        else printf("no\n");   
    } 
}


Measured memory_bytes: 2536
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define OO 2e18
#define oo 1e9
#define yalla ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define sz  100005
#define re return
#define mod  1000000007
#define pi acos(-1)
using namespace std;
int dp[3005][3005];
string s,t;
///
int solve(int i,int j)
{
 if(i>=s.size() || j>=t.size())
    re 0;
 if(dp[i][j]!=-1)
    re dp[i][j];
 int maxx=0;

 if(s[i]==t[j])
  maxx=solve(i+1,j+1)+1;

 maxx=max( maxx,max(solve(i,j+1),solve(i+1,j)) );

re dp[i][j]=maxx;
}
///
void  solve2(int i,int j)
{
 if(i>=s.size() || j>=t.size())
    re ;

int fi=-1,se=-1,th=-1;
 if(s[i]==t[j])
  fi=solve(i+1,j+1)+1;

 se=solve(i,j+1);
 th=solve(i+1,j);

 if(fi==dp[i][j])
 {
   cout<<s[i];
   solve2(i+1,j+1);
 }
 else if(se==dp[i][j])
   solve2(i,j+1);
 else if(th==dp[i][j])
   solve2(i+1,j);
}
///
int main()
{yalla;
 cin>>s>>t;
 memset(dp,-1,sizeof dp);
  solve(0,0);
 solve2(0,0);

 re 0;
}

Measured memory_bytes: 35968
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 20:55:32 2020

@author: Kanaru Sato
"""

n,k = list(map(int, input().split()))
dic = {}
for i in range(k):
    d = int(input())
    l = list(map(int, input().split()))
    for j in range(d):
        if l[j] not in dic:
            dic[l[j]] = 1
        
count = 0
for i in range(1,n+1):
    if i not in dic:
        count += 1
print(count)

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

using namespace std;

int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if(A==5&&B==7&&C==5)
    cout<<"YES"<<endl;
    else if(A==5&&B==5&&C==7)
    cout<<"YES"<<endl;
    else if(A==7&&B==5&&C==5)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
}


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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
#define PI 3.1415926536
typedef long long ll;
typedef pair<int, int> P;



int main() {
	string s;
	cin >> s;
	rep(i, s.length()) {
		if (s[i] != ',')cout << s[i];
		else cout << ' ';
	}
	cout << endl;

	return 0;
}

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

string s;
 
long long bt(int x, long long sum) {
	if (x == s.size())
		return sum;
	long long ret = 0;
	for (int i = x + 1; i <= s.size(); i++)
		ret += bt(i, stoll(s.substr(x, i - x)) + sum);
	return ret;
}
 
 
int main() {
	cin >> s;
	cout << bt(0, 0) << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)

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

#define int long long

using namespace std;

signed main()
{
    int x,y,z=0,w,i,j=1;
    cin>>x>>y;
    std::vector<int> v(x);
    rep(i,x){
          cin >> v[i];
    }
    Rep(i,x){

      if(v[i]+z<=y){
        z+=v[i];
        j++;
      }else{
        break;
      }
    }


    cout<<j<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a>b){
		cout << "a > b" << endl;
	}
	if (a<b){
		cout << "a < b" << endl;
	}
	if (a==b){
		cout << "a == b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;



public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	   	int n = sc.nextInt();
	   	String[] s = new String[n];
	   	int sum = 1;
	   	for(int i = 0; i < n; i++){
	   		s[i] = sc.next();
	   	}
	   	Arrays.sort(s);
	   	for(int i = 1; i < n; i++) {
	   		if(!s[i].equals(s[i-1])) {
	   			sum++;
	   		} 
	   	}
	   	System.out.println(sum);
	}
}

Measured memory_bytes: 70040
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define PI acos(-1)
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define sp fixed<<setprecision
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int MOD = (1e9)+7;
const int N = (1e6)+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>n;
        string s;
        cin>>s;
        int cnt[3][n];
        memset(cnt,0,sizeof(cnt));
        map<char,int> mp;
        mp['R'] = 0;
        mp['G'] = 1;
        mp['B'] = 2;
        for(int i=n-1;i>=0;i--)cnt[mp[s[i]]][i]++;
        for(int i=0;i<3;i++)
        {
            for(int j=n-2;j>=0;j--)cnt[i][j]+=cnt[i][j+1];
        }
        int ans = 0;
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                if(s[i]==s[j])continue;
                int k = j+(j-i);
                int col = -1;
                int chk = mp[s[i]]^mp[s[j]];
                if(chk == 1)col = 2;
                else if(chk == 2)col = 1;
                else col = 0;
                if(j+1<n)ans+=cnt[col][j+1];
                if(k<n && mp[s[k]] == col)ans--;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}
/*
Test Case
*/


Measured memory_bytes: 3716
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>

using namespace std;
using LL = long long;

constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;

int main() {
	int n, m;
	while (cin >> n >> m&&n&&m) {
		vector<int> v;
		int a;
		for (int i = 0; i < n; i++) {
			cin >> a;
			v.emplace_back(a);
		}
		sort(v.begin(), v.end(), greater<int>());
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if ((i + 1) % m != 0)ans += v[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3104
/*
*	User: Isanchez_Aguilar
*	Problem: AtCoder ABC134B - Golden Apple
*/
#include <bits/stdc++.h>

using namespace std;
using Long = long long;

int main(void)
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int k, n;
	int heights[100001];

	k = 2;
	cin >> n;
	
	for (int i = 0; i < n; ++i)
		cin >> heights[i];

	int dp[100001];

	dp[0] = 0;
	for (int i = 1; i < n; ++i)
	{
		dp[i] = INT_MAX;

		for (int j = 1; i - j >= 0 and j <= k; ++j)
			dp[i] = min(dp[i], dp[i - j] + abs(heights[i] - heights[i - j]));
	}

	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
a.sort() #並べかえ
cnt = 0 
ans = a[-1]*-1 
c = 1
while cnt!=n:
    cnt+=1
    if c==1:
        k=a.pop()
    ans += k
    c *= -1

print(ans)


Measured memory_bytes: 31572
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


L,R = MI()
if L//2019 != R//2019:
    print(0)
else:
    A = [i for i in range(L % 2019,(R % 2019)+ 1)]
    N = len(A)
    ans = 2019
    for i in range(N-1):
        for j in range(i+1,N):
            ans = min(ans,(A[i]*A[j]) % 2019)
    print(ans)


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define sz(c) int((c).size())
#define all(c) (c).begin(), (c).end()
#define pb push_back

#define INF int(1e9)
#define EPS 1e-9
#define MOD int(1e9 + 7)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	int mini[n];
	mini[n - 1] = arr[n - 1];
	for(int i = n - 2; i >= 0; i--) {
		mini[i] = min(mini[i + 1], arr[i]);
	}
	bool can = true;
	for(int i = 0; i < n; i++) {
		if(arr[i] > mini[i] + 1) {
			can = false;
		}
	}
	cout << (can ? "Yes" : "No") << '\n';
	return 0;
}


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

const int MAX_N = 100000;

int main()
{
    ll N, Q;
    vector<ll> A(MAX_N, 0);
    cin >> N;
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        ans += a;
        a--;
        A[a]++;
    }

    cin >> Q;
    for (int i = 0; i < Q; i++)
    {
        int b, c;
        cin >> b >> c;
        b--;
        c--;
        ll cnt = A[b];
        A[b] = 0;
        A[c] += cnt;
        ans = ans - ((b + 1) * cnt) + ((c + 1) * cnt);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3852
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

h, w, k = na()
s = nsn(h)

ans = [[0] * w for _ in range(h)]
cur = 0
to = []
for i in range(h):
    j = 0
    cnt = 0
    while j < w:
        if s[i][j] == '#':
            cur += 1
            for l in to:
                ans[l][j] = cur
            ans[i][j] = cur
            k = j - 1
            j += 1
            while k >= 0 and ans[i][k] == 0:
                for l in to:
                    ans[l][k] = cur
                ans[i][k] = cur
                k -= 1
            while j < w and s[i][j] != '#':
                for l in to:
                    ans[l][j] = cur
                ans[i][j] = cur
                j += 1
        else:
            cnt += 1
            j += 1
    if cnt == w:
        if i == 0:
            to.append(i)
        elif len(to) != 0:
            to.append(i)
        else:
            for k in range(w):
                ans[i][k] = ans[i - 1][k]
    else:
        to = []

for i in range(h):
    print(*ans[i])

Measured memory_bytes: 7636
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

    cost = A[N-1] - A[0]
    ans = cost
    for i in range(1, N):
        if i+N-1 >= N:
            break
        cost = A[i+N-1] - A[i]
        ans = min(ans, cost)
    
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <functional>
using namespace std;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
vb d(10);
int ans(int x)
{
    while (x)
    {
        if (d[x % 10])
            return 0;
        x /= 10;
    }
    return 1;
}
//ここからメイン
int main()
{
    int a,b,c,n,d;
    string A,B,C,D,N;
    cin >> B;
    for(size_t i=0; i < B.size(); i++){
     if(B[i] == 'B') {
			if(A.size()){
              A.pob();
                      }
		}else {
			A += B[i];
		}
	}
  cout << A;
}
  


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

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int dx[]={-1,0,1,0};
    int dy[]={0,-1,0,1};
    int n,m,si,sj,di,dj;
    const int INF=1e9;
    cin>>n>>m;
    cin>>si>>sj;
    cin>>di>>dj;
    --si,--sj,--di,--dj;
    vector<string> grid(n);
    vector<vector<int> >moves(n,vector<int>(m,INF));
    for(int i=0;i<n;i++)
        cin>>grid[i];
    deque<pair<int,int> >q;
    q.push_back({si,sj});
    moves[si][sj]=0;
    while(!q.empty())
    {
        int f=q.front().first;
        int s=q.front().second;
        int d=moves[f][s];
        q.pop_front();
        for(int i=0;i<4;i++)
        {
            int ni=dx[i]+f;
            int nj=dy[i]+s;
            if(ni<0 || ni>=n || nj<0 || nj>=m)  continue;
            if(grid[ni][nj]=='#') continue;
            if(moves[ni][nj]<=d) continue; 
            moves[ni][nj]=d;
            q.push_front({ni,nj});
        }
        for(int ai=-2;ai<=2;ai++)
        {
            for(int aj=-2;aj<=2;aj++)
            {
                int bi=f+ai;
                int bj=s+aj;
                if(bi<0 || bi>=n || bj<0 || bj>=m) continue;
                if(grid[bi][bj]=='#') continue;
                if(moves[bi][bj]<=d) continue;
                moves[bi][bj]=d+1;
                q.push_back({bi,bj});
            }
        }
    }
    int ans=moves[di][dj];
    if(ans==INF) ans=-1;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 9128
#include <iostream>

using namespace std;

int main(){
  int A[4][4];
  bool ok[4][4];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> A[i][j];
      ok[i][j] = false;
    }
  }
  int N;
  cin >> N;
  
  int b[11];
  for(int i=0;i<N;i++){
    cin >> b[i];
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(b[i] == A[j][k])ok[j][k] = true;
      }
    }
  }
  bool tmp = false;
  for(int i=0;i<3;i++){
    int count = 0;
    for(int j=0;j<3;j++){
      if(ok[i][j])count++;
      if(count==3){
        tmp = true;
        break;
      }
    }
  }
  for(int i=0;i<3;i++){
    int count = 0;
    for(int j=0;j<3;j++){
      if(ok[j][i])count++;
      if(count==3){
        tmp = true;
        break;
      }
    }
  }
  int count = 0;
  for(int i=0;i<3;i++){
    if(ok[i][i])count++;
    if(count==3){
      tmp = true;
      break;
    }
  }
  count = 0;
  for(int i=0;i<3;i++){
    if(ok[i][2-i]){
      count++;
    }
    if(count==3){
      tmp = true;
      break;
    }
  }

  if(tmp)cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}

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

int N, cnt[42], c[42];
lint K;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    cin >> N >> K; K++;
    for(int i=0;i<N;i++){
        int cur = 0;
        lint a; cin >> a;
        while(a) {cnt[cur++] += (a & 1);a >>= 1;}
    }

    int idx = 0;
    while(K) {c[idx++] |= (K & 1); K >>= 1;}

    lint ans = 0;
    for(int i=0;i<=40;i++){
        if(c[i]){
            lint cur = 0;
            for(int j=0;j<i;j++) cur += (1LL<<j) * max(N-cnt[j], cnt[j]);
            for(int j=i+1;j<=40;j++) c[j] ? cur += (1LL<<j) * (N-cnt[j]) : cur += (1LL<<j) * cnt[j];
            cur += (1LL<<i) * cnt[i];
            ans = max(ans, cur);
        }
    }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] L = new int[N];
		for (int i = 0; i < N; i++)
			L[i] = sc.nextInt();
		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if (L[i] == L[j]) continue;
				for (int k = j + 1; k < N; k++) {
					if (L[i] == L[k] || L[j] == L[k]) continue;
					if (L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i])
						ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> map(55, vector<char>(55));
  for (int i = 1; i <= H; i++)
  {
    for (int j = 1; j <= W; j++)
    cin >> map[i][j];
  }
  int cnt =0;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      // 上下左右 #判定
      if (map[i][j] == '#' && map[i-1][j] != '#' && map[i][j-1] != '#' && map[i][j+1] != '#' && map[i+1][j] != '#') cnt++;
    }
  }
  if (cnt == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD =1e9+7;
using ll=long long;

int main() {
    int n;
    cin >> n;
    n %= 10;
    if(n == 3) cout << "bon" << endl;
    else if(n == 0||n== 1||n==6||n==8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,ans = 0;
  
  cin >> n;
  
  vector<int> l(n);
  for(int i = 0;i < n;i++)
    cin >> l.at(i);
  
  if(n > 2){
   for(int i = 0;i < n-2;i++){
     a = l.at(i);
     for(int j = i+1;j < n-1;j++){
       b = l.at(j);
       if(a == b)
         continue;
       for(int k = j+1;k < n;k++){
        c = l.at(k);
        if(b == c || a == c)
          continue;
        if(a+b > c && b+c > a && a+c > b){
          ans++;
        }
       }
     }
   }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for (int i=(a); i>=(b); --i)
#define REP(i,b) for (int i=0; i<(b); ++i)
#define endl '\n'
#define sz(x) (int) x.size()
#define mod %
#define fillchar(x,y,z) memset(x,z,y)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define sqr(x) ((x)*(x))
typedef long long int64;
typedef unsigned long long qword;
using namespace std;
const int maxn=55;
const int base=1e9+7;
struct TMatrix{
    int64 val[maxn][maxn];
    int n;
    TMatrix operator * (const TMatrix &A) {
        TMatrix res;
        res.n=n;
        FOR(i,1,n)
            FOR(j,1,n) {
                res.val[i][j]=0;
                FOR(k,1,n)
                    res.val[i][j]=(res.val[i][j]+val[i][k]*A.val[k][j]) mod base;
            }
        return res;
    }
}A;
int n;
int64 k;
void Input()
{
    cin >> n >> k;
    A.n=n;
    FOR(i,1,n)
        FOR(j,1,n) cin >> A.val[i][j];
}
void Solve()
{
    TMatrix res;
    fillchar(res.val,sizeof(res.val),0);
    res.n=n;
    FOR(i,1,n) res.val[i][i]=1;
    while (k) {
        if (k&1) res=res*A;
        A=A*A;
        k>>=1;
    }
    int64 ans=0;
    FOR(i,1,n) FOR(j,1,n) ans+=res.val[i][j];
    cout << ans mod base;
}
int main()
{
    #ifdef meomeomeooooo
        freopen("input.txt","r",stdin);
        //freopen(".out","w",stdout);
    #endif // meomeomeooooo
    iostream::sync_with_stdio(false);
    cin.tie(0);
    Input();
    Solve();
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long C = sc.nextLong();
		long[] x = new long[N];
		long[] v = new long[N];
		for(int i = 0; i < N; i++) {
			x[i] = sc.nextLong();
			v[i] = sc.nextInt();
		}
		long[][] a = new long[N+1][2];
		long[] amax = new long[N+1];
		long[][] b = new long[N+1][2];
		long[] bmax = new long[N+1];
		long ans = 0;
		for(int i = 0; i < N; i++) {
			a[i+1][1] = x[i];
			b[i+1][1] = C - x[N-1-i];
			a[i+1][0] = a[i][0] + v[i] - a[i+1][1] + a[i][1];
			b[i+1][0] = b[i][0] + v[N-1-i] - b[i+1][1] + b[i][1];
			amax[i+1] = Math.max(a[i+1][0], amax[i]);
			bmax[i+1] = Math.max(b[i+1][0], bmax[i]);
			ans = Math.max(ans, Math.max(a[i+1][0], b[i+1][0]));
		}
		for(int i = 0; i <= N; i++){
			ans = Math.max(ans, b[i][0] - b[i][1] + amax[N-i]);
			ans = Math.max(ans, a[i][0] - a[i][1] + bmax[N-i]);
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 93564
#include<stdio.h>
#include<limits.h>
int main(){
	int i,n,max=-INT_MAX,min,r[200000];
	scanf("%d",&n);
	if(n<2 || n>200000) return 1;
	for(i=0;i<n;i++){
		scanf("%d",&r[i]);
		}
	min=r[0];
	for(i=1;i<n;i++){
		if(max<r[i]-min) max=r[i]-min;
		if(min>r[i]) min=r[i];
		}
	printf("%d\n",max);	
	return 0;
	}

Measured memory_bytes: 1380
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 110000
using namespace std;
int n,c,k,t[N],l;
int main(){
//	freopen("a.in","r",stdin);
	scanf("%d%d%d",&n,&c,&k);
	for(int i=1;i<=n;++i) scanf("%d",&t[i]);
	sort(t+1,t+n+1);
	int ans=0;
	l=1;
	t[n+1]=0x7FFFFFFF;
	for(int i=2;i<=n+1;++i){
		int sum=0;
		while(l<i and t[l]+k<t[i]) l+=min(i-l,c),sum++;
		ans+=sum;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    std::cin >> n;
    std::vector<double> a(n),b(n);
    rep(i,n)std::cin >> a[i];
    rep(i,n)std::cin >> b[i];
    double q=0.0,w=0.0,e=0.0,r=0.0;
    rep(i,n){
        q+=abs(a[i]-b[i]);
        w+=pow((a[i]-b[i]),2);
        e+=pow(abs(a[i]-b[i]),3);
        r=max(abs(a[i]-b[i]),r);
    }
    w=sqrt(w);
    e=pow(e,1.0/3.0);
    std::cout << keta(10)<<q << std::endl;
    std::cout << keta(10)<<w << std::endl;
    std::cout << keta(10)<<e << std::endl;
    std::cout << keta(10)<<r << std::endl;
}


Measured memory_bytes: 3432
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,4);
  var A = input[0];
  var B = input[1];
  var C = input[2];
  var D = input[3];
  var alice = new Array(101).fill(0);
  var bob = new Array(101).fill(0);
  
  var output = 0;
  for(var i = A; i <= B; i++){
    alice[i] = 1;
  }
  for(var i = C; i <= D; i++){
    bob[i] = 1;
  }
  for(var i = 0; i <= 100; i++){
    if(alice[i] == 1 && bob[i] == 1){
       output++;
    }
  }
  if(output > 0){
     output--;
     }
  myout(output);
}

Main(myin());


Measured memory_bytes: 13128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main()
{
	string str;
	cin>>str;
	int p=str.size();
	while(true)
	{
		int flag=0;if(p==0) break;	
		if(p-5>=0&&str.substr(p-5,5)=="dream")
		{
			 
			p-=5;
			flag=1;continue;
		}
		else if(p-7>=0&&str.substr(p-7,7)=="dreamer")
		{
			p-=7;
			flag=1;
			continue;
		}
		else if(p-5>=0&&str.substr(p-5,5)=="erase")
		{
			p-=5;
			flag=1;
			continue;
		}
		else if(p-6>=0&&str.substr(p-6,6)=="eraser")
		{
			p-=6;
			flag=1;
			continue;
		}
	
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	
	}cout<<"YES"<<endl;
	return 0;
}
 

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  string s;
  int k=0;
  cin >> s;
  for(int i=0;i<4;i++){
    if(s[i]=='+'){
      k++;
    }
    else
      k--;
  }
  cout << k << endl;
      
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD7 1000000007
#define MOD9 1e9 + 9
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
typedef long long ll;
typedef long double ld;
typedef string str;
typedef double d;
typedef unsigned u;
typedef unsigned long long ull;

const long long BIGINF = 2e18 + 7;
const int INF = 2e9 + 7;


int main () {
	/*#ifndef ONLINE_JUDGE
		freopen("inputf.txt", "r", stdin);
		freopen("outputf.txt", "w", stdout);
	#endif*/
	int n;
	int m;
	cin >> n >> m;
	int ac = 0, wa = 0;
	bool visit[100005];
	int was[100005];
	memset(was, 0, sizeof(was));
	memset(visit, false, sizeof(visit));
	for (int i = 0; i < m; i++) {
		int x;
		string s;
		cin >> x >> s;
		if (s == "AC") {
			if (!visit[x]) {
				ac++;
				visit[x] = true;
				wa += was[x];
			}
		}
		else if (s == "WA"){
			was[x]++;
		}
	}
	cout << ac << " " << wa;
    return 0;
}



Measured memory_bytes: 768
#include <stdio.h>
#define SIZE 5

/* prototype declaration */
void playPoker();
int isStraight(int *card);
int sameNum(int *card);
void sort(int *card);
void swap(int *x, int *y);

int main(int argc, const char *argv[])
{
	playPoker();	
	return 0;
}

void playPoker()
{
	int card[SIZE];
	while(scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4])!=EOF){
		sort(card);
		if(isStraight(card)){ 
			printf("straight\n");
		}else if(sameNum(card)){
			switch(sameNum(card)){
				case 6:
					printf("four card\n");
					break;
				case 4:
					printf("full house\n");
					break;
				case 3:
					printf("three card\n");
					break;
				case 2:
					printf("two pair\n");
					break;
				case 1:
					printf("one pair\n");
					break;
			}
		}else{
			printf("null\n");
		}
	}
}

int isStraight(int *card)
{
	int i;

	/* one case */
	if(card[0]==1 && card[1]==10 && card[2]==11 && card[3]==12 && card[4]==13) return 1;	
	
	/* other cases */
	for(i=SIZE-1; i>0; i--){
		if(card[i]-card[i-1]!=1) return 0; /* if differential bw card[i] and card[i-1] is 1 or not. */
	}
	return 1;
}

int sameNum(int *card)
{
	int i, j, cnt=0;
	
	for(i=0; i<SIZE; i++)
		for(j=SIZE-1; j>i; j--)
			if(card[i]==card[j]) cnt++;
	
	return cnt;
}

void sort(int *card)
{
	int i, j, min;
	for(i=0; i<SIZE; i++){
		min = i;
		for(j=i+1; j<SIZE; j++){
			if(card[j]<card[min])
			 	min = j;
		}

		swap(&card[i], &card[min]);
	}
}

void swap(int *x, int *y)
{
	int tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
}

Measured memory_bytes: 0
import numpy as np
n=int(input())
l=list(map(int,input().split()))

arr=np.sort(np.array(l))
med=np.median(arr)

med_max=int(np.median(np.delete(arr,0)))
med_min=int(np.median(np.delete(arr,n-1)))

if n%2==1:
    p=(n-1)//2
    med_midmin=int(np.median(np.delete(arr,p+1)))
    med_mid=int(np.median(np.delete(arr,p)))
    med_midmax=int(np.median(np.delete(arr,p-1)))

    for i in range(n):
        if l[i]<arr[p-1]:
            print(med_max)
        elif l[i]==arr[p-1]:
            print(med_midmax)
        elif l[i]==arr[p]:
            print(med_mid)
        elif l[i]==arr[p+1]:
            print(med_midmin)
        else:
            print(med_min)

if n%2==0:
    p=(n+1)//2
    med_midmin=int(np.median(np.delete(arr,p)))
    med_midmax=int(np.median(np.delete(arr,p-1)))
    for i in range(n):
        if l[i]<arr[p-1]:
            print(med_max)
        elif l[i]==arr[p-1]:
            print(med_midmax)
        elif l[i]==arr[p]:
            print(med_midmin)
        else:
            print(med_min)

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

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string S, T;
    cin >> S >> T;
    T.erase(--T.end());
    cout << (S == T ? "Yes" : "No");
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
 
int main(){
int gozen,gogo,total,shop;
        while(gozen!=0||gogo!=0){
        	total=0;
        	cin>>gozen>>gogo;
        	if(gozen+gogo==0)break;
        	if(total<gozen+gogo){
        		total=gozen+gogo;
        		shop=0;
        	}
        for(int i=1;i<5;i++){
                cin>>gozen>>gogo;
        	if(total<gozen+gogo){
        		total=gozen+gogo;
        		shop=i;
        	}
        }
        	if(shop==0)cout<<"A "<<total<<endl;
        	else if(shop==1)cout<<"B "<<total<<endl;
        	else if(shop==2)cout<<"C "<<total<<endl;
        	else if(shop==3)cout<<"D "<<total<<endl;
        	else cout<<"E "<<total<<endl;
        }
}

Measured memory_bytes: 1164
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
  int i;
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int d[100];
  for(i=0;i<n;++i)
    cin>>d[i];
  sort(d,d+n,greater<int>());
  for(i=0;i<n;++i){
    if(c*(a+b)>(c+d[i])*a)
      break;
    c+=d[i];
    a+=b;
  }
  cout<<(int)((double)c/a)<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;


int main(){
    int X, Y; cin >> X >> Y;

    bool isOK = false;
    for (int x = 0; x <= 100; x++){
        for (int y = 0; y <= 100; y++){
            if (x + y == X && 2*x + 4*y == Y){
                isOK = true;
                break;
            }
        }
    }

    if (isOK){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3588