akhauriyash/Code-Regression huggingface dataset:
fun main(args:Array<String>){
    val(k,a,b)= readLine()!!.split(" ").map{
        it.toLong()
    }
    if(a>=b-2){
        println(k+1)
    }
    else{
        if(k<=a){
            println(k+1)
        }
        else{
            if((k-a)%2==1L){
                println(((k-a)/2+1)*b-(k-a)/2*a)
            }
            else{
                println(((k-a)/2)*b-((k-a)/2-1)*a+1)
            }
        }
    }
}


Measured memory_bytes: 37924
#include <stdio.h>
#include <string.h>
int rot(char *a){
  int s=strlen(a);
  char t=a[0];
  for(int i=0;i<s-1;i++)a[i]=a[i+1];
  a[s-1]=t;
  return 0;
}
int main(){
  char s[101],t[101];
  int f=0;
  scanf("%s %s",s,t);
  for(int i=0;i<strlen(s);i++){
    if(strcmp(s,t))rot(s);
    else f=1;
  }
  puts(f?"Yes":"No");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
 
typedef long long ll;
 
int N,mem;
int A[100010];
int sum[100010] = {0};
int side = 0;
ll D[100010],R[100010];
 
ll power(ll a,ll b)
{
    if(b == 0)return 1;
    ll res = power(a * a % mod,b / 2);
    if(b & 1)res = res * a % mod;
    return res;
}
 
ll con(int a,int b)
{
    if(a < b)return 0;
    return (D[a] * R[b] % mod) * R[a - b] % mod;
}
 
int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N + 1; i++){scanf("%d",&A[i]);sum[A[i]]++;}
    for(int i = 0; i < N + 1; i++)if(sum[i] == 2)mem = i;
    for(int i = 0; i < N + 1; i++)if(A[i] == mem){side += i;break;}
    for(int i = N; i >= 0; i--)if(A[i] == mem){side += N - i;break;}
    ll now = 1;
    for(int i = 0; i < N + 2; i++){D[i] = now;now *= i + 1;now %= mod;}
    for(int i = 0; i < N + 2; i++){R[i] = power(D[i],mod - 2);}
    for(int i = 1; i < N + 2; i++)
    {
        if(i == 1)printf("%d\n",N);
        else
        {
            printf("%lld\n",(con(N + 1,i) - con(side,i - 1) + mod) % mod);
        }
    }
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int x, y; cin >> x >> y;
    for(int i = 0; i <= x; ++i){
        if(i*2 + (x-i)*4 == y){
            yes();
            return 0;
        }
    }
    no();


    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3648
A, B, C, D = map(int, input().split())

def gcd(a, b):
    if a == 0:
        return b
    return int(gcd(b%a, a))

def lcm(a, b):
    return int(a * b / gcd(a, b))

E = lcm(C, D)
ans = (B-A+1) - (B//C - (A-1)//C) - (B//D - (A-1)//D) + (B//E - (A-1)//E)

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pi 3.14159265358979323846
int main(){
	ll n;cin>>n;
	vector<ll> h(n),ans(n,0);
	for(ll i=0;i<n;i++){
		cin>>h[i];
	}

	ans[0]=0;ans[1]=abs(h[1]-h[0]);
	for(ll i=0;i<n-2;i++){
		ans[i+2]=min(ans[i+1]+abs(h[i+2]-h[i+1]),ans[i]+abs(h[i+2]-h[i]));
	}

	cout<<ans[n-1]<<endl;

	return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a'||c == 'e'||c == 'i'||c == 'o'||c == 'u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

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

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int a=s.length();
    int b=t.length();
    int minimum=INT_MAX;
    for(int i=0;i<=(a-b);i++){
        int ans=0;
        for(int j=0;j<b;j++){
            if(s[i+j]!=t[j]){
                ans++;
            }
            
        }
        if(ans<minimum){
                minimum=ans;
            }
    }
    cout<<minimum<<"\n";

    return 0;
}

Measured memory_bytes: 3624
package main

import "fmt"

const NumberOfCities = 5

func main() {
	var n int64
	fmt.Scan(&n)

	durs := make([]int64, 0)
	for i := 0; i < 5; i++ {
		var t int64
		fmt.Scan(&t)
		durs = append(durs, t)
	}

	minCap := durs[0]
	idx := 0
	for i := range durs {
		if durs[i] < minCap {
			minCap = durs[i]
			idx = i
		}
	}
	var groups int64
	if n % minCap == 0 {
		groups = n / minCap
	} else {
		groups = n / minCap + 1
	}
	//time := n(groups) - 1 + hops(end, idx)
	time := groups - 1 + int64(NumberOfCities- idx) + int64(idx)
	fmt.Println(time)
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int h,w,n;
    int num[10010];
    int c[110][110];
    while(scanf("%d%d%d",&h,&w,&n)==3)
    {
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&num[i]);
        }
        memset(c,0,sizeof c);
        int i=0,j=0;
        int m1=1,m2=0;
        for(int k=1;k<=n;k++)
        {
            while(num[k]--)
            {
                c[i][j]=k;
                if(m1)
                {
                    j++;
                    if(j==w)
                    {
                        i++;
                        m1=0;
                        m2=1;
                    }
                }
                if(m2)
                {
                    j--;
                    if(j==-1)
                    {
                        i++;
                        j=0;
                        m1=1;
                        m2=0;
                    }
                }
            }
        }
        for(i=0;i<h;i++)
        {
            for(j=0;j<w;j++)
            {
                if(j)
                {
                    printf(" ");
                }
                printf("%d",c[i][j]);
            }
            printf("\n");
        }
    }
    return 0;
}


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

