akhauriyash/Code-Regression huggingface dataset:
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 long long INF = 100100100100;
const long long MOD = 998244353;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    int H,W;cin >> H >> W;
    vector<vector<char>> ban(H,vector<char>(W));
    vector<vector<bool>> choose(H,vector<bool>(W));
    for(int i = 0;i<H;i++){
        for(int j = 0;j<W;j++){
            cin >> ban.at(i).at(j);
            choose.at(i).at(j) = false;
        }
    }
    //縦に見る
    bool ok = true;
    for(int i = 0;i<W;i++){
        ok = true;
        for(int j = 0;j<H;j++){
            if(ban.at(j).at(i) != '.') ok = false;
        }
        if(ok){
            for(int k = 0;k<H;k++){
                choose.at(k).at(i) = true;
            }
        }
        ok = true;
    }
    //横に見る
    for(int i = 0;i<H;i++){
        ok = true;
        for(int j = 0;j<W;j++){
            if(ban.at(i).at(j) != '.') ok = false;
        }
        if(ok){
            for(int k = 0;k<W;k++){
                choose.at(i).at(k) = true;
            }
        }
        ok = true;
    }
    bool OUTPUTok = false;
    for(int i = 0;i<H;i++){
        for(int j = 0;j<W;j++){
            if(choose.at(i).at(j)) continue;
            cout << ban.at(i).at(j);
            OUTPUTok = true;
        }
        if(OUTPUTok) cout << endl;
        OUTPUTok = false;
    }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

c = A[0]
ans1 = 0
for a in A[1:]:
    if c > 0 and c + a >= 0:
        ans1 += c + a + 1
        c = -1

    elif c < 0 and c + a <= 0:
        ans1 += -(c + a) + 1
        c = 1

    else:
        c = c + a


c = 1
ans2 = abs(A[0] - 1)
for a in A[1:]:
    if c > 0 and c + a >= 0:
        ans2 += c + a + 1
        c = -1

    elif c < 0 and c + a <= 0:
        ans2 += -(c + a) + 1
        c = 1

    else:
        c = c + a


c = -1
ans3 = abs(A[0] + 1)
for a in A[1:]:
    if c > 0 and c + a >= 0:
        ans3 += c + a + 1
        c = -1

    elif c < 0 and c + a <= 0:
        ans3 += -(c + a) + 1
        c = 1

    else:
        c = c + a

print(min(ans1, ans2, ans3))


Measured memory_bytes: 20044
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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 namespace std;

int a, p;

