akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<int> A(N-1);
  for(int i=1; i<N; i++){
    for(int j=i+1; j<=N; j++) A.at(min({abs(j-i), abs(X-i)+1+abs(j-Y), abs(Y-1)+1+abs(j-X)})-1)++;
  }
  rep(i, N-1) cout << A.at(i) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>
#define MAX 100
#define INFTY INT_MAX -1
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2

/* Global Variables */
int AM[MAX][MAX]; //Adjacency Matrix
int color[MAX];
int d[MAX], pi[MAX];
int n;

/* Dijkstra's Algorithm */
void dijkstra(int s) {
  int i, u, v;
  int mincost;

  for ( u = 0; u < n; u++ ) {
    color[u] = WHITE;
    d[u] = INFTY;
    pi[u] = NIL;
  }
  d[s] = 0;

  while ( 1 ) {
    mincost = INFTY;
    for ( i = 0; i < n; i++ ) {
      if ( color[i] != BLACK && d[i] < mincost ) {
        mincost = d[i];
        u = i;
      }
    }

    if ( mincost == INFTY ) break;

    color[u] = BLACK;

    for ( v = 0; v < n; v++ ) {
      if ( color[v] != BLACK && AM[u][v] != INFTY ) {
        if ( d[u] + AM[u][v] < d[v] ) { //Relaxation
          d[v] = d[u] + AM[u][v];
          pi[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }

}

/* Main */
int main() {
  int i, j;
  int k, u, v;

  scanf("%d", &n);

  //Initialize
  for ( i = 0; i < n; i++ )
    for ( j = 0; j < n; j++ )
      AM[i][j] = INFTY;

  for ( i = 0; i < n; i++ ) {
    scanf("%d%d", &u, &k);
    for ( j = 0; j < k; j++ ) {
      scanf("%d", &v);
      scanf("%d", &AM[u][v]);
    }
  }

  // Find the Single Source Shortest Path by Dijkstra's Algorithm
  dijkstra(0);

  for ( i = 0; i < n; i++ )
    printf("%d %d\n", i, d[i]);

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt int Q[100005]={0}
#define mp make_pair
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<int>()) 
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(int i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(int i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
int powe(int n,int m){if(m==0)return 1;int t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
int mpowe(int n,int m){if(m==0)return 1;int t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
int logtwo(int n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]<=x){y=mid;ceilsearch(ar,mid+1,high,x,y);}else{ceilsearch(ar,low,mid-1,x,y);}}
int main()
{
    fastio();
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
   int n,k;
   cin>>n>>k;
   double a[n];
   cn(a,n);
   for(int i=0;i<n;i++)
    a[i] = (a[i]+1)/2;
    
    for(int i=1;i<n;i++)
    a[i]+=a[i-1];

    double m = a[k-1];
    for(int i=k;i<n;i++)
        m = max(m,a[i]-a[i-k]);
    cout<<fixed<<setprecision(10)<<m<<endl;

}

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

using namespace std;

int MAX_N = 100;

int main()
{
    long double pi = 3.14159265358979323;
    long double a,b,c;

    cin >> a;

    cout << 2*a*pi << endl;

    return 0;
}

Measured memory_bytes: 3792
#include<stdio.h>
#include<math.h>
#include<stdlib.h>


int main(){
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    int eqt=a, eqa= c;

    for(;;){
        eqa-=b;
        if(eqa<=0){
            printf("Yes\n");
            break;
        }

        eqt-=d;
        if(eqt<=0){
            printf("No\n");
            break;
        }


    }
}

Measured memory_bytes: 1660
n = int(input())
d = [0] * 5
for i in range(n):
    s = input()
    if s[0] == "M":
        d[0] += 1
    if s[0] == "A":
        d[1] += 1
    if s[0] == "R":
        d[2] += 1
    if s[0] == "C":
        d[3] += 1
    if s[0] == "H":
        d[4] += 1
import itertools
res = 0
for x  in list(itertools.combinations([0,1,2,3,4], 3)):
    res += d[x[0]] * d[x[1]] * d[x[2]]
print(res)

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

typedef long long lint;
typedef pair<int, int> pii;

const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;

int n;
lint A[MAX], sum, ans;

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

	cin>>n;
	for(int i=1; i<=n; i++) cin>>A[i], sum^=A[i];
	for(int i=1; i<=n; i++){
		for(lint e = 1LL<<59; e>0; e>>=1)
			if((A[i]&e) && (sum&e)) A[i]^=e;
	}

	for(lint e = 1LL<<59, x=0; e>0; e>>=1, x=0){
		for(int i=1; i<=n; i++) if(A[i]&e) x=A[i];
		if(~A[0]&e) A[0]^=x;
		for(int i=1; i<=n; i++) if(A[i]&e) A[i]^=x;
	}
	cout<<A[0]*2 + sum<<'\n';


	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <climits>

int main() {
    using namespace std;
    
    int n, k;
    while(cin >> n >> k, (n|k)) {
        int arr[n]; cin >> arr[0]; for(int i=1; i<n; i++) { cin >> arr[i]; arr[i] += arr[i-1]; }
    
        int res = INT_MIN/4;

        for(int i=0; i<n-k; i++) {
            res = max(res, arr[i+k]-arr[i]);    
        }
    
        cout << res << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1548
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split(new char[]{' '}).Select(long.Parse).ToArray();
			long N = input[0];
			long M = input[1];
			long count = 0;
			long quotient = N / M;
			count = quotient > 0 ? M / 2 : N + (M - 2 * N) / 4;
			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 13268
#include <iostream>

class Vertex {
public:
    int u, k, *v;
};

using namespace std;

int main() {
    int **matrix = nullptr, num = 0;
    Vertex *vertex;

    cin >> num;
    matrix = (int **)malloc(num * sizeof(int *));
    for(int i=0; i<num; ++i)
        matrix[i] = (int *)malloc(num * sizeof(int));
    
    for(int i=0; i<num; ++i) {
        for(int j=0; j<num; ++j) {
            matrix[i][j] = 0;
        }
    }
    
    vertex = new Vertex[num];
    for(int i=0; i<num; ++i) {
        cin >> vertex[i].u >> vertex[i].k;
        vertex[i].v = new int[vertex[i].k];
        for(int j=0; j<vertex[i].k; ++j) {
            cin >> vertex[i].v[j];
            matrix[vertex[i].u-1][vertex[i].v[j]-1] = 1;
        }
    }

    for(int i=0; i<num; ++i) {
        for(int j=0; j<num; ++j) {
            if(j) cout << " ";
            cout << matrix[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n); sll(m); sll(c);
	LL bs[m], solved = 0;
	rep(i, 0, m)	bs[i] = scanLong();
	rep(i, 0, n) {
		LL sum = 0;
		rep(j, 0, m) {
			sum += scanLong() * bs[j];
		}
		if(sum + c > 0)	solved++;
	}
	pll(solved); nl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int N,height;
  cin>>N>>height;
  int a[N];
  int cnt=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
    if(a[i]>=height)cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<cstring>

using namespace std;

const int MAX = 31;
char data[MAX][MAX],tmp[MAX][MAX];
bool erase[MAX][MAX];
int H,W,N;
int dx[] = {1,0};
int dy[] = {0,1};


void print(){
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) cout << tmp[i][j];
    cout << endl;
  }
  cout << endl;
}

void copy(){
  for(int i = 0; i < H; i++)
    for(int j = 0; j < W; j++) tmp[i][j] = data[i][j];
}

void input(){
  cin >> H >> W >> N;
  for(int i = 0; i < H; i++)
    for(int j = 0; j < W; j++)
      cin >> data[i][j];
}

bool isEmpty(){
  for(int i = 0; i < H; i++)
    for(int j = 0; j < W; j++)
      if(tmp[i][j] != '.') return false;
  return true;
}


bool isInside(int x, int y){ return 0<=x&&x<W&&0<=y&&y<H;}


int rec(int r, int c, int d, int n, char ch){
  
  int nc = c+dx[d];
  int nr = r+dy[d];
  int res = n;

  if(isInside(nc, nr) && tmp[nr][nc] == ch) res = rec(nr, nc, d, n+1, ch);

  if(res >= N)erase[r][c] = true; 
  return res;
}

void move(){
  
  for(int i = H-1; i >= 0; i--)
    for(int j = W-1; j >= 0; j--){
      if(tmp[i][j] != '.') continue;
      for(int k = i-1; k >= 0; k--){
	if(tmp[k][j] != '.'){
	  swap(tmp[i][j],tmp[k][j]);
	  break;
	}
      }
    }
}


void simulate(){

  //  print();
  while(1){
    memset(erase,false,sizeof(erase));
    
    int res = 0;
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++)
	for(int k = 0; k < 2; k++)
	  if(tmp[i][j] != '.') res = max(res,rec(i,j,k,1,tmp[i][j]));
    if(res < N) break;
    
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++) if(erase[i][j]) tmp[i][j] = '.';
    
    move();
  }
  
  // print();
}


void solve(){
  for(int i = 0; i < H; i++)
    for(int j = 0; j < W-1; j++){
      //  if(data[i][j] != '.' && data[i][j+1] != '.'){
	copy();
	swap(tmp[i][j],tmp[i][j+1]);
	move();
	simulate();
	if(isEmpty()){
	  cout <<"YES" << endl;
	  return;
	}
	//    }
    }

  cout << "NO" << endl;
}

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

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main(){

    int h, w;
    cin >> h >> w;
    V<string> s(h);
    rep(i, h)cin >> s[i];

    deque<P> dq;
    dq.push_front(P(0, 0));
    vvi dist(h, vi(w, INF));
    dist[0][0] = s[0][0] == '#' ? 1 : 0;

    while (!dq.empty()) {
        int y = dq.front().first;
        int x = dq.front().second;dq.pop_front();
        vi dy = { 0,1 };
        vi dx = { 1,0 };
        rep(i, 2) {
            int ey = y + dy[i];
            int ex = x + dx[i];
            if (ey < 0 || h <= ey || ex < 0 || w <= ex)continue;
            int d = 0;
            if (s[y][x] == '.' && s[ey][ex] == '#')d = 1;
            if (dist[ey][ex] <= dist[y][x] + d)continue;
            dist[ey][ex] = dist[y][x] + d;
            if (d)dq.push_back(P(ey, ex));
            else dq.push_front(P(ey, ex));
        }
    }

    cout << dist[h - 1][w - 1] << endl;

 }

Measured memory_bytes: 256
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
x=Counter(a[0::2]).most_common()
y=Counter(a[1::2]).most_common()
x.append([0,0])
y.append([0,0])
if x[0][0]!=y[0][0]:
  print(n-x[0][1]-y[0][1])
else:
  print(min(n-x[1][1]-y[0][1], n-x[0][1]-y[1][1]))

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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}

int main(){
    int n = -1, x = -1;
    while(n != 0 || x != 0) {
        cin >> n >> x;

    

        int cnt = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = i + 1; j <= n; j++) {
                for(int k = j + 1; k <= n; k++) {
                    if(i == j || i == k || j == k) continue;
                    if(i + j + k == x) cnt++;
                }
            }
        }

        if(n != 0 || x != 0) cout << cnt << endl;
    }
    return 0;
}


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

int main(){
  int n,t;
  cin>>n>>t;
  vector<P> A(n);
  rep(i,n){
    int a1,b1;
    cin>>a1>>b1;
    A[i]=make_pair(a1,b1);
  }
  sort(A.begin(),A.end());
  vector<vector<int>> d(7000,vector<int>(7000,0));
  int ans=0;
  rep(i,n){
    rep(j,t){
      int time=A[i].first;
      int cost=A[i].second;
    d[i+1][j]=max(d[i+1][j],d[i][j]);

    if ((j+time)<=t-1)
    d[i+1][j+time]=max(d[i+1][j+time],d[i][j]+cost);

  //  cout<<ans<<' '<<i+1<<'i'<<j+time<<'j'<<endl;
  //  cout<<d[i+1][j+time]<<' '<<i+1<<' '<<j+time<<endl;
  }
  ans=max(ans,d[i][t-1]+A[i].second);
  }
  cout<<ans;






  }


Measured memory_bytes: 192000
N,M = map(int,input().split())
maxL = 1
minR = 100000
for i in range(M):
    Li,Ri = map(int,input().split())
    maxL = max(maxL,Li)
    minR = min(minR,Ri)
        
if minR - maxL >= 0:
    print(minR-maxL+1)
else:
    print(0)

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

using namespace std;

int main(){
  int k;
  cin >> k;
  vector<long long> lunlun;
  if(k<=9){
    cout << k << endl;
    return 0;
  }
  for(int i=1;i<10;i++)lunlun.push_back(i);
  int begin=0, end=lunlun.size();
  while(1){
    end=lunlun.size();
    for(int i=begin;i<end;i++){
      long long value=lunlun[i];
      if(value%10==0){
        lunlun.push_back(value*10);
        lunlun.push_back(value*10+1);
      }
      else if(value%10==9){
        lunlun.push_back(value*10+8);
        lunlun.push_back(value*10+9);
      }
      else{
        lunlun.push_back(value*10+(value%10-1));
        lunlun.push_back(value*10+(value%10));
        lunlun.push_back(value*10+(value%10+1));
      }
      if(lunlun.size()>=k){
        cout << lunlun[k-1] << endl;
        return 0;
      }
      begin = end;
    }
  }
}



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

namespace _0030
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int[] items = RIntAr();
                if (items.Sum() == 0) return;

                int cnt = 0;
                foreach (var item in Combination.GetCombination(Enumerable.Range(0, 10), items[0]))
                {
                    if (item.Sum() == items[1]) cnt++;
                }
                Console.WriteLine(cnt);
            }
        }

        public class Combination
        {
            public static IEnumerable<IEnumerable<T>> GetCombination<T>(IEnumerable<T> items, int r)
            {
                if (r == 0)
                {
                    yield return Enumerable.Empty<T>();
                }
                else
                {
                    var i = 0;
                    foreach (var x in items)
                    {
                        i++;
                        var xs = items.Skip(i);
                        foreach (var c in GetCombination(xs, r - 1)) yield return Concat(x, c);
                    }
                }
            }

            public static IEnumerable<T> Concat<T>(T first, IEnumerable<T> items)
            {
                yield return first;
                foreach (var i in items) yield return i;
            }
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 18316
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int count = 0;
		for (int i = a; i <= b; i++) {
			if (c % i == 0) {
				count++;
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 26300
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AExpired {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    ll x, a, b;
	    in >> x >> a >> b;
	    if(b <= a) out << "delicious" << endl;
	    else if(b-a <= x) out << "safe" << endl;
	    else out << "dangerous" << endl;
	}
};


int main() {
	AExpired solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    forn(i,n)   cin>>h[i];
    sort(all(h));
    if(k>=n){
        cout<<0<<endl;
    }
    else{
        i64 sum=0;
        forn(i,n-k)   sum+=h[i];
        cout<<sum<<endl;
    }
    return 0;
}



Measured memory_bytes: 1024
fun main(args: Array<String>) {
    readLine()
    val vs = readLine()!!.split(' ').map { it.toInt() }
    val map1 = mutableMapOf<Int, Int>()
    val map2 = mutableMapOf<Int, Int>()

    vs.forEachIndexed { i, v ->
        if (i % 2 == 0) {
            map1[v] = map1.getOrPut(v) { 0 }.plus(1)
        } else {
            map2[v] = map2.getOrPut(v) { 0 }.plus(1)
        }
    }

    val sorted1 = map1.toList().sortedByDescending { pair -> pair.second }.plus(Pair(0, 0))
    val sorted2 = map2.toList().sortedByDescending { pair -> pair.second }.plus(Pair(0, 0))

    if (sorted1[0].first != sorted2[0].first) {
        val r = map1.values.sum() - sorted1[0].second + map2.values.sum() - sorted2[0].second
        println(r)
        return
    }

    val r1 = map1.values.sum() - sorted1[0].second + map2.values.sum() - sorted2[1].second
    val r2 = map1.values.sum() - sorted1[1].second + map2.values.sum() - sorted2[0].second
    println(Math.min(r1, r2))
}

Measured memory_bytes: 63720
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int k;
  cin >> k;
  string s;
  cin >> s;
  if(s.size() <= k) cout << s << endl;
  else{
    rep(i, k){
      cout << s.at(i);
    }
    cout << "..." << endl;
  }
  return 0;
}

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

int main() {

    set<char> s;
    string str;
    cin >> str;

    s.insert(str[0]);
    s.insert(str[1]);
    s.insert(str[2]);
    
    if(s.size() == 2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

bool check(vector<int> &v, vector<int> &p, int n){
  bool flag = true;
  rep(i, n){
    if (v[i] != p[i]){
      flag = false;
      break;
    }
  }
  return flag;
}

int main(){
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];
  vector<int> perm(n);
  rep(i, n) perm[i] = i + 1;
  int count = 1;
  int a = 0;
  int b = 0;
  do {
    if (check(perm, p, n)) a = count;
    if (check(perm, q, n)) b = count;
    count++;
    if (a != 0 && b != 0) break;
  } while(next_permutation(perm.begin(), perm.end()));
  cout << abs(a-b) << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
W = [int(i) for i in input().strip().split()]
res = sum(W)
for T in range(N-1):
  S1 = sum(W[:T+1])
  S2 = sum(W[T+1:])
  res = min(res, abs(S2 - S1))
print(res)

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N*(N-1)//2)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(100000)

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
    if x not in xtoy:
        xtoy[x] = [y]
    else:
        xtoy[x].append(y)
    if y not in ytox:
        ytox[y] = [x]
    else:
        ytox[y].append(x)

def doit(x, xs, ys, xtoy, ytox):
    ret = 0
    if x in xtoy:
        xs.add(x)
        yl = xtoy.pop(x)
        ret += len(yl)
        for y in yl:
            ret += doit(y, ys, xs, ytox, xtoy)
    return ret

ret = 0
while len(xtoy) > 0:
    x = next(iter(xtoy))
    xs = set()
    ys = set()
    num = doit(x, xs, ys, xtoy, ytox)
    ret += len(xs) * len(ys) - num // 2

print(ret)

Measured memory_bytes: 101280
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  string s;

  cin >> s;
  bool f = false;
  rep(i,0,s.size()){
    if(s[i] == 'C' && f){
      Yes;
      ret 0;
    }
    if(s[i] == 'A')
      f = true;
    else
      f = false;
  }
  No;
  ret 0;
}

Measured memory_bytes: 256
first = str(input())
second = str(input())
"""
def cycleis(start, dici, seen):
    curr = start
    #print("Curr: {}".format(curr))
    while seen[curr] != 1:
        #print("Bent Curr: {}".format(curr))
        seen[curr] = 1
        curr = dici[curr]
        if curr not in seen:
            return True

    if curr == start:
        return True
    else:
        return False
"""
good = True
dici = {}
dici2 = {}
seen = {}
#Check if the same thing goes to the same 
for i in range(0,len(first)):
    if first[i] in dici:
        if second[i] != dici[first[i]]:
            print("No",end='')
            good = False
            #print("A hiba: {} -> {}-ba megy itt meg {}-be kene".format(first[i], dici[i], second[i]))
            break
    else:
        dici[first[i]] = second[i]

    if second[i] in dici2:
        if first[i] != dici2[second[i]]:
            print("No", end='')
            good = False
            break
    else:
        dici2[second[i]] = first[i]

    #if first[i] not in seen:
    #    seen[first[i]] = 0

#print("Seen: {}, Dici: {}".format(seen,dici))
#Final check if a->c->a if c was in first.
"""
for i in dici.keys():
    if cycleis(i, dici, seen) == False:
        print("No", end='')
        good = False
        break"""
"""
for i in dici.keys():
    if dici[i] in dici:
        if dici[dici[i]] != i:
            print("A hiba: {} -> {}-ba megy itt meg {}-be kene".format(i, dici[i], dici[dici[i]]))
            good = False
            print("No", end='')
            break
"""
if good:
    print("Yes",end='')


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int x, y;
    cin >> x >> y;
    cout << x + y / 2 << endl;
    return (0^_^0);
}



Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
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; }

typedef long long ll;
using namespace std;

const int INF = 0x7FFFFFFF;

int main() {
    
    int n, k;
    cin >> n >> k;
    vector<int> h(n, 0);
    REP(i, n) cin >> h[i];

    vector<int> dp(n, INF);
    dp[0] = 0;

    REP(i, n-1)
        for (int j = i+1; j <= i+k; j++)
            if (j < n)
                chmin(dp[j], dp[i] + abs(h[i] - h[j]));

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)

void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a, ll b) { a = min(a, b); }


int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = INT_MAX;
    rep(i, n) {
        int tmp = 0;
        while(a[i] % 2 == 0) {
            a[i] /= 2;
            tmp++;
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
    return 0;

}


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

int main() {
  int N, count;
  cin >> N;
  string S;
  cin >> S;
  count =0;
  for (int i=0; i<N-2 ; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='B'){
        if(S.at(i+2)=='C'){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3600
from itertools import product

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if c[row][col] == '#' and (row_bit[row] and col_bit[col]):
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Measured memory_bytes: 74012
#include <stdio.h>

int main(int argc, char** argv)
{
	int a,b;
	int h,w;
	char field[100][101]={0};
	char cha, chb;
	int i,j,k;
	
	scanf("%d%d", &a, &b);
	
	if( a <= b ){
		cha = '.';
		chb = '#';
	} else {
		cha = '#';
		chb = '.';
		a = a - b;
		b = a + b;
		a = b - a;
	}
	
	if( b < 25 ){
		h = 4; w = b * 4;
	} else {
		h = ((b + 24) / 25)*4; w = 100;
	}
	
	for(j=0;j<h;++j)
		for(k=0;k<w;++k)
			field[j][k] = cha;
	
	for(i=0; i<b; ++i){
		for(j=0; j<3; ++j)
			for(k=0; k<3; ++k)
				field[(i/25)*4 + j][(i%25)*4 + k] = chb;
	}
	
	for(i=0; i<a-1; ++i){
		field[(i/25)*4 + 1][(i%25)*4 + 1] = cha;
	}
	
	printf("%d %d\n", h, w);
	for(i=0;i<h;++i){
		printf("%s\n", field[i]);
	}
	
	return 0;
}

Measured memory_bytes: 128
use std::io::stdin;

fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let n:Vec<char> = st.trim().chars().collect();
    let mut r:Vec<i32> = Vec::new();
    for i in 0..n.len() {
        r.push(n[i] as i32);
        let x:&mut i32 = r.last_mut().unwrap();
        *x -= 48;
    }
    let mut result = 0;
    for i in r {
        result += i;
    };
    if result == 1 {
        result = 10;
    };
    println!("{}", result);
}

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

int main() {
  int n,l;cin>>n>>l;
  vector<int>vec(n);
  int cnt=0;
  rep(i,n){
    vec[i]=l+i;
    cnt+=vec[i];
  }
  int ans1=1e9,ans2=1e9;
  rep(i,n){
    if(abs(vec[i])<ans1){
      ans1=abs(vec[i]);
      ans2=vec[i];
  }
  }
  cout<<cnt-ans2<<endl;
}
      

Measured memory_bytes: 3608
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s; cin >> s;
	bool flg = true;
	for (int i = 0; i <= (int)s.length() - 1; i++) {
		if (i % 2 == 0) {
			if (s[i] == 'L') {flg = false; break;}
		}
		else {
			if (s[i] == 'R') {flg = false; break;}
		}
	}

	cout << (flg ? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 3640
iterater = gets.to_i
team = Array.new(2,0)
iterater.times { |n|  
	outcount = 0
	hitcount = 0
	point = 0
	while outcount < 3
		data = gets.chomp
		case data
		when "HIT"
			hitcount += 1
			if hitcount >= 4
				point += 1
				hitcount = 3
			end
		when "HOMERUN"
			point += hitcount+1
			hitcount = 0
		else
			outcount += 1
		end
	end
	puts point
}

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

int main(){
	int a, b;
	int d, r;
	double f;

	cin >> a >> b;

	d = a / b;
	r = a%b;
	f = (double)a / b;

	cout << fixed << setprecision(6);
	cout << d << " " << r << " " << f << endl;

	return 0;
}

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

int main(){
    vector<int> v = {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};
    int k;
    cin >> k;
    cout << v[k -1] << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))
    
    A.sort()
    ans = 0
    for i in range(N):
        ans += A[2*i]
        
    print(ans)

if __name__ == "__main__":
    main()


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

ll count (string s, int l, int tmp) {
  ll a=0, b=0;
  bitset<12> map(tmp);
  a = s[l-1] - '0';
  //cout << map<<map.test(8)<< endl;
  //cout << s << s.at(l-1) << "   " << a << endl;
  for (ll i=l-2, j=10, k=0; i>=0; --i, j*=10, ++k) {
    //printf("i=%d j=%d a=%d map=%d , ",i ,j , a, map.test(k));
    if (map.test(k) != 0) {
      b += a;
      a = 0;
      j = 1;
     // cout << b << "!  ";
    }
    a += ((s[i] - '0') * j);
  }
  b += a;
  return b;
}
     
int main() {
  ll ans=0;
  int l;
  string s;
  cin >> s;
  l = s.size();
  
  for (int tmp=0; tmp<(1 << (l-1)); ++tmp) {
    bitset<12> a(tmp);
    //cout << a << ' ';
    ans += count(s, l, tmp);
    
  }
  
  cout <<  ans << endl;;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll nCr(ll n, ll r){
    if(r == 0) return 1;
    else if(r == 1) return n;

    else return  nCr(n-1 , r-1) * n/r ;
}
int main()
{
    ll n, m;
    cin>> n >> m;
    cout<< nCr(n, 2) + nCr(m, 2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s;

int main(){
	cin >> s;
	
	bool a,b,c,d; a=b=c=d=false;
	REP(i,0,s.size()){
		if(s[i]=='N') a=true;
		if(s[i]=='W') b=true;
		if(s[i]=='S') c=true;
		if(s[i]=='E') d=true;
	}
	
	cout << (a==c and b==d?"Yes":"No") << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
const int N = 1e5 + 6 ;

int main()
{
    string a , b , c ;
    cin >> a >> b >> c ;
    cout << a[ 0 ] << b[ 1 ] << c[ 2 ] << endl ;

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int s = 0;
  for(int i=0; i<N; i++){
    int l,r;
    cin >> l >> r;
    s += 1+(r-l);
  }
  cout << s << endl;
}
    


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

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

	vector<vector<int>> t(n, vector<int>(n, -1));
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		for (int j = 0; j < a; ++j) {
			int x, y;
			cin >> x >> y;
			t[i][x - 1] = y;
		}
	}

	int m = pow(2, n);
	int mx = 0;
	for (int mask = 0; mask < m; ++mask) {
		int k = 0;
		bool c = false;
		for (int i = 0; i < n; ++i) {
			if ((mask & (1 << i)) == 0) {
				continue;
			}

			++k;
			for (int j = 0; j < n; ++j) {
				if (t[i][j] == -1) {
					continue;
				}

				if ((t[i][j] == 1 && (mask & (1 << j)) == 0) || (t[i][j] == 0 && (mask & (1 << j)) > 0)) {
					c = true;
					break;
				}
			}

			if (c) {
				break;
			}
		}

		if (!c) {
			mx = max(mx, k);
		}
	}

	cout << mx;
	
	return 0;
}
	

Measured memory_bytes: 512
n, m = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


b = make_divisors(m)
# print(b)
a = m//n
# print(a)
ans = 0
for i in b:
    if i <= a:
        ans = i
print(ans)


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

int n, ch[100100][2], cnt; 
long long L, ans;
char s[100100];

void Slve(int x, long long L) {
	if(ch[x][0]) Slve(ch[x][0], L - 1);
	if(ch[x][1]) Slve(ch[x][1], L - 1);
	if((!ch[x][0]) ^ (!ch[x][1])) ans ^= L & -L;
}

int main(void) {
	scanf("%d%lld", &n, &L);
	cnt = 1;
	for(int i = 1; i <= n; i++) {
		scanf("%s", s);
		int m = strlen(s), p = 1;
		for(int i = 0; i < m; i++) {
			int idx = s[i] - '0';
			if(!ch[p][idx]) ch[p][idx] = ++cnt;
			p = ch[p][idx];
		}
	}
	Slve(1, L);
	puts(ans ? "Alice" : "Bob");
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
//template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    ll n,m;
    cin>>n>>m;
    auto f=[](ll l, ll r){return l-(l/2) < r-(r/2);};
    priority_queue<ll, vl, decltype(f)> a(f);
    REP(i,n){
        ll x;
        cin>>x;
        a.push(x);
    }
    REP(i,m){
        ll y=a.top();
        dprint(y,"=>",y/2);
        a.pop();
        a.push(y/2);
    }
    ll sum=0;
    while(a.size()) {sum += a.top(); a.pop();}
    cout<<sum<<endl;
}


Measured memory_bytes: 1400
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();

    if (a+b == c || b+c == a || c+a == b) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }


  }

}


Measured memory_bytes: 21972
/***************************************************************************
 * #######                    #                                            *
 *    #     #    #  ######   # #    #    #   ####   #    #  #    #  #      *
 *    #     #    #  #       #   #   ##   #  #       #    #  #    #  #      *
 *    #     ######  #####  #     #  # #  #   ####   ######  #    #  #      *
 *    #     #    #  #      #######  #  # #       #  #    #  #    #  #      *
 *    #     #    #  #      #     #  #   ##  #    #  #    #  #    #  #      *
 *    #     #    #  ###### #     #  #    #   ####   #    #   ####   ###### *
 ***************************************************************************/
#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
using namespace std;
#define N  105
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll n,m,i,j;
		// cin>>n>>m;
		string a,b;
		cin>>a>>b;
		n=a.length();
		m=b.length();
		ll dp[n+1][m+1];
		pii dp1[n+1][m+1];
		rep(i,0,n+1)
		{
			dp[i][m]=0;
		}
		rep(i,0,m+1)
		{
			dp[n][i]=0;
		}
		for(i=n-1;i>=0;i--)
		{
			for(j=m-1;j>=0;j--)
			{
				ll val;
				if(a[i]==b[j])
					val=1+dp[i+1][j+1];
				else
					val=dp[i+1][j+1];
				dp[i][j]=max(val,max(dp[i+1][j],dp[i][j+1]));
				if(val==dp[i][j])
				{
					dp1[i][j]={i+1,j+1};
				}
				else if(dp[i+1][j]==dp[i][j])
				{
					dp1[i][j]={i+1,j};
				}
				else
				{
					dp1[i][j]={i,j+1};
				}
			}
		}
		ll pi=0,pj=0;
		i=0,j=0;
		while(i<n && j<m)
		{
			if(a[i]==b[j])
				cout<<a[i];
			pi=dp1[i][j].F;
			pj=dp1[i][j].S;
			i=pi;
			j=pj;
		}
		// cout<<dp[0][0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 211328