#define int long long
#define REP(i, l, r) REPEAT(i,l,r,true) // [l, r)
#define rep(i, n) REP(i,0,n)           // [0, n)
#define REPEAT(i, l, r, condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n, l, r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...) true
#define showlr(n,l,r) true
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int, int>;

struct io {
    io() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.tie(0);
        cout << fixed << setprecision(20);
    }
} io;

template<class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &e:v)is >> e;
    return is;
}

template<class T>
ostream &operator<<(ostream &os, vector<T> v) {
    os << "{";
    for (T &e:v)os << e << (v.size() - (int) (&e - &v[0]) > 1 ? ", " : "");
    os << "}";
    return os;
}

void _DEBUG() {}

template<typename H, typename... T>
void _DEBUG(H a, T...b) {
    cerr << a << (sizeof...(b) ? "," : "\n");
    _DEBUG(b...);
}

inline void in() {}

template<typename H, typename... T>
void in(H &a, T &... b) {
    cin >> a;
    in(b...);
}

inline void out() {}

template<typename H, typename... T>
void out(H a, T... b) {
    cout << a << (sizeof...(b) ? " " : "\n");
    out(b...);
}

template<class T>
void resz(int n, T &v) { v.resize(n); }

template<class H, class... T>
void resz(int n, H &a, T &... b) {
    a.resize(n);
    resz(n, b...);
}

template<typename V, typename H>
void resize(vector<V> &v, const H a) { v.resize(a); }

template<typename V, typename H, typename... T>
void resize(vector<V> &v, const H &a, const T... b) {
    v.resize(a);
    for (auto &v:v) resize(v, b...);
}

const int INF = 1LL << 55;
const int MOD = 1000000007;
const double EPS = 1e-8;

/*------------end of definitions------------*/

int N, K, Q;
vi V;

signed main() {

    in(N, K, Q);
    V.resize(N);

    rep(i, Q) {
        int x;
        in(x);
        x--;
        V[x]++;
    }

    for_each(all(V), [](int x) {
        Yn(K - (Q - x) > 0);
    });

    return 0;
}


Measured memory_bytes: 1408
/*
** Author: MAC45
*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
main()
{
    ll N,M,A,day=0;
    cin>>N>>M;
    while(M--)
    {
        cin>>A;
        day+=A;
    }
    if(day>N)
        cout<<-1<<endl;
    else
        cout<<N-day<<endl;
	return 0;
}


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

int notlike[10];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int N,K, temp;
    cin>>N>>K;
    for(int i = 0; i< K; i++){
        cin>>temp;
        notlike[temp] = 1;
    }
    
    int  i, len;
    string s;
    for(i = N; ;i++){
        s = to_string(i);
        len = s.length();
        int flag = true;
        for(int j = 0; j< len; j++){
            if(notlike[s[j] - '0'] == 1){
                flag = false;break;}
        }
        if(flag){
            cout<<i<<endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

R = read_a_int()
from math import pi
print(R * 2 * pi)


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

int main() {
    string iti,ni,san;
    cin >> iti >> ni >>san;
    int a=0;
    int b=0;
    int c=0;
    a=iti.size();
    b=ni.size();
    c=san.size();
    if(iti.at(a-1)==ni.at(0) && ni.at(b-1)==san.at(0)){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
/*
思路：
尺取法，可以发现第i+1个数最小符合条件的右端点一定大于第i个数最小符合条件的右端点，
所以可以存储上一个数最小符合条件的右端点，从这个点开始枚举 
*/
long long a[300100];
int main()
{
	long long n,i;
	cin>>n;
	long long ans=0;
	for(i=1;i<=n;i++)
		cin>>a[i];
	long long j=0,suma=0,sumb=0; 
	for(i=1;i<=n;i++)
	{
		while(j+1<=n && (suma^a[j+1])==sumb+a[j+1])
		{
			suma^=a[j+1];
			sumb+=a[j+1];
			j++;
		}
		ans+=j-i+1; 
		suma^=a[i];
		sumb-=a[i];
	}
	cout<<ans<<endl;
 	return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll k,n;

//moddivとnCk
ll moddiv(ll a,ll b){
	ll x0=MOD,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%MOD;
      if (x2==1LL){
        ans=(n2+MOD)%MOD;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%MOD)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1LL) ans=ans*aa%MOD;
    aa=aa*aa%MOD;
    beki/=2LL;
    if (beki==0LL)break;
  }
  return ans;
}