int main() {
    cin >> a >> p;
    cout << (3*a+p)/2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main(void)
{
	long long i,j,k;
	long long L,R;
	long long result;
	long long min = 2018;

	cin >> L >> R;

	for (i = 1; i <= R - L; i++)
	{
		for (j = L; j <= R - 1; j++)
		{
			for (k = L + i; k <= R ; k++)
			{
				result = (j * k) % 2019;
				if (min > result)
					min = result;

				if (min == 0)
					break;

				if ((L + i) * R < j * k + 2019 - result)
					break;
			}
			if (min == 0)
				break;
		}
		if (min == 0)
			break;
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;

const long long MOD = 1e9 + 7;

ll n;
ll a[500001];
ll p[500001];
ll s[500001];

ll inq(ll x, ll q)
{
    if (q == 0)
        return 1;
    ll l = inq(x, q / 2);
    if (q % 2)
    {
        return l * l % MOD * x % MOD;
    }
    else
    {
        return l * l % MOD;
    }
}

ll dp[500001];
vector<int> pos[1500001];
ll cnt_of_0[500001];

ll run(int x)
{
    if (pos[x].size() == 0)
        return 0;
    //cout << x << endl;
    //pos[x].push_back(n);
    vector<int> dp(pos[x].size());
    ll summ0 = 0, summx = 1;
    ll worked_zeroes = 0;

    for (int i = 0; i < pos[x].size(); i++)
    {
        dp[i] = summx;
        summ0 += summx;
        summ0 %= MOD;

        if (i + 1 < pos[x].size())
        {
            worked_zeroes = cnt_of_0[pos[x][i]];
            ll new_zeroes = cnt_of_0[pos[x][i + 1]] - worked_zeroes;
            summx = (summx + summ0 * new_zeroes) % MOD;
        }
        if (i + 1 == pos[x].size())
        {
            worked_zeroes = cnt_of_0[pos[x][i]];
            ll new_zeroes = cnt_of_0[n - 1] - worked_zeroes;
            summx = (summx + summ0 * new_zeroes) % MOD;
        }
    }
    if (pos[0][pos[0].size() - 1] < pos[x][pos[x].size() - 1])
        return summx;
    else
        return summ0;
}

int main()
{
    cin >> n;
    int x = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        x = (x ^ a[i]);
        p[i] = x;
        pos[p[i]].push_back(i);
        if (i > 0)
            cnt_of_0[i] = cnt_of_0[i - 1];
        if (p[i] == 0)
            cnt_of_0[i]++;
    }
    //cnt_of_0[n] = cnt_of_0[n - 1];
    //cout << x << endl;
    ll y = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        y = (y ^ a[i]);
        s[i] = y;
    }
    ll ans = 0;
    ll r = 0;
    /*for (int i = 0; i < n; i++)
    {
        cout << p[i] << " ";
    }
    cout << endl;/*
    for (int i = 0; i < n; i++)
    {
        cout << s[i] << " ";
    }
    cout << endl;*/
    if (x != 0)
    {
        ll summ0 = 0, summx = 1;
        for (int i = 0; i < n; i++)
        {
            if (p[i] == 0)
            {
                dp[i] = summ0;
                summx += dp[i];
                summx %= MOD;
            }
            if (p[i] == x)
            {
                dp[i] = summx;
                summ0 += dp[i];
                summ0 %= MOD;
            }
        }
        cout << dp[n - 1];
    }
    else
    {
        ll ans = 0;
        for (int x = 1; x < (1 << 20); x++)
        {
            ans = (ans + run(x)) % MOD;
        }
        ll r = 0;
        for (int i = 0; i + 1 < n; i++)
        {
            if (p[i] == 0)
                r++;
        }
        ans += inq(2, r);
        ans %= MOD;
        cout << ans;
    }
}


Measured memory_bytes: 64500
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long // remove when constraints are tight.
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int n,a,b;
	cin>>n>>a>>b;
	if((b-a)%2==0)
	{
		cout<<(b-a)/2<<endl;
	}
	else
	{
		// cout<<min(max(a-1,b-1),max(n-a,n-b))<<endl;
		int c1=(a-1)+1+(b-a-1)/2;
		int c2=(n-b)+1+(b-a-1)/2;
		cout<<min(c1,c2)<<endl;
	}
	
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

s = input()
ans = 0
if s == "SUN":
    ans = 7
elif s == "MON":
    ans = 6
elif s == "TUE":
    ans = 5
elif s == "WED":
    ans = 4
elif s == "THU":
    ans = 3
elif s == "FRI":
    ans = 2
elif s == "SAT":
    ans = 1
print (ans)


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const ll MAX = 10000;
static const ll INFTY = 1e12;
static const ll MOD = 1e9+7;

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; }



int main() {

  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());

  if(s < t)cout << "Yes" << endl;
  else cout << "No" << endl;


 


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3612
N = int(input())
A = list(map(int, input().split()))

D = [0] * (10 ** 6 + 1)
A.sort()
A = A + [10 ** 7]
cnt = 0
for i in range(N):
  if D[A[i]] == 0:
    if A[i] != A[i + 1]:
      cnt += 1
    for j in range(A[i], 10 ** 6 + 1, A[i]):
      D[j] = 1
print(cnt)



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

using namespace std;

const long long MOD = 998244353;

bool check(int n)
{
    string s = to_string(n);
    for(int i = 1; i < s.size(); i++)
    {
        if(abs(s[i] - s[i - 1]) > 1)
            return false;
    }
    return true;
}

