akhauriyash/Code-Regression huggingface dataset:
/*#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){
    ll n,m,k;cin>>n>>m>>k;
    ll a[m],b[m];rep(i,0,m-1)cin>>a[i]>>b[i];
    ll c[k],d[k];rep(i,0,k-1)cin>>c[i]>>d[i];
    
    
    return 0;
}*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){
    ll n;cin>>n;
    ll m;cin>>m;
    if(n==1 && m==0){
        cout<<0<<endl;
        return 0;
    }
    ll a[n+1];rep(i,1,n)a[i]=-1;
    ll s,c;
    rep(i,1,m){
        cin>>s>>c;
        if(a[s]==-1){
            a[s]=c;
        }else if(a[s]!=c){
            cout<<-1<<endl;
            return 0;
        }
    }
    if(n>1 && a[1]==0){
        cout<<-1<<endl;
        return 0;
    }
    if(a[1]==-1){
        a[1]=1;
    }
    rep(i,1,n){
        if(a[i]==-1){
            a[i]=0;
        }
        cout<<a[i];
    }
    cout<<endl;
    
    return 0;
}





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

int main(int argc, const char * argv[]) {
    int N, M;
    int a[51] = {0};
    
    cin >> N >> M;
    for (int i = 1; i <= M; i++) {
        int ax, bx;
        cin >> ax >> bx;
        a[ax]++;
        a[bx]++;
    }
    
    for (int i = 1; i <= N; i++) {
        cout << a[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
typedef struct mint mint;

const int mod = 1000000007;
struct mint
{
  long long x;
  mint(long long x=0):x(x%mod){}

  mint& operator+=(const mint a)
  {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a)
  {
    (x -= a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const
  {
    if(!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const
  {
    return pow(mod-2);
  }
  mint& operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a)
  {
    mint res(*this);
    return res /= a;
  }
};
struct combination
{
  vector<mint> fact;
  combination(int n):fact(n+1)
  {
    fact[0] = 1;
    for(int i = 1; i < n+1; ++i)
    {
      fact[i] = fact[i-1] * i;
    }
  }

  //n! / r!(n-r)!
  mint comb(int n, int k)
  {
    if(n < 0 || n < k) return 0;

    return fact[n] / (fact[k] * fact[n-k]);
  }
};

int main()
{
  mint ans = 0;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);

  for(int i = 0; i < n; ++i)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  combination c(n+1);
  for(int i = 1; i < n; ++i)
  {
    ans += c.comb(i, k-1) * a[i];
  }
  reverse(a.begin(), a.end());
  for(int i = 1; i < n; ++i)
  {
    ans -= c.comb(i, k-1) * a[i];
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 1408
import math
cin = input()
A = cin.split(' ')[0]
B = cin.split(' ')[1]
H = cin.split(' ')[2]
M = cin.split(' ')[3]

theta_m = int(M)/60 * 2 * math.pi
theta_h = ( int(H)/12 + int(M)/60/12 ) * 2 * math.pi

mx = int(A) * math.cos(theta_m) 
my = int(A) * math.sin(theta_m)
hx = int(B) * math.cos(theta_h) 
hy = int(B) * math.sin(theta_h)

dist = math.sqrt((mx-hx)**2 + (my-hy)**2)

print(dist)

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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < int(k); i++ )
#define FOR(i, a, b) for(int i = (a); i <= int(b); i++)
#define TRAV(a, e) for(auto x : e)

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define INF (int)INT_MAX
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long L;
typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

LL dp[500][500];
LL f(vector<LL> &v, vector<LL> &s, int a, int b) {
    if (a == b) return 0;
    if (dp[a][b] != -1) return dp[a][b];
    LL mini = LONG_LONG_MAX;
    for (int i = a; i < b; i++) {
        mini = min(mini, f(v, s, a, i) + f(v, s, i + 1, b) + s[b+1] - s[a]);
    }
    dp[a][b] = mini;
    return mini;
}

void solve(__attribute__((unused)) int tc = 0) {
    int n;
    LL x;
    vector<LL> v;
    vector<LL> s;
    cin >> n;
    s.pb(0);
    MEM(dp, -1);
    REP(_, n) { cin >> x; v.pb(x); s.pb(s.back() + x); }
    debug(s);
    cout << f(v, s, 0, n - 1) << endl;

    return;
}

int main() {
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    /*int TC;
      cin >> TC;
      REP(tc, TC) {
      solve(tc);
      }*/
    solve();