//nCk
vi mulmod(2000002);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<2000002;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD);
}




int main(){
  ll ans=0;
  first_nCk();
  cin >> k;
  string s;cin>>s;

  n=s.length();
  for(ll i=0;i<=k;i++){
    ans=(ans+expmod(25,k-i)*nCk(n+k,i+n))%MOD;
  }


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

Measured memory_bytes: 20932
import java.util.Arrays;
import java.util.Scanner;
class Main{


	static char[][] map;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力


		int n = sc.nextInt();
		Pair[] pairs = new Pair[n];
		for(int i= 0;i < n;i++){
			Pair pair = new Pair();
			pair.from = sc.nextInt();
			pair.end = sc.nextInt();
			pairs[i] = pair;
		}
		Arrays.sort(pairs);
//		for(int i = 0;i < n;i++){
//			System.out.println(pairs[i].from + " " + pairs[i].end);
//		}
		
		
		int sum = 0;
		for(int i = 0;i < n;i++){
			sum += pairs[i].from;
			if(sum > pairs[i].end){
				
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
		


	}

	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



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




}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   end- otherpair.end;
	}
}




Measured memory_bytes: 102560
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    int n,c=0;
    ll d;
    cin>>n>>d;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d) c++;
    }
    cout<<c;
    return 0;
}


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

int main(void){
    int n = 0, m = 0;
    int a = 0, b = 0;
    int ans[51] = {0};

    scanf("%d%d", &n, &m);

    for(int i = 0; i < m; i++){
        scanf("%d%d", &a, &b);
        ans[a]++;
        ans[b]++;
    }

    for(int i = 1; i<= n; i++){
        printf("%d\n", ans[i]);
    }    

    return 0;

} 


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

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

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<ll,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI psv, ngv;
	ll ans =1;
	rep(i, n){
		ll z; cin >>z;
		if(z < 0) ngv.push_back(z);
		else psv.push_back(z);
		(ans *= (MD + z))%=MD;
	}
	if(n==k){
		cout << ans <<"\n"; return 0;
	}
	ans = 1;
	sort(all(ngv), [](auto l,auto r){return abs(l) < abs(r);});
	sort(all(psv));
	if(sz(psv)==0 && k%2){
		rep(i, k) (ans *= (MD + ngv[i])) %=MD;
		cout << ans <<"\n"; return 0;
	}
	int ixp=sz(psv)-1, ixn=sz(ngv)-1;
	if(k %2) ans = psv[ixp--];
	rep(i, k/2){
		ll smp = ixp<1? -999: 1LL * psv[ixp] * psv[ixp-1];
		ll smn = ixn<1? -999: 1LL * ngv[ixn] * ngv[ixn-1];
		if(smp >= smn){
			(ans *= smp %MD) %=MD; ixp -=2;
		}else{
			(ans *= smn %MD) %=MD; ixn -=2;
		}
		//dbg(i,smp, smn, ans);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 4172
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>
#include <typeinfo>
#include <memory>


using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define fs first
#define sc second


int main(){
    int N;
    int d[101000];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }

    sort(d, d+N);
    int x = d[N/2-1];
    int y = d[N/2];
    cout << y - x  << endl;
    

    return 0;
}