int main()
{
    int k;
    cin >> k;
    //k++;
    int len = 13;
    long long dp[len + 1][10];
    for(int i = 0; i < len + 1; i++)
    {
        for(int j = 0; j < 10; j++)
        {
            dp[i][j] = 0;
        }
    }
    for(long long i = 0; i < 10; i++)
    {
        dp[0][i] = 0;
        dp[1][i] = 1;
    }
    bool ok = false;;
    for(long long i = 2; i <= len; i++)
    {
        for(long long j = 0; j < 10; j++)
        {
            dp[i][j] += (j == 9 ? 0 : dp[i - 1][j + 1]) + (j == 0 ? 0 : dp[i - 1][j - 1]) + dp[i - 1][j];
        }
    }
    string ans;
    int mxl = -1;
    unsigned long long sum = 0;
    for(int i = 1; i <= len; i++)
    {
        for(int j = 1; j < 10; j++)
        {
            sum += dp[i][j];
        }
        if(sum >= k)
        {
            mxl = i;
            break;
        }
        else
        {
            k -= sum;
        }
        sum = 0;
    }
    for(int i = mxl; i >= 1; i--)
    {
        if(ans.size() == 0)
        {
            for(int j = 1; j < 10; j++)
            {
                if(dp[i][j] < k)
                {
                    k -= dp[i][j];
                }
                else
                {
                    ans.push_back(j + '0');
                    break;
                }
            }
        }
        else
        {
            for(int j = max(ans.back() - '0' - 1, 0); j <= min(9, ans.back() - '0' + 1); j++)
            {
                if(dp[i][j] < k)
                {
                    k -= dp[i][j];
                }
                else
                {
                    ans.push_back(j + '0');
                    break;
                }
            }
        }
    }
    reverse(ans.begin(), ans.end());
    while(ans.back() == '0')
    {
        ans.pop_back();
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = br.readLine();
		
		for(int i = 0; i < input.length() ; i++){
			char c = input.charAt(i);
			
			if(Character.isLowerCase(c)){
				System.out.print(Character.toUpperCase(c));
			}
			
			else if(Character.isUpperCase(c)){
				System.out.print(Character.toLowerCase(c));
			}
			else {
				System.out.print(c);
			}
		}
		System.out.println();
		
//		String[] tmpArray = br.readLine().split(" ");
//		int n = Integer.parseInt(tmpArray[0]);
//		int m = Integer.parseInt(tmpArray[1]);
//		int l = Integer.parseInt(tmpArray[2]);
//
//		long[][] a = new long[n][m];
//		long[][] b = new long[m][l];
//		long[][] c = new long[n][l];
//
//		for(int i = 0; i < n; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < m; j++){
//				a[i][j] = Long.parseLong(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < m; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < l; j++){
//				b[i][j] = Integer.parseInt(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < n; i++){
//			for(int j = 0; j < l; j++){
//				for(int k = 0; k < m; k++){
//					c[i][j] += a[i][k]*b[k][j];
//				}
//
//				if(j != 0 ){
//					System.out.print(" ");
//				}
//				System.out.print(c[i][j]);
//			}
//			System.out.println();
//		}


	}

}

Measured memory_bytes: 25068
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j;
	cin>>n;
	ll a[n+1],x=0;
	for(i=0;i<n;i++)
		cin>>a[i],x^=a[i];
	// sort(a,a+n);
	// for(i=2;i<=n;i+=3){
	// 	swap(a[i%n],a[i-1]);
	// }
	// for(i=1;i<=n;i++){
	// 	if(a[i%n]!=(a[(i-1+n)%n]^a[(i+1)%n])){
	// 		cout<<"No";return 0;
	// 	}
	// }
	// cout<<"Yes";
	if(x==0)cout<<"Yes";else cout<<"No";
	return 0;
}

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

int main(){
    int n;  cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++)  cin >> a.at(i);
    sort(a.begin(), a.end(), greater<int>());
    ll ans=0;
    for(int i=0; i<n; i++){
        if(i%2) ans -= a.at(i);
        else ans += a.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int W,H,x,y,r,f;
    
    // printf("W H x y r=");
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    f = 0;
    if(x - r < 0 || x + r > W)
        f = 1;
    if(y - r < 0 || y + r > H)
        f = 1;

    if(f == 0)
        printf("Yes\n");
    else
        printf("No\n");
    
    return 0;
}


Measured memory_bytes: 2148
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

long long result, N,T,a,b,c;
string S;
vector <int>ve;

typedef pair<long long, long long> pl;
vector<pl> re;
vector<pl> bl;
pl buf;

long long Answer[200] = {};


int main() {
	result = 0;
	cin >> a>>b>>c;

	ve.push_back(a);
	ve.push_back(b);
	ve.push_back(c);
	sort(ve.begin(), ve.end());
	result = ve[2] * 2 - ve[1] - ve[0];
	if (result % 2 == 0) {
		result /= 2;
	}
	else {
		result++;
		result /= 2;
		result++;
	}

	cout << result << endl;

	/*for (int i = 0; i < T; i++) {
		if (Answer[i] == -1) {
			cout << "Case #" << i + 1 << ": OK" << endl;
		}
		else {
			cout << "Case #" << i + 1 << ": " << Answer[i] << endl;
		}

	}*/
	



	//cout << result << endl;

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
main()
{
	int c, n, i;
	long max, min, sum;

	max = -1000000;
	min = 1000000;
	sum = 0;

	scanf("%d", &c);

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

		if(n > max){
			max = n;
		}
		if(n < min){
			min = n;
		}
		sum = sum + n;
	}

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

	return 0;
}