#ifdef TIME
    cout << "Execution time(second) : " << int(clock() * 1000.0 / CLOCKS_PER_SEC) << " ms" << endl;
#endif
}

Measured memory_bytes: 2304
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  8 09:32:48 2018

@author: maezawa
"""

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

for j in range(n):
    ain = list(map(int, input().split()))
    u = ain[0]
    k = ain[1]
    for i in range(k):
        adj[u-1].append(ain[i+2]-1)
    #print(*adj[u-1])
    
for j in range(n):
    for k in adj[j]:
        a[j][k] = 1
for i in range(n):
    print(*a[i], sep=' ')



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

int main(int argc, char *argv[]) {
	std::string input;
	std::cin >> input;

	input.replace(5, 1, std::string(" "));
	input.replace(13, 1, std::string(" "));

	std::cout << input << std::endl;

	return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;

namespace m_solutions2020_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var K = CIn.ReadInt();
      var A = CIn.ReadIntArray(N);

      for (int i = 0; i < N - K; i++)
      {
        if (A[i] < A[K + i])
        {
          Console.WriteLine("Yes");
        }
        else
        {
          Console.WriteLine("No");
        }
      }
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

using namespace std;

struct P {
	string a;
	int b;
};

int main() {
	int n;
	cin >> n;
	vector<P> p;
	string name;
	int number;
	cin >> name >> number; 
	P ab;
	ab.a = name;
	ab.b = number;
	p.push_back(ab);
	for (int i = 1; i < n; i++) {
		cin >> name >> number;
		bool hantei = true;
		for (int j = 0; j < p.size(); j++) {
			if (p[j].a == name) {
				p[j].b += number;
				hantei = false;
			}
		}
		if (hantei) {
			ab.a = name;
			ab.b = number;
			p.push_back(ab);
		}
	}
	for (int i = p.size()-1; i > 0; i--) {
		for (int j = 0; j < i; j++) {
			if ((p[j].a).size() > (p[j+1].a).size()) {
				swap(p[j], p[j+1]);
			} else if ((p[j].a).size() == (p[j+1].a).size()) {
				for (int k = 0; k < (p[j].a).size(); k++) {
					if ((p[j].a)[k] > (p[j+1].a)[k]) {
						swap(p[j], p[j+1]);
						break;
					}
					if ((p[j].a)[k] != (p[j+1].a)[k]) {
						break;
					}
				}
			}
		}
	}
	for (int i = 0; i < p.size(); i++) {
		cout << p[i].a << " " << p[i].b << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int arr[3];
  arr[0] = a + b;
  arr[1] = a - b;
  arr[2] = a * b;
  sort(arr, arr + 3);
  cout << arr[2] << '\n';
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll x,n=0;string s;cin>>x;
  s=to_string(x);
  rep(i,0,s.size()){
    n+=s[i]-'0';
  }
  if(x%n==0){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    deque<int> deq;
    cin >> N;
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        if(i & 1)deq.push_back(a);
        else    deq.push_front(a);
    }
    if(N & 1){
        for(int i = 0;i < N;i++){
            cout << deq.front() << " ";
            deq.pop_front();
        }
    }else{
        for(int i = 0;i < N;i++){
            cout << deq.back() << " ";
            deq.pop_back();
        }
    }
    cout << endl;
}

Measured memory_bytes: 2944
N =int(input())
num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 10):
    if N % i == 0 and N / i in num:
        count = 1
        break
    else:
        count = 0
if count == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define mod 100000
#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 50010

// [M???][N???][??????=OI,J=0,1][???20???JO???][???,???]
// 20*20*3*(2^20)
int dp[2][2][1<<19]={0};

void dp_init(int k){
    
    for(int i=0;i<2;i++){
        for(int j=0;j<(1<<19);j++){
            dp[k][i][j]=0;
        }
    }
}

int main(){
    int M,N,ans=0,ans2;
    int af_j,af_i;
    char in[20][21];
    int mm[20][20];
    
    scanf("%d%d",&M,&N);
    
    for(int i=0;i<M;i++){
        scanf("%s",in[i]);
    }
    
    for(int i=0;i<M;i++){
        for(int j=0;j<N;j++){
            if(in[i][j]=='?')
                mm[i][j] = -1;
            if(in[i][j]=='J')
                mm[i][j] = 0;
            if(in[i][j]=='O')
                mm[i][j] = 1;
            if(in[i][j]=='I')
                mm[i][j] = 2;
                
        }
    }
    for(int i=0;i<3;i++){
        if(mm[0][0] >= 0) if(i!=mm[0][0]) continue;
        
        dp[0][(i==0)][0]+=1;
    }
    
    for(int m=0;m<M;m++){
        for(int n=0;n<N;n++){
            ans2=0;
            if(m+n==0) continue;
            
            dp_init((m*N+n)%2);
            
            for(int i=0;i<2;i++){
                for(int j=0;j<(1<<(N-1));j++){
                    
                    for(int k=0;k<3;k++){
                        
                        if(mm[m][n] >= 0)
                            if(k!=mm[m][n]) continue;
                        
                        af_j =(j%(1<<(N-2)))*2;
                        
                        af_i = (k==0);
                        
                        if(i==1 && k==1) af_j+=1; //JO
                        
                        if((j>>(N-2))==1 && k==2 && n<N-1){
                            ans2 += dp[(m*N+n+1)%2][i][j];
                        }else{
                            dp[(m*N+n)%2][af_i][af_j] += dp[(m*N+n+1)%2][i][j];
                        }
                        
                        dp[(m*N+n)%2][af_i][af_j]%=mod;
                        ans2%=mod;
                    }
                }
            }
            
            if(mm[m][n]>=0) ans2+=ans;
            else ans2+=ans*3;
            
            ans=ans2%mod;
        }
    }
    
    printf("%d\n",ans);
    
    return 0;
}

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

using namespace std;
using ll=long long;

int main()
{
    int n,m;cin >> n >>m;
    vector<int > a(n,0);
    for(int i=0;i<m;i++){
        int k;cin >>k;
        for(int j=0;j<k;j++){
            int s;cin >>s;s--;
            a[s]|=(1<<i);
        }
    }
    int p=0;
    for(int i=0;i<m;i++){
        int k;cin>>k;
        if(k)p|=k<<i;
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++){
        int t=0;
        for(int j=0;j<n;j++){
            if(i&(1<<j))t^=a[j];
        }
        if(t==p)ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  
  string O,E;
  
  cin >> O >> E;
  
  for(int i = 0;i < O.size();i ++){

    cout << O.at(i);
    
    if(i < E.size()){
      
      cout << E.at(i);
    }
  }
    return 0;
  
}

  


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
#include <cstdint>

uintmax_t comb(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

string s,ans;
int count = 0;
cin >> s;
ans = "CODEFESTIVAL2016";
rep(i,16){
  if(s[i] != ans[i]) count++;
}
cout << count << endl;


//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

#define int ll


const int N = 2e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <ll> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}


void solve() {
    ll x;
    cin >> x;
    cout <<1ll* 1000 * (x / 500) + (x%500/5)*5;
}

main() {
    srand(time(0));
//    ios;
    int tt = 1;
//    cin >> tt;
    while(tt --) {
        solve();
//        brute();
    }
    return 0;
}
/*
2 2
2 1

01
10

01
10
11
*/


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

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

    int cnt = 0;
    int startb = 0;
    int enda = 0;
    int both = 0;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
        for (size_t j = 1; j < s[i].length(); j++)
        {
            if (s[i][j - 1] == 'A' && s[i][j] == 'B')
            {
                cnt++;
            }
        }
        if (s[i][0] == 'B' && s[i][s[i].length() - 1] == 'A')
        {
            both++;
        }
        else if (s[i][0] == 'B')
        {
            startb++;
        }
        else if (s[i][s[i].length() - 1] == 'A')
        {
            enda++;
        }
    }

    bool flg = false;
    if (enda > 0)
    {
        enda--;
        flg = true;
    }
    while (both > 0)
    {
        both--;
        cnt += flg ? 1 : 0;
        flg = true;
    }
    if (startb > 0)
    {
        startb--;
        cnt += flg ? 1 : 0;
        flg = false;
    }
    cnt += min(enda, startb);

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 768
N, x = map(int, input().split())
a = list(map(int, input().split()))
candy = min(a[0], x)
ans = a[0] - candy
a[0] = candy

for i in range(1, N):
    candy += a[i]
    if candy > x:
        m = candy - x
        ans += m
        a[i] -= m
        candy -= a[i - 1] + m
    else:
        candy -= a[i - 1]

print(ans)

Measured memory_bytes: 14540
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		
		List<Integer> H = new ArrayList<>();
		
		for (int i=0; i<N; i++) {
			H.add(sc.nextInt());
		}
		
		Collections.sort(H);
		long ans = 0;
		for (int i=0; i<N - K; i++) {
			ans += H.get(i);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 93576
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int m = scn.nextInt();
		int[] h = new int[n+1];
		for(int i=1; i<=n; i++){
			h[i] = scn.nextInt();
		}
      	int[] a = new int[m];
      	int[] b = new int[m];
      	for(int i=0; i<m; i++){
			a[i] = scn.nextInt();
          	b[i] = scn.nextInt();
		}
      	int[] max = new int[n+1];
      	for(int i=0; i<m; i++){
          max[a[i]] = Math.max(max[a[i]], h[b[i]]);
          max[b[i]] = Math.max(max[b[i]], h[a[i]]);
        }
      	int count = 0;
      	for(int i=1; i<max.length; i++){
          if(h[i]>max[i]) count++;
        }
      	System.out.println(count);
	}
}


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

int main(){

    int h,w;

    cin >> h >> w;

    int table[h][w];

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        table[i][j] = -1;
      }
    }

    char c;

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        cin >> c;
        if(c == 'c'){
          int count = 0;
          for(int k=j;k<w;k++){
            table[i][k] = count++;
          }
        }
      }
    }

    for(int i=0; i<h; i++){
      cout << table[i][0];
      for(int j=1; j<w; j++){
        cout << " " << table[i][j];
      }
      cout << endl;
    }



    return 0;
}

Measured memory_bytes: 3140
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk)
{
  var x = chunk.split(" ");
  x[0] = Number(x[0])
  x[1] = Number(x[1])
  var op = "=="
  if (x[0] < x[1]) {
    op = "<"
  }else if (x[0] > x[1]) {
    op = ">"
  }
  console.log("a " + op + " b");
});

Measured memory_bytes: 15524
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    if (not a%2) or (not b%2) or (not c%2):
        print(0)
    else:
        print(min(a*b, b*c, c*a))
    return

#B
def B():

    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 38512
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<vector>
using namespace std;

int num[10005];

void debugout ( long long value ){
    cout << value  << endl;
}


int main(){

    long double hourLength, minuteLength, hour, minute;
    cin >> hourLength >> minuteLength >> hour >> minute;

    long double PI = 3.141592653589793238462;

    long double theta = 2*PI*( hour/12.0 + minute/720.0 - minute/60.0);

    double length = ( hourLength*hourLength + minuteLength*minuteLength )
            - (long double)2.0 * hourLength * minuteLength * cos(theta);

    printf("%.20lf", sqrt(length));
    return 0;
}





Measured memory_bytes: 4144
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> P(N);
	for (auto& x : P) {
		cin >> x;
		--x;
	}
	vector<long long> C(N);
	for (auto& x : C) {
		cin >> x;
	}

	long long ans = numeric_limits<long long>::min();

	for (int i = 0; i < N; ++i) {
		vector<bool> visited(N, false);
		vector<long long> S;
		int x = i;
		visited[x] = true;
		do {
			x = P[x];
			if (S.empty()) {
				S.push_back(C[x]);
			}
			else {
				S.push_back(S.back() + C[x]);
			}
		} while (x != i);

		const int M = S.size();
		long long result = *max_element(S.begin(), S.begin() + min(M, K));
		if (K >= M && S[M - 1] > 0) {
			int x = K % M;
			if (x == 0) {
				long long result2 = ((K - M) / M) * S[M - 1] + *max_element(S.begin(), S.end());
				result = max(result, result2);
			}
			else {
				long long result3 = (K / M) * S[M - 1] + *max_element(S.begin(), S.begin() + x);
				result = max(result, result3);
			}
		}

		ans = max(ans, result);
	}

	cout << ans << endl;
}


Measured memory_bytes: 3752
#include<iostream>
using namespace std;
int main(){
	long long n;
	cin>>n;
	if(n%2){
		cout<<0;
		return 0;
	}
	long long cnt=0;
	for(long long i=10;i<=n;i*=5)
		cnt+=n/i;
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

int n,m,r;
int a,b,c;
int mp[201][201];
vector<int> v;

void warshall_floyd(){
  repi(k,1,n+1){
    repi(i,1,n+1){
      repi(j,1,n+1){
	mp[i][j]=min(mp[i][j],mp[i][k]+mp[k][j]);
      }
    }
  }
}
signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  rep(i,201)rep(j,201)mp[i][j]=INF;
  rep(i,201) mp[i][i]=0;
  cin>>n>>m>>r;
  rep(i,r){
    int num;
    cin>>num;
    v.push_back(num);
  }
  sort(v.begin(),v.end() );
  rep(i,m){
    cin>>a>>b>>c;
    mp[a][b]=c;
    mp[b][a]=c;
  }
  warshall_floyd();
  int ans=INF,now;
  while(next_permutation(v.begin(),v.end() )){
    now=0;
    rep(i,v.size()-1){
      now+=mp[v[i]][v[i+1]];
    }
    ans=min(ans,now);
  }
  cout<<ans<<endl;
      
  return 0;
}


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

int main() {
    int N; cin >> N;
    function<int(int64, int)> rec = [&](int64 x, int bit) {
        if(x > N) return 0;
        int res = 0;
        if(bit == 7) res++;
        res += rec(10 * x + 3, bit | 1);
        res += rec(10 * x + 5, bit | 2);
        res += rec(10 * x + 7, bit | 4);
        return res;
    };
    cout << rec(0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
arr = [input() for _ in range(h)]

ans = 0
for bit_h in range(2**h):
    for bit_w in range(2**w):
        tmp = 0
        for i in range(h):
            if (bit_h >> i) & 1:
                continue
            for j in range(w):
                if (bit_w >> j) & 1:
                    continue
                if arr[i][j] == '#':
                    tmp += 1
        if tmp == k:
            ans += 1

print(ans)

Measured memory_bytes: 9204
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
  int R[MAX], n;

  cin >> n;
  for ( int i = 0; i < n; i++ ) cin >> R[i];

  int maxv = -2000000000;
  int minv = R[0];
  
  for ( int i = 1; i < n; i++ ) {  // ここで毎回R[i]を読み込めば配列は不要
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}


Measured memory_bytes: 3876
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int cnt=0;
    bool chk=0;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(x==y) cnt++;
        else cnt=0;
        if(cnt==3) chk=1;
    }
    if(chk) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;

map<string,set<int>> p;

int main()
{
    string str;
    int t;
    while (cin >> str >> t) p[str].insert(t);
    for (auto it = p.begin(); it != p.end(); it++) {
        auto s = it->second.begin();
        cout << it->first  << endl << *s;
        for (++s; s != it->second.end(); s++)
            cout << " " << *s;
        cout << endl;
    }

    return 0;
}

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

#define scd second
#define fst first
#define mkp make_pair
#define pb push_back

using namespace std;

typedef long long int ll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

int main(){
	int x, t;
	cin>>x>>t;
	cout<<max(0,x-t)<<endl;
}

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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    int n, k; cin >> n >> k;
    int r, s, p; cin >> r >> s >> p;
    string t; cin >> t;

    V<char> memo(n);
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(k <= i){
            if(t[i] == t[i - k]){
                if(t[i] == 'r'){
                    if(memo[i - k] != 'p'){
                        ans += p;
                        memo[i] = 'p';
                    }else{
                        memo[i] = 's';
                        continue;
                    }
                }
                if(t[i] == 's'){
                    if(memo[i - k] != 'r'){
                        ans += r;
                        memo[i] = 'r';
                    }else{
                        memo[i] = 'p';
                        continue;
                    }
                }
                if(t[i] == 'p'){
                    if(memo[i - k] != 's'){
                        ans += s;
                        memo[i] = 's';
                    }else{
                        memo[i] = 'r';
                        continue;
                    }
                }
            }else{
                if(t[i] == 'r'){
                    ans += p;
                    memo[i] = 'p';
                }
                if(t[i] == 's'){
                    ans += r;
                    memo[i] = 'r';
                }
                if(t[i] == 'p'){
                    ans += s;
                    memo[i] = 's';
                }
            }
        }else{
            if(t[i] == 'r'){
                ans += p;
                memo[i] = 'p';
            }
            if(t[i] == 's'){
                ans += r;
                memo[i] = 'r';
            }
            if(t[i] == 'p'){
                ans += s;
                memo[i] = 's';
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define EQ(a,b) (abs((a)-(b))<EPS)
int d[100];
int tmp[12];
int now[12];
int n;
void copy()
{
	for(int i=0;i<n;i++)
	{
		tmp[i]=now[i];
	}
	return ;
}
int cnt(int x)
{
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(tmp[i]==x)cnt++;
	}
	return cnt;
}
bool check()
{
	bool flag=true;
	for(int i=0;i<n;i++)
	{
		if(now[i]!=tmp[i])flag=false;
	}
	return flag;
}
int main()
{
	while(1)
	{
		int count=0;
		cin >> n;
		if(n==0)break;
		for(int i=0;i<n;i++)
		{
			cin >> now[i];
		}
		while(1)
		{
			copy();
			for(int i=0;i<n;i++)
			{
				now[i]=cnt(tmp[i]);
			}
			if(check())
			{
				break;
			}
			count++;
		}
		cout << count << endl;
		for(int i=0;i<n;i++)
		{
			cout << tmp[i];
			if(i!=n-1)
			{
				cout << ' ';
			}
			else
			{
				cout << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>

using namespace std;

int main(void){
	while( 1 ){
		double w;

		cin >> w;
		if( cin.eof() ) break;
		
		if( w > 91.0 )			puts("heavy");
		else if( w > 81.0 )		puts("light heavy");
		else if( w > 75.0 )		puts("middle");
		else if( w > 69.0 )		puts("light middle");
		else if( w > 64.0 )		puts("welter");
		else if( w > 60.0 )		puts("light welter");
		else if( w > 57.0 )		puts("light");
		else if( w > 54.0 )		puts("feather");
		else if( w > 51.0 )		puts("bantam");
		else if( w > 48.0 )		puts("fly");
		else					puts("light fly");
	}
	return 0;
}

Measured memory_bytes: 0
import math
    

n = int(input(''))

mx=int(math.sqrt(n))+1

fmap = {}

for x in range(1,mx):
    for y in range(1,mx):
        for z in range(1,mx):
            ans = x**2 + y**2 + z**2 + x*y + y*z + x*z
            if ans not in fmap.keys():
                fmap[ans] = 0
            fmap[ans] += 1

for i in range(1,n+1):
    if i in fmap.keys():
        print(fmap[i])
    else:
        print(0)

Measured memory_bytes: 11340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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() {
  int N;
  scanf("%d", &N);
  int dis = 0;
  int ref = 0;
  while(dis<N){
    ref++;
    dis += ref;
  }
  cout << ref << endl;
}



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

using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b == 2 ? a : gcd(b, a % b);};
ll poww(ll a, ll b, ll md) {
   return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}
const int MOD = 1e9+7;
const int SIZE = 1e5+10;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    int val = n/m;
    if(n%m!=0) val = val+1;
    cout<<val*k<<endl;










    return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(),(v).end())
#define RSORT(v) sort((v).rbegin(),(v).rend())
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}



void solve(long long N, long long K, std::vector<long long> a, std::vector<long long> b){

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    ll cnt=0;
    vector<ll> A(100001);
    for(int i = 0 ; i < N ; i++){
        ll a,b;
        cin >> a >> b;
        A[a] = A[a] + b;
    }
    for(int i = 0; i < 100001; i++)
    {
        cnt += A[i];
        if(K <= cnt){
            cout << i << endl;
            return 0;
        }
    }
    
    return 0;
}


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

int main()
{
  int n;
  int d[110];
  cin >> n;
  for (int i = 0; i < n; ++i)
    cin >> d[i];

  int num[110] = {0}; // パケット
  for (int i = 0; i < n; ++i)
  {
    num[d[i]]++;
  }

  int res = 0;
  for (int i = 1; i <= 100; ++i)
  {
    if (num[i])
    {
      ++res;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
a,b = list(map(int, input().split()))
r=[300000, 200000, 100000]
ra=0
if a+b==2:
  print('1000000')
else:
    if a<4:
      ra += r[a-1]
    if b<4:
      ra += r[b-1]
    print(ra)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a[10];
	
	while(scanf("%1d", &a[0])!=EOF){
		for(int i = 1; i < 10; i++){
			scanf("%1d", &a[i]);
		}
		for(int i = 9; i >= 0; i--){
			for(int j = 0; j < i; j++){
				a[j] = (a[j]+a[j+1])-((a[j]+a[j+1])/10)*10;
			}
		}
		cout << a[0] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main()
{
    long long int n;
    scanf("%lld",&n);
    long long int sum = 0;
    for(int i = n ; i > 0 ; i -- )
    {
        sum += (i - 1);
    }
    printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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 long long INF = 1LL << 60;

int main(int argc, char const *argv[]) {
    long long h, x=1,cnt=0;
    cin >> h;
    while(h!=0){
        h=h/2;
        cnt+=x;
        x*=2;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int D, G;
int p[10], c[10];
int ans;

int main()
{
  scanf( "%d%d", &D, &G );
  rep( i, D )
    scanf( "%d%d", p+i, c+i );

  int G2 = G;

  for( int i = D-1; i >= 0; --i )
  {
    rep( j, p[i] )
    {
      ++ans;
      G2 -= 100*(i+1);

      if( G2 <= 0 )
        goto end;
    }
  }  

end:;

  for( int i = 0; i < 1<<D; ++i ) 
  {
    int cnt = 0;

    G2 = G;

    rep( j, D ) if( i >> j & 1 )
    {
      cnt += p[j];
      G2 -= p[j]*100*(j+1)+c[j];
    }

    if( G2 <= 0 )
      ans = std::min( ans, cnt );

    for( int j = D-1; j >= 0; --j ) if( !( i >> j & 1 ) )
    {
      rep( k, p[j] )
      {
        ++cnt;
        G2 -= 100*(j+1);

        if( G2 <= 0 )
        {
          ans = std::min( ans, cnt );
          
          goto end2;
        }
      }
    }

end2:;
  }

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

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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = INT_MAX / 2;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	map<char, bool> alpha;
	alpha['N'] = false;
	alpha['S'] = false;
	alpha['E'] = false;
	alpha['W'] = false;
	rep (i, s.size()) {
		alpha[s[i]] = true;
	}
	string ans = ((alpha['N'] == alpha['S'] && alpha['E'] == alpha['W'])? "Yes" : "No");
	cout << ans << endl;
	return 0;
}



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

char s[100001], t[100001];
int lst[26], nex[100001][26];

int main()
{
    scanf("%s%s", s + 1, t + 1);
    int n = strlen(s + 1), m = strlen(t + 1);
    for (int i = n; i; i--)
        lst[s[i] - 'a'] = i + n;
    for (int i = n; i; i--)
    {
        for (int j = 0; j < 26; j++)
            nex[i][j] = lst[j] - i;
        lst[s[i] - 'a'] = i;
    }
    for (int i = 0; i < 26; i++)
        nex[0][i] = lst[i];
    long long pos = 0;
    for (int i = 1; i <= m; i++)
    {
        if (nex[pos % n][t[i] - 'a'] <= 0) {
            puts("-1");
            return 0;
        }
        pos += nex[pos % n][t[i] - 'a'];
    }
    printf("%lld", pos);
    return 0;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;cin>>n;vector<int> vec;
	for(int i=1;i<=n;i++)
	{
		int x;cin>>x;vec.push_back(x);
	}
	int ans=0;
	for(int i=1;i<n-1;i++)
	{
		if(vec[i]>vec[i-1]&&vec[i]<vec[i+1])
		{
			ans++;
		}
		else if(vec[i]<vec[i-1]&&vec[i]>vec[i+1])
		{
			ans++;
		}
	}
	cout<<ans<<endl;
 } 

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

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

int main()
{
    int H, W;
    cin >> H >> W;
    char grid[H][W];

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> grid[i][j];
        }
    }

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (grid[i][j] == '.')
            {
                continue;
            }
            else if (grid[i][j] == '#')
            {
                int countBlack = 0;
                for (int k = 0; k < 4; k++)
                {
                    int nx = i + dx[k];
                    int ny = j + dy[k];
                    if (nx < 0 || nx >= H || ny < 0 || ny >= W)
                    {
                        continue;
                    }
                    if (grid[nx][ny] == '#')
                    {
                        countBlack++;
                    }
                }
                if (countBlack == 0)
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

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

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

int main(void) {
	char S[27] = { 0 };
	int i, j, len;

	scanf("%s", S);
	len = strlen(S);

	for (i = 0; i < len; i++) {
		for (j = i + 1; j <= len; j++) {
			if (S[i] == S[j]) {
				puts("no");
				return 0;
			}
		}
	}
	puts("yes");

	return 0;
}

Measured memory_bytes: 128
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
string s[200010],g[200010];
int f[200010];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n,tot=0,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>s[i];
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++)
	if(s[i]!=s[i-1])f[++tot]++,g[tot]=s[i];
	else f[tot]++;
	for(int i=1;i<=tot;i++)
	ans=max(ans,f[i]);
	for(int i=1;i<=tot;i++)
	if(f[i]==ans)cout<<g[i]<<"\n";
	return 0;
}


Measured memory_bytes: 15232
import Data.List

main = do
    n <- readLn
    ws <- sequence (take n (repeat getLine))
    let tpl = map (\ws -> (head ws, length ws)) (group (sort ws))
    let ans = [(s,i) | (s,i) <- tpl, i == max' tpl]
    sequence (map putStrLn (map fst ans))

max' :: [(String, Int)] -> Int
max' [x] = snd x
max' (x:xs) = max (snd x) (max' xs)

Measured memory_bytes: 200700
using System;

namespace _20190629_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split(' ');
            var A = int.Parse(AB[0]);
            var B = int.Parse(AB[1]);

            // 13 <= A の場合、B
            // 6 <= A <= 12 の場合、B / 2
            // A <= 5 の場合、B = 0
            if (A <= 5)
            {
                B = 0;
            }
            else if (6 <= A && A <= 12)
            {
                B = B / 2;
            }
            Console.WriteLine(B);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,x;
    cin>>a>>b>>x;
    if(a>x){
        cout<<"NO"<<endl;
        return 0;
    }
    a=x-a;
    if(a<=b){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
}


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

typedef long long ll;
const ll INF = (ll) 2e+18;
const int MAX_N = 200000;

int main() {
	int N;
	ll T, t[MAX_N];

	std::cin >> N >> T;
	for(int i = 0; i < N; ++i) {
		std::cin >> t[i];
	}

	ll ans = T;
	for(int i = 1; i < N; ++i) {
		if(t[i] - t[i - 1] > T) {
			ans += T;
		} else {
			ans += t[i] - t[i - 1];
		}
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
    int key;
    struct Node *right;
    struct Node *left;
    struct Node *parent;
};
void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);

struct Node *root,*NIL;

int main(){
    int n,j,x;
    char St[10];

    scanf("%d",&n);
    for(j=0;j<n;j++){
        scanf("%s%d",St,&x);
        if(strcmp(St,"print")==0){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
        else {
            insert(x);
        }
        
    }
    return 0;
}

void insert(int k){
    struct Node *x=root;
    struct Node *y=NIL;
    struct Node *z;

    z=(struct Node *)malloc(sizeof(struct Node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;

    while(x!=NIL){
        y=x;
        if(z->key < x->key){
            x=x->left;
        }
        else{
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL){
        root=z;
    }
    else{
        if(z->key < y->key){
            y->left=z;
        }
        else{
            y->right=z;
        }
    }
}

void inorder(struct Node *u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(struct Node *u){
    if(u==NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}


Measured memory_bytes: 25172