Measured memory_bytes: 640
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  string s;
  int rec = 0, hi = 0;
  while(cin >> s){
    s += ",";
    vector<int> ed;
    string tmp = "";
    rep(i, s.size()){
      if(s[i] == ','){
        ed.pb(stoi(tmp));
        tmp = "";
      }else{
        tmp += s[i];
      }
    }
    if(ed[2] * ed[2] == ed[1] * ed[1] + ed[0] * ed[0]){
      rec++;
    }
    if(ed[0] == ed[1])hi++;
  }
  cout << rec << endl;
  cout << hi << endl;
	return 0;
}



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

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h[i];
    for(int i=1;i<n;i++){
        if(h[i-1]<h[i]){
            --h[i];
        }
    }
    if(is_sorted(h.begin(), h.end() ) ){
        cout<<"Yes\n";
        return 0;
    }
    cout<<"No\n";
    return 0;
}


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

bool f=1;
int n,a[200010];
vector<int> b;

int main()
{
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	
	for(int i=0;i<n;i++)
		if(f) b.push_back(a[i]),f=0; else b.insert(b.begin(),a[i]),f=1;
	
	if(n%2==1) reverse(b.begin(),b.end());
	for(int i=0;i<b.size();i++) cout<<b[i]<<' ';
	
	return 0;
}

Measured memory_bytes: 3828
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            double r = double.Parse(Console.ReadLine());
            double area = r * r * Math.PI;
            double circumference = r * 2d * Math.PI;
            Console.WriteLine(area + " " + circumference);
        }
    }
}


Measured memory_bytes: 15956
using System;

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split();
            var a = long.Parse(input[0]);
            var bs = input[1];
            var b = int.Parse(bs[0].ToString()) * 100
                + int.Parse(bs[2].ToString()) * 10
                + int.Parse(bs[3].ToString());

            long ans = a * b / 100;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 27556
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	int b = scan.nextInt();
      	int product = a * b;
      	if(product % 2 == 1){
        	System.out.print("Odd");
      	}else{
      		System.out.print("Even");
      	}
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0&&b==0)break;
		else{if(a>b)swap(a,b);
			cout<<a<<" "<<b<<endl;
		}
	}
}



Measured memory_bytes: 3076
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    const int64_t L = S.size();
    int64_t K;
    std::cin >> K;

    for (int64_t i = 0; i < L - 1; ++i) {
        // あと何個でaになるか
        int d = ('z' - S[i] + 1) %26;

        if (K >= d) {
            // aできるならaにする
            K -= d;
            std::cout << "a";
        } else {
            // それ以外は悪化するだけなのでそのまま
            std::cout << S[i];
        }
    }

    // 最後調整
    char c = ((S[L-1] - 'a' + K) % 26) + 'a';

    std::cout << c << std::endl;


    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;




//ここから編集する

ll calc(string s){
    int begin,end;
    string num;
    begin = end = 0;
    REP(i,0,s.size()){
        if(s[i] == '+'){
            return stol(num) + calc(s.substr(i+1));
        }else{
            num += s[i];
        }
    }
    return stol(num);
}

int main() {
//    int n;
    string str;
    cin >> str;
    ll ans = 0;
    REP(i,0,(1 << str.size() - 1)){
        string tmp;
        REP(j,0,str.size()){
            tmp += str[j];
            if(i >> j & 1) tmp += '+';
        }
        ans += calc(tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
    string S; cin >> S;
    int res = S.size();
    for(int i=0;i<26;i++){
        int m = 0;
        int c = 0;
        for(auto& s : S){
            if(s == 'a' + i){
                m = max(m, c);
                c = 0;
            } else {
                ++c;
            }
        }
        res = min(res, max(m, c));
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int h,w;
string arr[50];

int main()
{
	cin>>h>>w;
	//memset(marked,0,sizeof(marked));
	for(int i=0;i<h;i++)
		cin>>arr[i];
	vector<int> dist[h*w];
	int d[h*w];
	memset(d, 0,sizeof(d));
	int marked[h*w];
	memset(marked,0,sizeof(marked));
	int c=0;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(arr[i][j]=='.')
		{
				c++;
				if(j<w-1 && arr[i][j+1]=='.')
				{
					dist[i*w+j].push_back(i*w+j+1);
				}
				if(j>0 && arr[i][j-1]=='.')
				{
					dist[i*w+j].push_back(i*w+j-1);
				}
				if(i>0 && arr[i-1][j]=='.')
				{
					dist[i*w+j].push_back((i-1)*w+j);
				}
				if(i<h-1 && arr[i+1][j]=='.')
				{
					dist[i*w+j].push_back((i+1)*w+j);
				}
			}
		}
	}
	queue<int>bfs;
	bfs.push(0);
	//int pl=0;
	while(!bfs.empty())
	{
		int x = bfs.front();
		bfs.pop();
		marked[x]=1;
		
		//pl++;
		for(auto z:dist[x])
		{
			if(marked[z]==0){
				marked[z]=1;
				d[z]=d[x]+1;
				bfs.push(z);
			}
		}

	}
	if(d[(h-1)*w+(w-1)]!=0)
		cout<<c-d[(h-1)*w+(w-1)]-1<<"\n";
	else
		cout<<-1<<"\n";

}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=1e5+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,K,T;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}char a[maxn],b[maxn];
signed main(){
    //file(a);
    scanf("%s%s",a,b);int ans=0;
    // cout<<strlen(a)<<" "<<strlen(b)<<endl;
    rep(i,0,strlen(a)-1){
        int sum=0;
        if(i+strlen(b)-1>strlen(a)-1)break;
        rep(j,0,strlen(b)-1){
            if(a[i+j]==b[j])++sum;
        }ans=max(ans,sum);
    }printf("%d\n",strlen(b)-ans);

    return 0;
}


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

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  swap(X, Y);
  swap(X, Z);
  cout << X << ' ' << Y << ' ' << Z << '\n';
  return 0;
}