Measured memory_bytes: 600
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
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 (b<a){a=b;return 1;}return 0;}
const string YES = "Yes";
const string NO = "No";
// clang-format on

void solve(long long A, long long B, long long C) {
  if ((A == B && A != C) || (B == C && B != A) || (A == C && A != B)) {
    ANS(YES);
  } else {
    ANS(NO);
  }
}

// clang-format off
int main() {
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long C;
  scanf("%lld",&C);
  solve(A, B, C);
  return 0;
}


Measured memory_bytes: 256
//Tariquzzaman Faisal
//_Faisal101_
//IUT_CSE'19
//190041101

#include<iostream>
#include<stdio.h>
#include<vector>
#include<deque>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cmath>
#include<iterator>
#define mp make_pair
#define pb push_back
#define pb push_back
#define fileOut freopen("out.txt","w",stdout)
#define fileIn freopen("in.txt","r",stdout)
#define testcases ll tc,t; cin >> tc; for(t=1; t<=tc; t++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pi acos(-1.0)
#define ll long long

using namespace std;


int main(){
	
	ll n, p;
	cin >> n >> p;
	cout << (n+1)-p <<endl;
	
return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	bool a = 0, b = 0, c = 0, d = 0;
	for(int i=0; i<s.size(); i++) {
		if(s[i] == 'N' ) a = 1;
		else if(s[i] == 'S') b = 1;
		else if(s[i] == 'W') c = 1;
		else d = 1;
	}
	if(a == b && c == d) cout << "Yes" << endl;
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string ans="Yes";
    vector<string> w(n);
    for(int i=0; i<n; i++){
        cin >> w.at(i);
    }
    for(int i=1; i<n; i++){
        for(int j=0; j<i; j++){
            if(w.at(i)==w.at(j)) ans="No";
        }
        if(w.at(i).front()!=w.at(i-1).back()) ans="No";
//        cout << ans << endl;
    }
    cout << ans << endl;
}

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

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

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x)
{ //bit計算
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
signed main()
{
    int ans = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != s[s.length() - i - 1] && s[i] == 'x')
        {
            s.insert(s.end() - i, 'x');
            ans++;
        }
        else if (s[i] != s[s.length() - i - 1] && s[s.length() - i - 1] == 'x')
        {
            s.insert(s.begin() + i, 'x');
            ans++;
        }
        else if (s[i] != s[s.length() - i - 1])
        {
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    int X,N;
    cin >> X >> N;
    vector<bool> ok(102);
    rep(i,102) ok[i] = true;
    rep(i,N){
        int p;
        cin >> p;
        ok[p] = false;
    }
    P ans(99999,-1);
    for(int i = 0; i <= 101; i++){
        if(!ok[i]) continue;
        int dis = abs(X-i);
        ans = min(ans,P(dis,i));
    }
    cout << ans.second << endl;
    return 0;
}

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

int main(){
    char s1,s2;
    cin>>s1>>s2;
    if((s1-'A')>(s2-'A'))cout<<">"<<endl;
    else if((s1-'A')<(s2-'A'))cout<<"<"<<endl;
    else cout<<"="<<endl;

    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] Cz = new int[N];
        int[][] Az = new int [N][M];

        for (int i = 0; i < N; i++){
            for (int j = 0; j < M + 1; j++) {
                if (j == 0){
                    Cz[i] = sc.nextInt();
                } else {
                    Az[i][j - 1] = sc.nextInt();
                }
            }
        }
        HashSet<Integer> set = new HashSet<Integer>();
        int[] sums = new int[M];
        int cannot_flg = 0;
        int inf = 1000000000;
        int min_money = inf;
        int val = 0;
        for (int i = 0; i < (2<<N-1); i++){
            sums = new int[M];
            set = new HashSet<Integer>();
            for (int j = 0; j < N; j++) {
                cannot_flg = 0;
                if ((1 & i >> j) == 1) {
                    set.add(j);
                }
            }
//            System.out.println("i: "+i+" set: "+set);
            for (int k: set){
                for (int m = 0; m < M; m++){
                    sums[m] += Az[k][m];
                }
            }

            for (int m = 0; m < M; m++){
//                System.out.println("sums[m] "+sums[m]);
                if (sums[m] < X){
                    cannot_flg = 1;
                    break;
                }
            }

            if (cannot_flg == 0){
                val = 0;
                for (int n: set){
//                    System.out.println("Cz[n]: "+Cz[n]);
                    val += Cz[n];
                }

                if (val < min_money) min_money = val;
            }
//            }
        }

        if (min_money == inf) min_money = -1;
        System.out.println(min_money);
//        System.out.println(N);
//        System.out.println(Math.pow(2,N));
//        System.out.println(2<<N-1);
//        System.out.println(2<<N);
    }
}


Measured memory_bytes: 40484
#include <cstdio>

#define iter(i, n) for (int i = 1; i <= n; ++i)
#define iter_e(i, x) for (int i = pos[x]; i; i = g[i].frt)

#define NR 101000
typedef long long i64;

struct Edge { int y, frt; } g[NR * 2];

int n, m, pos[NR], gsz, cnt_e, col[NR];
i64 cnt[3], ans;
bool invalid;

void AE(int x, int y) { g[++gsz] = (Edge) { y, pos[x] }, pos[x] = gsz; }

#define v g[i].y
void dfs(int x) {
	++cnt[col[x]];
	iter_e(i, x) {
		int c = (col[x] + (i % 2 == 1 ? 1 : 2)) % 3;
		if (col[v] == -1) col[v] = c, dfs(v);
		else if (col[v] != c) invalid = true;
		++cnt_e;
	}
}

int main() {
	scanf("%d%d", &n, &m);
	iter(i, m) {
		int x, y;
		scanf("%d%d", &x, &y);
		AE(x, y), AE(y, x);
	}
	iter(i, n) col[i] = -1;
	iter(i, n) if (col[i] == -1) {
		cnt[0] = cnt[1] = cnt[2] = cnt_e = 0; 
		col[i] = 0;
		invalid = false;
		dfs(i);

		//if (cnt[0] + cnt[1] + cnt[2] > 2) printf("%d %lld %lld %lld %d\n", invalid, cnt[0], cnt[1], cnt[2], cnt_e/2);

		if (invalid) ans += (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
		else if (cnt[1] != 0 && cnt[2] != 0) ans += cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
		else ans += cnt_e / 2;
	}
	printf("%lld\n", ans);
	return 0;
}

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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = m - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  vector<vector<ll>>g(n);
  vector<vector<ll>>gr(n);
  rep(i,0,m){
    ll s,t;cin>>s>>t;
    s--;t--;
    g[s].PB(t);
    gr[t].PB(s);
  }
  vector<ld>dp(n,0);
  vector<ld>dpmin(n,0);
  rrep(i,0,n-1){
    ll sz=g[i].size();
    ld sumbuf=0;
    ld maxbuf=0;
    rep(j,0,g[i].size()){
      sumbuf+=dp[g[i][j]]+1;
      chmax(maxbuf,dp[g[i][j]]);
    }
    dp[i]=sumbuf/sz;
    if(sz==1)dpmin[i]=0;
    else dpmin[i]=(sumbuf-maxbuf-1)/(sz-1);
  }
  ld ret=dp[0];
  //debug(dp,n);
  //debug(dpmin,n);
  //cout<<ret<<endl;
  rep(i,0,n){
    if(dpmin[i]==0)continue;
    auto dptmp=dp;
    dptmp[i]=dpmin[i];
    //debug(dptmp,n);
    rrep(j,0,i){
      ll sz=g[j].size();
      ld sumbuf=0;
      rep(o,0,g[j].size()){
        sumbuf+=dptmp[g[j][o]]+1;
      }
      dptmp[j]=sumbuf/sz;
    }
    if(dptmp[0]!=0)chmin(ret,dptmp[0]);
    //cout<<i<<endl;
    //debug(dp,n);
    //debug(dptmp,n);
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;

int main(){
  long d;
  cin >> d;
  long n = 26, csum = 0, ccost = 0;
  vector<long> c(n),last(n);
  rep(i,n){
    cin >> c[i];
    csum += c[i];
    last[i] = 0;
  }
  vector<vector<long>> s(d,vector<long>(n));
  rep(i,d)rep(j,n)cin >> s[i][j];
  vector<vector<long>> cand;
  vector<long> score;
  random_device rd{};
  vector<long> yotei(d);
  vector<long> tmp(d);
  long final_ans = 0, final_index;

  rep(jj,10){

    long ans = 0;
    rep(i,n)last[i] = 0;
    rep(i,d)yotei[i] = rd()%n;
    rep(i,d){
      ccost += csum;
      ccost -= c[yotei[i]]*(i+1 - last[yotei[i]]);
      ans -= ccost;
      last[yotei[i]] = i+1;
      ans += s[i][yotei[i]];
    }
    int ii = 0;
    while(ii < 10000){
      long new_day = rd()%d, new_con;
      while(1){
        new_con = rd()%n;
        if(yotei[new_day] != new_con)break;
      }
      long pre_con = yotei[new_day];
      yotei[new_day] = new_con;
      long tmpans = 0;
      ccost = 0;
      rep(i,n)last[i] = 0;
      rep(i,d){
        tmp[i] = yotei[i];
        ccost += csum;
        ccost -= c[yotei[i]]*(i+1 - last[yotei[i]]);
        tmpans -= ccost;
        last[yotei[i]] = i+1;
        tmpans += s[i][yotei[i]];
      }
      if(tmpans < ans)yotei[new_day] = pre_con;
      else{
        ans = tmpans;
        cand.push_back(tmp);
      }
      ii++;
    }
    if(final_ans < ans){
      final_ans = ans;
      final_index = int(cand.size()-1);
    }
  }
  rep(i,d)cout << cand[final_index][i]+1 << endl;
  return 0;
}

Measured memory_bytes: 23352
s = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
t = list(map(int,s.split(', ')))
n = int(input())-1
print(t[n])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, m; cin >> n >> m;

    if(n==1 && m==1) cout << 1 << endl;
    else if(n==1 && m>=3) cout << m-2 << endl;
    else if(m==1 && n>=3) cout << n-2 << endl;
    else if(n>=3 && m>=3) cout << (n-2)*(m-2) << endl;
    else cout << 0 << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 105;
int a[maxn], b[maxn], a1[maxn], b1[maxn];
int  v[maxn], match[maxn];
int n;
vector < int > g[maxn];
bool dfs(int x)
{
	int y;
	for(int i = 0; i < g[x].size(); i++){
		y = g[x][i];
		if(!v[y]){
			v[y] = 1;
			if(!match[y] || dfs(match[y])){
				match[y] = x;
				return true;
			}
		}
	}
	return false;
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d", a + i, b + i);
	}
	for(int i = 1; i <= n; i++){
		scanf("%d %d", a1 + i, b1 + i);
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(a[i] < a1[j] && b[i] < b1[j]){
				g[i].push_back(j);
			}
		}
	}

	int ans = 0;
	for(int i  = 1; i <= n; i++){
		memset(v, 0, sizeof(v));
		if(dfs(i))ans++;
	}
	printf("%d", ans);
	return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<ll,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst<<": "; dbg(rst...); }