Measured memory_bytes: 3572
/*
Author : N_o_o_B
Created : April 22 2020 22:57:50 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    string s;
    cin >> s;
    bool ok = 1;
    vi cnt(4);int i=0;
    for(char c:{'N','S','E','W'}){
        cnt[i] = 0;
        for(char c1:s){
            cnt[i] += (c1 == c);
        }
        cnt[i] = bool(cnt[i]);
        i++;
    }
    ok = !(cnt[0]^cnt[1]);
    ok &= (!(cnt[2]^cnt[3]));
    cout << (ok ? "Yes":"No") << endl;



    time_taken();
    return 0;
}

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

int main()
{
  ll n, limit = 100005;
  cin >> n;
  ll a;
  vector<ll> m(limit);
  for (ll i = 0; i < n; i++)
  {
    cin >> a;
    m.at(a + 1)++;
    if (a != 0)
    {
      m.at(a - 1)++;
    }
    m.at(a)++;
  }
  ll ans = 0;
  for (ll i = 0; i < limit; i++)
  {
    ans = max(ans, m.at(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 4052
N,M,K=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))

for i in range(N):
    A[i+1]+=A[i]
for i in range(M):
    B[i+1]+=B[i]

idx=N
ans=0
for i in range(N):
    if A[i]>K:
        idx=i-1
        break

idx2=0
for i in range(idx,-1,-1):
    while idx2<M and A[i]+B[idx2+1]<=K:
        idx2+=1
    ans=max(ans,i+idx2)

print(ans)


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

int main() {
int n,t1=0,h1=0;
std::string t,h;
std::cin>>n;
while(n--){
	std::cin>>t>>h;
	if(t<h){
		h1+=3;
	}else if(t>h){
		t1+=3;
	}else{
		h1++;
		t1++;
	}
}
std::cout<<t1<<" "<<h1<<"\n";
}

Measured memory_bytes: 3140
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
ll dp[3001][3001];
ll mod = 998244353;
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, c, d, i, j;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for(i = a; i <= c; i++) {
        for(j = b; j <= d; j++) {
            if(i == a && j == b) {
                continue;
            }
            dp[i][j] = dp[i-1][j] + dp[i][j-1];
            dp[i][j] += dp[i-1][j]*(j-1) + dp[i][j-1]*(i-1) - dp[i-1][j-1]*(i-1)*(j-1);
            dp[i][j] = dp[i][j] % mod;
            if(dp[i][j] < 0) {
                dp[i][j] += mod;
            }
        }
    }
    cout << dp[c][d]<< "\n";
}

Measured memory_bytes: 73840
#include <stdio.h>
int main()
{
    int N, i, x, y, z;
    scanf ("%d", &N);
    if (N>0 && N<=1000){
        for (i=1; i<=N; i++){
            scanf ("%d %d %d", &x, &y, &z);
            if (x>=y && x>=z) {
                if ((x*x)==((y*y)+(z*z)))printf ("YES\n");
                else printf ("NO\n");
            }
            else if (y>=x && y>=z){
                if ((y*y)==((x*x)+(z*z)))printf ("YES\n");
                else printf ("NO\n");
            }
            else if (z>=x && z>=y){
                if ((z*z)==((y*y)+(x*x)))printf ("YES\n");
                else printf ("NO\n");
            }
        }
    }
    return 0;
}

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

struct Node{
	int pos, val;
};

int a[250010];
Node w[505];

bool cmp(const Node& x, const Node& y){
	return x.pos < y.pos;
}

int main(){
	int n, p, cnt;
	scanf("%d",&n);
	memset(a, 0, sizeof(a)); 
	for (int i = 1; i <= n; i++){
		scanf("%d",&w[i].pos);
		w[i].val = i;
		a[w[i].pos] = i;
	}
	sort(w + 1, w + n + 1, cmp);
	p = 1;
	for (int i = 1; i <= n; i++){
		cnt = 0;
		while (p < w[i].pos && cnt < w[i].val - 1){
			if (!a[p]){
				a[p] = w[i].val;
				cnt++;
			}
			p++;
		}
		if (cnt < w[i].val - 1){
			printf("No\n");
			return 0;
		}
	}
	p = n * n;
	for (int i = n; i >= 1; i--){
		cnt = 0;
		while (p > w[i].pos && cnt < n - w[i].val){
			if (!a[p]){
				a[p] = w[i].val;
				cnt++;
			}
			p--;
		}
		if (cnt < n - w[i].val){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	for (int i = 1; i <= n * n; i++){
		printf("%d", a[i]);
		if (i < n * n) printf(" ");
		else printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int n;
char op[2];
char ans[3];
int num[4];
int sum=0;
int cont=0;
void Dfs(int x){
	if (x==3&&sum==7&&!cont){
		printf("%d%c%d%c%d%c%d=%d\n",num[0],ans[0],num[1],ans[1],num[2],ans[2],num[3],sum);
		cont++;
		return;
	}
	else if (x==3)
		return;
	for(int i=0;i<2;i++){
		if (i==0)
			sum+=num[x+1];
		else
			sum-=num[x+1];
		ans[x] = op[i];
		Dfs(x+1);
		if (i==0)
			sum-=num[x+1];
		else
			sum+=num[x+1];
	}
	return;
}
int main(){
	op[0]='+';
	op[1]='-';
	cin >> n;
	num[3] = n%10;
	num[2] = (n%100)/10;
	num[1] = (n%1000)/100;
	num[0] = n/1000;
	sum=num[0];
	Dfs(0);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define MAX 25
#define NIL -1

using namespace std;

typedef struct Node {
    int parent;
    int left;
    int right;
} Tree;

Tree tree[MAX];

void inorder(int a);
void preorder(int a);
void postorder(int a);

int main(void) {
    int n, a, left, right, root = 0, i;
      cin >> n;
    for (i = 0; i < n; i++) {
        tree[i].parent = NIL;
    }
    for (i = 0; i < n; i++) {
        cin >> a >> left >> right;
        tree[left].parent = a;
        tree[right].parent = a;
        tree[a].left = left;
        tree[a].right = right;
    }
    for (i = 0; i < n; i++) {
        if (tree[i].parent == NIL) {
            root = i;
            break;
        }
    }
    cout << "Preorder" << endl;
    preorder(root); cout << endl;
    cout << "Inorder" << endl;
    inorder(root); cout << endl;
    cout << "Postorder" << endl;
    postorder(root); cout << endl;
  
    return 0;
}

void inorder(int a) {
    if (tree[a].left != NIL) inorder(tree[a].left);
    cout << " " << a;
    if (tree[a].right != NIL) inorder(tree[a].right);
    return;
}

void preorder(int a) {
    cout << " " << a;
    if (tree[a].left != NIL) preorder(tree[a].left);
    if (tree[a].right != NIL) preorder(tree[a].right);
    return;
}

void postorder(int a) {
    if (tree[a].left != NIL) postorder(tree[a].left);
    if (tree[a].right != NIL) postorder(tree[a].right);
    cout << " " << a;
    return;
}




Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define NMAX 52
using namespace std;
int N, M, T, k, K, t, w, x, y, i , j;
long long A[401], dp[401][401], sum[401][401];
pii operator + (pii a, pii b) {
    return mp(a.first + b.first, a.second + b.second);
}

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        dp[i][i] = 0;
    }
    for (int i = 0; i < N; ++i) {
        sum[i][i] = A[i];
        for (int j = i + 1; j < N; ++j)
            sum[i][j] = A[j] + sum[i][j - 1];
    }
    for (int k = 1; k < N; ++k) {
        for (int i = 0; i < N - k; ++ i) {
            dp[i][i + k] = min(dp[i][i + k - 1] + sum[i][i + k - 1] + A[i + k], dp[i + 1][i + k] + sum[i + 1][i + k] + A[i]);
            for (int j = i + 1; j < i + k - 1; ++j) {
                dp[i][i + k] = min (dp[i][i + k], dp[i][j] + sum[i][j] + dp[j + 1][i + k] + sum[j + 1][i + k]);
            }
        }
    }
    cout << dp[0][N - 1];
    return 0;
}

Measured memory_bytes: 2816
s = list(input())
q = int(input())
r = 0
first = []
last = []

for i in range(q):
    query = list(input().split())

    if query[0] == "1":
        r = (r+1) % 2
        continue

    if r == 0:
        if query[1] == "1":
            first.append(query[2])
        else:
            last.append(query[2])
    else:
        if query[1] == "1":
            last.append(query[2])
        else:
            first.append(query[2])

first.reverse()
ans = first + s + last

if r == 1:
    ans.reverse()

print("".join(ans))

Measured memory_bytes: 15688
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <map>

enum Dir {
  NORTH, WEST, SOUTH, EAST
};
const size_t dx[]={0, size_t(-1), 0, 1};
const size_t dy[]={1, 0, size_t(-1), 0};

template <class Graph>
void add_edge(Graph &g, size_t xs, size_t ys, size_t xe, size_t ye) {
  if (xs == xe) {
    if (ys > ye)
      std::swap(ys, ye);

    for (size_t y=ys; y<ye; ++y)
      g[xs][y][NORTH] = true;
    for (size_t y=ys+1; y<=ye; ++y)
      g[xs][y][SOUTH] = true;
  } else {
    if (xs > xe)
      std::swap(xs, xe);

    for (size_t x=xs; x<xe; ++x)
      g[x][ys][EAST] = true;
    for (size_t x=xs+1; x<=xe; ++x)
      g[x][ys][WEST] = true;
  }
}

struct Car {
  size_t step, x, y;
  Dir d;
  Car(size_t s, size_t x, size_t y, Dir d): step(s), x(x), y(y), d(d) {}
};

int main() {
  size_t n, x0, y0, t;
  scanf("%zu %zu %zu %zu", &n, &x0, &y0, &t);

  std::vector<std::vector<std::vector<bool>>> g(
      51, std::vector<std::vector<bool>>(
        51, std::vector<bool>(4)));

  for (size_t i=0; i<n; ++i) {
    size_t xs, ys, xe, ye;
    scanf("%zu %zu %zu %zu", &xs, &ys, &xe, &ye);
    add_edge(g, xs, ys, xe, ye);
  }

  std::map<int, Dir> dir;
  std::map<char, Dir> c2d;
  c2d['N'] = NORTH;
  c2d['E'] = EAST;
  c2d['W'] = WEST;
  c2d['S'] = SOUTH;
  size_t dd=0;
  for (size_t i=0; i<t; ++i) {
    size_t d;
    char c;
    scanf("%zu %c", &d, &c);
    dd += d;
    dir[dd] = c2d[c];
  }

  std::vector<std::vector<std::vector<std::vector<int>>>> dp(
      dd+1, std::vector<std::vector<std::vector<int>>>(
        51, std::vector<std::vector<int>>(
          51, std::vector<int>(4, -1))));

  std::queue<Car> q;
  for (int i=0; i<4; ++i) {
    q.emplace(0, x0, y0, Dir(i));
    dp[0][x0][y0][i] = 1;
  }
  while (!q.empty()) {
    Car car=q.front();
    size_t s=car.step, x=car.x, y=car.y;
    Dir d=car.d;
    q.pop();
    // fprintf(stderr, "%zu: (%zu, %zu), %c\n", s, x, y, "NWSE"[size_t(d)]);

    for (size_t k=0; k<4; ++k) {
      size_t nx=x+dx[k], ny=y+dy[k];

      if (!(nx <= 50 && ny <= 50)) continue;
      if (!g[x][y][k]) continue;
      if ((d^2) == Dir(k)) continue;  // U-turn
      
      if (dir.find(car.step) != dir.end()) {
        // found
        if (d != dir[car.step] && Dir(k) != dir[car.step])
          continue;
      }
      if (s <= dd) {
        dp[s][x][y][d] = 1;
      }

      if (s+1 <= dd && dp[s+1][nx][ny][k] < 0) {
        q.emplace(s+1, nx, ny, Dir(k));
        dp[s+1][nx][ny][k] = 1;
      } else if (s == dd) {
        // fprintf(stderr, "%zu: (%zu, %zu), %c\n", s, x, y, "NWSE"[k]);
        dp[s][x][y][k] = 1;
      }
    }
  }

  for (size_t x=0; x<=50; ++x)
    for (size_t y=0; y<=50; ++y)
      if (dp[dd][x][y][dir[dd]] > 0)
        printf("%zu %zu\n", x, y);
}



Measured memory_bytes: 105456
# -*- coding utf-8 -*-
N=int(input())
S=list(str(input()))
ans=0
ansl=[]
for i in range(N):
    if S[i]=="I":
        ans+=1
    else:
        ans-=1
    ansl.append(ans)


ansl.append(0)
print(max(ansl))


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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> a(n),b(n);
    vector<pair<int,int>> ab(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0; i < n; i++){
        ab[i] = make_pair(a[i], b[i]);
    }
    
    sort(ab.begin(),ab.end());
    ll ans = 0;
    
    for(int i = 0; i < n; i++){
        int buy = min(m,ab[i].second);
        ans += (ll) buy * ab[i].first;
        m -= buy;
    }
    cout << ans;
}




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

using namespace std;

int main(){
	int n,k;
	int count[101]={0};
	cin>>n>>k;
	int num,d;
	for(int i=0;i<k;i++){
		cin>>d;
		for(int j=0;j<d;j++){
			cin>>num;
			count[num]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(count[i]==0)	ans++;
	}
	cout<<ans<<endl;
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
#define log2(x) (log(x)/log(2))
#define ln '\n'
#define bln(i,n) ((i==n-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b, k;
set<int> s;

signed main() {
	cin >> a >> b >> k;
	repst(i,a,min(a+k-1,b)) s.insert(i);
	reprt(i,b,max(a,b-k+1)) s.insert(i);
	each(i,s) cout << i << ln;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> v(N + 1), w(N + 1);
    REP(i, N) cin >> v[i+1] >> w[i+1];

    vector<vector<int>> dp(N+1, vector<int>(W+1));

    FOR(i, 1, N) {
        REP(j, W+1) {
            if(j - w[i] >= 0) dp[i][j] = max(dp[i][j-w[i]] + v[i], dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


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

int main(){
    int A , B; cin >> A >> B;
    int X = 0;
    while(true) {
        float a = 0.08*X,b = 0.1*X;
        if (B <= b && b < B + 1 && A <= a && a < A + 1){
            cout << X;
            return 0;
        } else if (B + 1 <= b) {
            cout << -1;
            return 0;
        }
        X++;
    }
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int q;
bool vis[1111111];

int dfs(int n,int d){
	if(n<10)return d;
	if(vis[n])return -1;
	vis[n]=true;
	string s=to_string(n);
	int res=0;
	rep(i,s.length()-1){
		maxch(res,stoi(s.substr(0,i+1))*stoi(s.substr(i+1,s.length()-i-1)));
	}
	return dfs(res,d+1);
}

int main(){
	cin.sync_with_stdio(false);
	cin>>q;
	rep(i,q){
		int n;
		cin>>n;
		memset(vis,0,sizeof(vis));
		cout<<dfs(n,0)<<endl;
	}
	return 0;
}

Measured memory_bytes: 4368
#include<bits/stdc++.h>
using namespace std;
const int t[4]={1,4,7,9};
int main()
{
    int a[4],flag[4];
    for(int i=0;i<4;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+4);
    int ans=1;
    for(int i=0;i<4;i++){
        ans&=(a[i]==t[i]);
    }
    if(ans){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc156/tasks/abc156_a
// math
import std.stdio;

void main() {
    int n, r;
    readf("%s %s\n", &n, &r);

    if(n >= 10)
        r.writeln;
    else
        writefln("%s", r+100*(10-n));
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int rd(){
    int a=0;char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))a=(a<<1)+(a<<3)+(ch^48),ch=getchar();
    return a;
}
ll rdll(){
    ll a=0;char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))a=(a<<1)+(a<<3)+(ch^48),ch=getchar();
    return a;
}

const int N=100005;

int n,k;

int main(){
	n=rd();k=rd();
	if((n+1)/2>=k)printf("YES");else printf("NO");
	return 0;
}

Measured memory_bytes: 256