void PR(){} template <typename T,typename ...T2> void PR(const T& fst, const T2&...rst){cout << fst; PR(rst...); }



int main()
{
	const double PI = acos(-1);
	cin.tie(0); ios_base::sync_with_stdio(false);
	int a, b;
	cin >>a >>b;
	
	if(a>b) swap(a, b);
	PR(string(b, '0'+a), "\n");
	
	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int ans;
  int x = A + B;
  int y = 2 * A - 1;
  int z = 2 * B - 1;
  ans = max(x, max(y, z));
  cout << ans << endl;
};


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val n = readLine()!!
  val u = when (n[n.length - 1].toString()) {
     "2", "4", "5", "7", "9" -> "hon"
    "0", "1", "6", "8" -> "pon"
    else -> "bon"
  }

  println(u)
}

Measured memory_bytes: 34468
fn main() {
    let n: usize = readln();
    let s: Vec<Vec<char>> = readlns(n);
    let mut result = HashMap::new();
    let mut answer = 0;
    for a in 0..n {
        for b in 0..n {
            let key = a as isize - b as isize;
            if !result.contains_key(&key) {
                let mut ok = true;
                for i in 0..n {
                    for j in 0..n {
                        let p = (i + a) % n;
                        let q = (j + b) % n;
                        let u = (j + a) % n;
                        let v = (i + b) % n;
                        if s[p][q] != s[u][v] {
                            ok = false;
                        }
                    }
                }
                result.insert(key, if ok { 1 } else { 0 });
            }
            answer += result[&key];
        }
    }
    println!("{}", answer);
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

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

int main(void){
    long long int a,b,c;
    cin >> a >> b >> c;
    if(c-a+b > 0){
        if(4*a*b  < c*c+(a+b)*(a+b)-2*c*(a+b) ){
            printf("Yes");
        }else{
            printf("No");
        }
        return 0;
    }else{
        if(4*a*b  > c*c+(a+b)*(a+b)-2*c*(a+b) ){
            printf("Yes");
        }else{
            printf("No");
        }
        return 0;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define AB_BHI_NI_DEGI                \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

int power(int a, int n, int m)
{
    int res = 1;
    while (n)
    {
        if (n & 1)
            res = (res * a) % m;
        n = n / 2;
        a = (a * a) % m;
    }
    return res;
}

bool fun(string s, int n)
{
    int res = 0;
    int po = 1;
    while (s.size())
    {
        int x = s.back() - '0';
        s.pop_back();
        x *= po;
        res += (x) % n;
        res %= n;
        po = (po * 10) % n;
    }
    //cout << res << "\n";
    return (res % n);
}

void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    while (s.size() and s.back() == 'W')
    {
        s.pop_back();
        n--;
    }
    set<int> S[2];
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'R')
            S[0].insert(i);
        else
            S[1].insert(i);
    }
    int ans = 0;
    int idx = n - 1;
    while (s.size() and S[1].size() and S[0].size())
    {
        int x = *S[0].rbegin();
        int y = *S[1].begin();
        if (s.back() == 'W')
        {
            s.pop_back();
            n--;
            S[1].erase(n);
        }
        else
        {
            ans++;
            s.pop_back();
            n--;
            S[0].erase(n);
            S[1].erase(y);
            S[0].insert(y);
        }
    }
    cout << ans << "\n";
}
int32_t main()
{
    AB_BHI_NI_DEGI
    int Test = 1;
    //cin >> Test;
    while (Test--)
        solve();
    return 0;
}

Measured memory_bytes: 13028
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
using namespace std;

#define ll long long
#define ld long double
#define pi 3.14159265359;

// v:vector  type:型  order:greater(大きい順) or less(小さい順)
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// vector 要素の総和算出
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// vector 最大値( return ite )
#define _max_element(v) max_element(v.begin(),v.end())
// vector 最大値が格納されている要素値
#define _max_element_number(v) distance(v.begin(),max_element(v.begin(),v.end()))
// 特定コンテナの中から特定の値をカウントする
#define _count(v,value) count(v.begin(),v.end(),value)

//set<uint32_t> member;	// 重複するデータを保持する事はできない member.insert(2) member.insert(2) ⇒ member.count(2)は1
//                                                              member.emplace(2)とかも同じ
//multiset<uint32_t> v;	// 重複するデータも保持する事はできる   member.insert(2) member.insert(2) ⇒ member.count(2)は2

// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)
// string ⇒ int
#define _stringtoi(s) stoi(s)
// double 平方根
#define _sqrt(x) sqrt(x)
// double 引数 x 以上で最小の整数値 ex) 3.30303 ⇒ 4
#define _ceil(x) ceil(x)
// 指定された要素以上の値が現れる最初の位置のイテレータを取得する
#define _lower_bound(v,min) lower_bound(v.begin(), v.end(), min)
// 指定された要素より大きい値が現れる最初の位置のイテレータを取得する
#define _upper_bound(v,min) upper_bound(v.begin(), v.end(), min)

// 順列 n個の数が与えられる
// 0,1,2,...,n-1
// 全ての並べ方を1行ごとに出力する
// ex 0 1 2 / 0 2 1 / 1 0 2 / 1 2 0 / 2 0 1 / 2 1 0
#define _next_permutation(v) do {   \
	for (auto num : v) {            \
		printf("%d ", num);         \
	}                               \
	printf("\n");                   \
} while (next_permutation(v.begin(), v.end()))

// 絶対値
static int32_t _abs(const int32_t x) { return  (x > 0 ? x : -x); }
// 最大公約数
static int gcd(int a, int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
// 最小公倍数
static int lcm(int a, int b) { return a * b / gcd(a, b); }
// 多次元 std::vector 生成
template<class T>
vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
// ex) auto dp = make_vec<uint64_t>(SIZE + 1, 2, 2);

// UINT32_MAX
// 4294967295 ≒ 4 * 1e9


/*

*/
// ABC 161 B
// https://atcoder.jp/contests/abc161/tasks/abc161_b
int main()
{
	uint32_t n,m;
	cin >> n >> m;

	vector<uint32_t> v(n);
	for (uint32_t i = 0; i < n; i++) {
		cin >> v[i];
	}
	_sort(v, uint32_t, greater);

	uint32_t border = (_sum(v, 0) + (4 * m) - 1) / (4 * m);
	for (uint32_t i = 0; i < m; i++) {
		if (v[i] < border) {
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 3624
n, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [10 ** 10] * n
dp[0] = 0

for i in range(n):
    for k in range(1, K + 1):
        if i + k < n:
            dp[i + k] = min(dp[i + k], dp[i] + abs(h[i + k] - h[i]))

print(dp[n - 1])

Measured memory_bytes: 52592
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}

ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p&1)    res = (res * x)%m;
        x = (x * x)%m;
        p >>= 1;
    }
    return res;
}


const int N = 2e5 + 5, MX = 1e9;
char a[N];
int main(){
    scanf("%s", a);
    ll k = LLD();
    char ans = a[0];
    for(int i = 0; i < k && a[i]; ++i){
        if(a[i] != '1'){
            ans = a[i];
            break;
        }
    }
    printf("%c", ans);
    return 0;
}


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

int main (void) {
    double x1, y1, x2, y2;

    scanf ("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    printf ("%lf\n", hypot(x2-x1, y2-y1));
    
    return 0;
}


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

#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define unq(v) sort(v.begin(),v.end()),v.erase(unique(v.begin(),v.end()),v.end())
#define ll long long
#define pb push_back
#define fill(arr) memset(arr,0,sizeof(arr))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define pi acos(-1.00)
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
    _ios;
    ll a,b,c,d,w,s;
    cin>>a>>b>>c>>d;
    w=c/b;
    s=a/d;
    if(c%b!=0)w++;
    if(a%d!=0)s++;
    if(w<=s)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3652
def bubbles(N):
    count = 0
    for i in range(len(N)):
        for j in range(len(N)-1, i, -1):
            if N[j] < N[j-1]:
                N[j], N[j-1] = N[j-1], N[j]
                count += 1
    c = 1
    for i in N:
        print(i, end='')
        if c < len(N):
            print(' ', end='')
            c += 1
    print('')
    return count
 
n = int(input())
numbers = list(map(int, input().split()))
 
print(bubbles(numbers))


Measured memory_bytes: 5624
#include <stdio.h>
#include <stdlib.h>

int main()
{
  long sum = 0;
  long long dif, tmp;
  int N;
  scanf("%d", &N);
  int a[N];
  for(int i = 0; i < N; i++){
    scanf("%d", &a[i]);
    sum += a[i];
  }

  long long up;
  up = a[0];
  dif = labs(2*up - sum);

  for(int i = 1; i < N-1; i++){
    up += a[i];
    tmp = labs(2*up - sum);
    if(tmp < dif) dif = tmp;
  }
  printf("%lld", dif); 
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int a, b; cin >> a >> b;
    if (a + b >= 10) {
        cout << "error" << endl;
    } else {
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
n = int(input())
coins = [1]

i = 1
while True:
  coin = 6**i
  if coin > 100000:
    break
  coins.append(coin)
  i += 1

i = 1
while True:
  coin = 9**i
  if coin > 100000:
    break
  coins.append(coin)
  i += 1

dp = [0] * (n+1)

for i in range(1, n+1):
  dp[i] = min([dp[i-coin] for coin in coins if coin <= i]) + 1

print(dp[n])


Measured memory_bytes: 42348
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462
typedef long long ll;
typedef double db;
//ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b/=2;}return res%mod;}
ll a[200005],b[200005];
int main(){
    ll n;cin>>n;;
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i];
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    if(n%2==1){
        cout<<b[(n+1)/2]-a[(n+1)/2]+1<<endl;
        return 0;
    }
    else{
        cout<<b[n/2]+b[n/2+1]-a[n/2]-a[n/2+1]+1<<endl;
    }
}

Measured memory_bytes: 6760
def function(h, n, a)
	sum = 0
	a.each { |c| sum += c }
	h <= sum ? 'Yes' : 'No'
end

h, n = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
puts function(h, n, a)


Measured memory_bytes: 8708
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>

using namespace std;


int main(){
  ios::sync_with_stdio(false);
  int N; 
  cin >> N;
  set<string> dict;

  for(int i=0; i<N; ++i){
    string command;
    string val;
    
    cin >> command; 
    cin >> val;

    if(command[0] == 'i'){
      //insert 
      dict.insert(val);
    }
    else{
      //find
      if(dict.find(val) != dict.end()){
	cout << "yes" << endl;
      }
      else{
	cout << "no" << endl;
      }
    }
  }
    

  return 0;
}

Measured memory_bytes: 27052