akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define N 1005
using namespace std;

const int inf = 1e7;
char grid[N][N];
priority_queue<tuple<int,int,int>> q;
int dist[N][N], n, m, cx, cy, dx, dy;

bool isok(int i, int j){
    return (i>=1 && j>=1 && i<=n && j<=m && grid[i][j] != '#');
}

int main(){
    fastio();
    cin >> n >> m;
    cin >> cx >> cy;
    cin >> dx >> dy;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> grid[i][j];
            dist[i][j] = inf;
        }
    }

    dist[cx][cy] = 0;
    q.push({-dist[cx][cy],cx,cy});

    int x, y, d;
    int a[4] = {0,0,1,-1}, b[4] = {1,-1,0,0};
    while(q.size()){
        tie(d,x,y) = q.top(); q.pop();
        d*=-1; 
        
        for(int i=0;i<4;i++){
            if(isok(x+a[i],y+b[i]) && dist[x+a[i]][y+b[i]]>d){
                dist[x+a[i]][y+b[i]] = d;
                q.push({-dist[x+a[i]][y+b[i]],x+a[i],y+b[i]}); 
            }
        }

        for(int i=-2;i<=2;i++){
            for(int j=-2;j<=2;j++){
                if(isok(x+i,y+j) && dist[x+i][y+j]>d+1){
                    dist[x+i][y+j] = d+1;
                    q.push({-dist[x+i][y+j],x+i,y+j});
                }
            }
        }
        
    }
    
    if(dist[dx][dy]==inf)
        dist[dx][dy] = -1;

    cout << dist[dx][dy] <<'\n';

    return 0;
}

Measured memory_bytes: 8676
S = input()

S1 = S[0::2]
S2 = S[1::2]

S1_0 = S1.count("0")
S1_1 = S1.count("1")
S2_0 = S2.count("0")
S2_1 = S2.count("1")

#101010
ans1 = S1_0 + S2_1
#010101
ans2 = S1_1 + S2_0

print(min(ans1,ans2))

Measured memory_bytes: 9112
n,k = map(int,input().split())
x = [0 for _ in range(n+1)]
for i in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        if x[a] == 0:
            x[a] = 1
print(len(x) - sum(x) - 1)

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

vector<int> Zalgorithm(string S) {
  vector<int> A(S.size());
  A[0] = S.size();
  int i = 1, j = 0;
  while(i < (int)S.size()) {
    while(i+j < (int)S.size() && S[j] == S[i+j]) j++;
    A[i] = j;
    if(j == 0) { i++; continue; }
    int k = 1;
    while(i+k < (int)S.size() && k+A[k] < j) A[i+k] = A[k], k++;
    i += k, j -= k;
  }
  return A;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string S, T;
  cin >> S >> T;
  int n = S.size(), m = T.size();
  string rS = S, rT = T;
  reverse(all(rS));
  reverse(all(rT));
  string Z = T+S, rZ = rT+rS;
  auto A = Zalgorithm(Z);
  auto rA = Zalgorithm(rZ);

  int ans = 0;
  rep(i, n-m+1) {
    if(n-i-m < 0) continue;
    if(min(m, A[i+m])+min(m, rA[n-i]) == m-1) ans++;
  }
  cout << ans << endl;

  return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
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;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;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;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////

void in(map<ll,ll>&mp){
    ll n;cin>>n;
    while(n--){
        ll t;cin>>t;
        mp[t]++;
    }
}

int main(){fastio
    map<ll,ll>m1,m2;
    in(m1);
    in(m2);
    for(auto x:m2){
        if(m1[x.fi]<x.se){
            cout<<"NO";exit(0);
        }
    }
    cout<<"YES";
    
    return 0;
}


Measured memory_bytes: 25216
#include<bits/stdc++.h>
#define ll long long 
#define MM(arr,x) memset(arr,x,sizeof(arr))
#define INF 0x3f3f3f3f
#define Maxn 1e5+10;
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	string s;
	int ans = 0, cnt = 0;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='R')
		{
			cnt++;
		}
		else cnt = 0;
		ans = max(ans,cnt);
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll dp[2][100001];
vector<vector<int> > v(100001);
void dfs(int n,int p){
    ll w=1,sum=1;
    for(auto& i:v[n]){
        if(i!=p){
            dfs(i,n);
            w=(w*dp[0][i])%mod;
            sum*=(dp[0][i]+dp[1][i])%mod;
            sum%=mod;
        }
    }
    if(w==0&&sum==0){
        w=sum=1;
    }
    dp[0][n]=sum;
    dp[1][n]=w;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a,b;
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        a--;b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    //memset(dp,0,sizeof(dp));
    dfs(0,-1);
    cout << (dp[0][0]+dp[1][0])%mod<<endl;
    return 0;
}


Measured memory_bytes: 14208
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    char a, b;
    cin >> a >> b;
    if(a == 'H' && b == 'H'){
        cout << 'H' << endl;
    }
    if(a == 'H' && b == 'D'){
        cout << 'D' << endl;
    }
    if(a == 'D' && b == 'H'){
        cout << 'D' << endl;
    }
    if(a == 'D' && b == 'D'){
        cout << 'H' << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll N; cin >> N;
	ll res = (N / 11) * 2;
	ll n = N - (res/2) * 11;

	if (n > 6) res += 2;
	else if (n != 0) ++res;
	
	std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    int n;
    cin >> n;
    int k, p = 1, ans = 0;
    cin >> k;
    for (int i = 0; i < n-1; ++i) {
        int x;
        cin >> x;
        if(x == k) p++;
        else {ans += p/2; p = 1;}
        k = x;
    }
    ans += p/2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V
 
getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]
 
type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)
 
mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
fi = fromInteger
fig = fromIntegral
rf = realToFrac
 
(.<.) f g -- combination
    | f < g = 0 
    | g < 1 || f < 1 = 1
    | True = foldr1 (*) (take g [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
comb = (.<.)
combWp = (.>.)
 
unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)
 
mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a
 
countIf f = length . filter f
 
-- 
--
--

main = do
  [n, m] <- getIs
  let max = div m n
  putStrLn . show . head $ filter (\x -> mod m x == 0) [max, max - 1..1]


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;

int main()
{
    fastio;
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int count = 0;
    for (int a = 0; a <= A; ++a)
    {
        for (int b = 0; b <= B; ++b)
        {
            for (int c = 0; c <= C; ++c)
            {
                int total = (a * 500) + (b * 100) + (c * 50);
                if (total == X)
                {
                    count++;
                }
            }
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())

ga,sa,ba = map(int,input().split())

gb,sb,bb = map(int,input().split())

g = gb - ga
s = sb - sa
b = bb - ba

lis = [[g,ga],[s,sa],[b,ba]]
lis.sort()

plnum = 0

for i in lis:
    if i[0] > 0:
        plnum += 1

if plnum == 3:

    nexN = N

    for i in range(N // ga +1 ):

        amariA = N - ga * i

        for j in range(amariA // sa + 1):

            amariB = amariA - sa * j
            k = amariB // ba

            nexN = max(nexN , N + g*i + s*j + b * k)

    N = nexN

elif plnum == 2:

    nexN = N

    for i in range(N // lis[2][1] + 1):

            amariB = N - lis[2][1] * i
            j = amariB // lis[1][1]

            nexN = max(nexN , N + lis[2][0] * i + lis[1][0] * j)

    N = nexN

elif plnum == 1:
    
    N += (N // lis[2][1]) * lis[2][0]

#print (N)

g = ga - gb
s = sa - sb
b = ba - bb

lis = [[g,gb],[s,sb],[b,bb]]
lis.sort()

plnum = 0

for i in lis:
    if i[0] > 0:
        plnum += 1

if plnum == 3:

    nexN = N

    for i in range(N // gb +1 ):

        amariA = N - gb * i

        for j in range(amariA // sb + 1):

            amariB = amariA - sb * j
            k = amariB // bb

            nexN = max(nexN , N + g*i + s*j + b * k)

    N = nexN

elif plnum == 2:

    nexN = N

    for i in range(N // lis[2][1] + 1):

            amariB = N - lis[2][1] * i
            j = amariB // lis[1][1]

            nexN = max(nexN , N + lis[2][0] * i + lis[1][0] * j)

    N = nexN

elif plnum == 1:
    
    N += (N // lis[2][1]) * lis[2][0]

print (N)




Measured memory_bytes: 42684
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<double, double>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007LL;

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

	int ans = 1;

	if (x < 600) {
		ans = 8;
	} else if (x < 800) {
		ans = 7;
	} else if (x < 1000) {
		ans = 6;
	} else if (x < 1200) {
		ans = 5;
	} else if (x < 1400) {
		ans = 4;
	} else if (x < 1600) {
		ans = 3;
	} else if (x < 1800) {
		ans = 2;
	} else if (x < 2000) {
		ans = 1;
	}
	cout << ans << endl;


	

	return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 30;

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  cout << (e - a <= k ? "Yay!" : ":(") << endl;
}


Measured memory_bytes: 256
#/usr/bin/env python

n = int(input())
w = input().split()

for i,j in enumerate(w):
    w[i] = int(j)

min = 100 * (n+1)
for i in range(len(w)):
    tmp = abs(sum(w[0:i+1]) - sum(w[i+1:n]))
    if tmp < min:
        min = tmp
print(min)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n,c=0;
	cin>>n;
	c+=n/11*2;
	n=n%11;
	if(n>=7)c+=2;
	else if(n>0)c++;
	cout<<c<<endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int m,n;
int l[100][100];
bool used[100][100];

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

int dfs(int h, int w, int n){
	int ret = -1;
	for (int i = 0;i < 4;i++){
		int nh = h+dy[i], nw = w+dx[i];
		if(!used[nh][nw] && l[nh][nw] == 1){
			used[h][w] = true;
			ret = max(ret,dfs(nh,nw,n+1));
			used[h][w] = false;
		}
	}
	if(ret == -1) return n;
	else return ret;
}

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

	while(true){
		cin >> m >> n;
		if(m == 0) break;

		for (int i = 0;i < n;i++){
			for (int j = 0;j < m;j++){
				cin >> l[i][j];
			}
		}
		memset(used,0,sizeof(used));
		int ans = -1;
		for (int i = 0;i < n;i++){
			for (int j = 0;j < m;j++){
				if(l[i][j] == 1) ans = max(ans,dfs(i,j,1));
			}
		}
		cout << ans << endl;
	}

	return 0;

}



Measured memory_bytes: 3164
#a,b = [int(x) for x in input().split()]
s = input()
sl=list(s)
N = len(sl)
k = 0
for i in range(int((N-1)/2)):
  if sl[i] != sl[N-i-1]:
    k = 1
    break
if k == 0:
  for i in range(int((N-1)/4)):
    if sl[i] != sl[int((N-1)/2-i-1)]:
      k = 1
      break
if k == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3188
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

LL n, k;
LL ans = 0;

int main() {
	cin >> n >> k;
	if (k == 0) {
		cout << n*n << endl;
		return 0;
	}
	for (int b = 1; b <= n; b++) {
		if (b > k) {
			ans += n / b*(b - k);
			if (n%b >= k)ans += n%b - (k - 1);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, A, B, C, X;
    while(cin >> N >> A >> B >> C >> X, N != 0){
        int flame = 0;
        for(int i = 0; i < N; i++){
            int Y; cin >> Y;
            while(flame++ <= 10000){
                if(X == Y) {
                    X = (A * X + B) % C;
                    break;
                }
                X = (A * X + B) % C;
            }
        }
        if(flame-1 > 10000) flame = 0;
        cout << flame-1 << endl;
    }
}



Measured memory_bytes: 3088
#include <iostream>
using namespace std;
int main()
{
	char x;
	cin >> x;

	if (x == 'A')
		cout << 'T';

	if (x == 'T')
		cout << 'A';

	if (x == 'G')
		cout << 'C';

	if (x == 'C')
		cout << 'G';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb              push_back
#define fast_in_out     ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
int main()
{
    fast_in_out
    string s;
    cin>>s;
    vector<char>con;
    for(int i=0;i<(int)(s.size());i++){
        if(s[i]=='B'){
            if(!con.empty())con.pop_back();
        }
        else con.pb(s[i]);
    }
    for(auto it=con.begin();it!=con.end();it++)cout<<*it;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<char,int>;

const ll MOD = INF + 7;


int main(){
   double w, h, x, y;
   cin >> w >> h >> x >> y;
   cout << (double)(w * h / 2) << " ";
   if(w == 2 * x && h == 2 * y)cout << 1;
   else cout << 0;
}



Measured memory_bytes: 3756
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main() {
    fast;
    ll l,r, o = 30000; cin>>l>>r;
    for(int q=0; q<3000 && l<r; l++, q++){
        for(ll w=0, u = l+1; w<3000 && u<=r; w++, u++) o = min(o, ((l%2019)*(u%2019))%2019);
    }
    cout<<o;
}

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

using namespace std;

int main(){
  int n,d;
  int cnt = 0;
  cin >> n >> d;
  vector <vector < int > > x(n+1,vector < int> (d));
  for(int i = 0; i < n ; i++){
    for(int j = 0 ; j < d ; j++){
      cin >> x[i][j];
    }
  }

  for(int j = 0 ; j < d ; j++){
    x[n][j] = x[0][j];
  }

  for(int i = 1 ; i < n ; i++){
    for(int k = 0 ; k < i ; k++){
      double leng = 0;
      for(int j = 0 ; j < d ; j++){
        leng += pow((x[i][j] - x[k][j]),2);
      }
      if(ceil(sqrt(leng)) == floor(sqrt(leng))){
        cnt++;
      }
    }
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
int cnt = 0;
//vector< vector<ll> > ans;
//vector< vector<bool>> v;
vector<vector<ll>> vac;
/*ll vacation(int N,int i){
  if(N==0){
      return vac[N][i];
  }
  for(int j=0;j<3;j++){
    if(ans[N-1][j]==-1){
      cnt++;
      ans[N-1][j] = vacation(N-1,j);
    }
  }
  for(int j=0;j<3;j++){
    if(i!=j){
      ans[N][i] = max(vac[N][i]+ans[N-1][j],ans[N][i]);
    }
  }
  return ans[N][i];
}*/
int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
  ll N;
  cin>>N;
  //ans.resize(N);
  vac.resize(N);

  for(int i=0;i<N;i++){
    //ans[i].resize(3);
    vac[i].resize(3);
  }/*
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      ans[i][j] = -1;
    }
  }*/
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin>>vac[i][j];
      //cout<<vacation[i][j]<<" ";
    }
  }
  for(int i=1;i<N;i++){
    vac[i][0] = max(vac[i][0]+vac[i-1][1],vac[i][0]+vac[i-1][2]);
    vac[i][1] = max(vac[i][1]+vac[i-1][0],vac[i][1]+vac[i-1][2]);
    vac[i][2] = max(vac[i][2]+vac[i-1][0],vac[i][2]+vac[i-1][1]);     
  }
  /*ll final_ans = vacation(N-1,0);

  final_ans = max(final_ans,vacation(N-1,1));
  final_ans = max(final_ans,vacation(N-1,2));

  cout<<final_ans<<endl;
  cout<<cnt<<endl;
  */
  ll final_ans = max(vac[N-1][0],max(vac[N-1][1],vac[N-1][2]));
  cout<<final_ans<<endl;
  //cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
  
  return 0;
  /*
  for(int i=0;i<1e5;i++){
    cout<<i+1<<endl;
  }*/

}


Measured memory_bytes: 8684
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

int main() {
	int k, s;
	cin >> k >> s;
	int ans = 0;
	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			int z = s - x - y;
			if (0 <= z && z <= k) {
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,cy = t,x,y
print('Yes')

Measured memory_bytes: 17312
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        String s = scan.next();


        char[] cs = s.toCharArray();
        cs[k-1] = (char) (cs[k-1] - ('A' - 'a'));
        String ns = new String(cs);
        System.out.print(ns);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG


#define M 10010;

int main() {
  ll N, m, ans, sum;
  cin >> N >> m;

  sum = 0;

  for(ll i = 0; i<m; i++){
    ll a;
    cin >> a;
    sum +=a;
  }

  if(N >= sum) ans= N - sum;
  else ans = -1;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
# 全探索可能
# 座標の候補は101 * 101 通り *100座標ぶんなので。
# 0の場合どうするか
# 0以外で候補を列挙して、あとで合ってるか検証(方針合ってた)


def abs(key):
    if key < 0:
        return -key
    else:
        return key


n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())
pos_max = 100  # 座標のmaxを定義
for posY in range(pos_max+1):
    for posX in range(pos_max+1):
        # needHは頂上がであるか判定する用
        # -1だとまだよくわからん
        # -2だと頂上ではない
        needH = -1
        # print("hoge", "posX", "posY", posX, posY)
        for i in range(n):
            if h[i] > 0:
                # この頂点からみて頂上がposX、posYの時
                # 頂上の高さを求める。
                tmp = h[i] + abs(posX-x[i]) + abs(posY-y[i])
                # print(i, "tmp", tmp)
                # print("h[i]", h[i], "x[i]", x[i], "y[i]", y[i])
                if needH == -1:
                    needH = tmp
                else:
                    if needH != tmp:
                        needH = -2
                        break
        # print(posX, posY, needH)
        # exit()
        if needH == -2:
            continue  # ダメだったら別の場所を探す
        # 高さが0の場合のチェック
        for i in range(n):
            if h[i] == 0:
                dist = abs(posX-x[i]) + abs(posY-y[i])
                if needH > dist:
                    needH = -2
                    break
        if needH == -2:
            continue
        print("{} {} {}".format(posX, posY, needH))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    std::vector<int> v((n+2));
    for (int i = 0; i < n; i++) {
        cin>>v[i];
    }
    set<int>set1;
    map<int, int>mp1,mp2;
    for (int i = 0; i < n; i++) {
        int diff = i-v[i];
        //dump(diff);
        set1.insert(diff);
        if(diff != i)
             mp1[diff]++;
    }
    ll int cnt = 0;
    for (int i = 0; i < n; i++) {
        int sum = (i+v[i]);
        //dump(sum);
        if(set1.count(sum)){
            mp2[sum]++;
            //cnt++;
        }
    }
    for(auto it : mp1){
        cnt +=((ll)it.second * mp2[it.first]);
    }
    cout<<cnt<<"\n";
    return 0;
}


Measured memory_bytes: 29996
#include <unistd.h>
#include <algorithm>

#define N 1000000
#define K 1000
const int mod = 998244353;

int n;
long long int A[N+1];

char ibuf[1600100];
char *ibufe = ibuf-1;

void readall(){
  int k, t = 0;
  while((k=read(STDIN_FILENO, ibuf+t, sizeof(ibuf)-t))>0) t += k;
}

int read_uint(){
  int x=0;
  while(*(++ibufe) <'0');
  do {
    x *= 10;
    x += *ibufe-'0';
  } while(*(++ibufe) >='0');
  return x;
}

char buf[20];
char *bufe = buf;

void write_uintll(long long int x){
  int i;
  static char tmp[14];
  if(x==0){
    *bufe++ = '0';
    *bufe++ = '\n';
    return;
  }

  for(i=0; x; i++){
    tmp[i] = '0' + x % 10;
    x /= 10;
  }
  for(i--; i >= 0; i--){
    *bufe++ = tmp[i];
  }
  *bufe++ = '\n';
}

void writeall(){
  int k, t = 0;
  while((k=write(STDOUT_FILENO, buf+t, bufe-buf-t))>0) t += k;
}


/*
\sum_{i<j} lcm(Ai,Aj)
\sum_{i<j} Ai Aj / gcd(Ai,Aj)
\sum_{d} 1/d \sum_{i<j: gcd(Ai, Aj) = d} Ai Aj

f(d) = \sum_{i,j: gcd(Ai, Aj) = d} Ai Aj
F(d) = \sum_{i,j: d | gcd(Ai, Aj)} Ai Aj
F(d) = \sum_{i,j: d | Ai, d | Aj)} Ai Aj
F(d) = (\sum_{i: d | Ai} Ai)^2
\sum_{d} 1/d \sum_{n: d|n} m(n/d) F(n)
\sum_{n} F(n) \sum_{d: d|n} 1/d m(n/d)
\sum_{n} F(n)/n \sum_{d: d|n} n/d m(n/d)
\sum_{n} F(n)/n \sum_{d: d|n} d m(d)
\sum_{d: d|n} d m(d) = \sum_{d: p|d|n} d m(d) + \sum_{d: d|n/p^k} d m(d)
= \sum_{d: d|n/p^k} pd m(pd) + \sum_{d: d|n/p^k} d m(d)
= \sum_{d: d|n/p^k} d m(d) - pd m(d)
=(1-p0)(1-p1)...(1-pm)

[1    0    0] Z [1 0 0]
[0 2^-1    0]   [0 2 0]
[0    0 3^-1]   [0 0 3]
*/


template<int M>
struct const_arrs {
  constexpr const_arrs() : phi(), primes(), ps() {
    phi[1] = 1;
    for(int i=2;i<=M;i++){
      if(!phi[i]){
        phi[i] = mod+1-i;
        for(int j=2*i;j<=M;j+=i){
          if(phi[j]) phi[j] = (long long) phi[j] * (mod+1-i) % mod;
          else phi[j] = mod+1-i;
        }
        primes[ps++] = i;
      }
      phi[i] = (long long) phi[i] * i % mod;
    }
  }
  int phi[M+1];
  int primes[80000];
  int ps;
};
constexpr const_arrs<N> C{};

int main(){
  int r, s;
  
  readall();
  n = read_uint();
  s = 0;
  for(int i=0;i<n;i++){
    int x = read_uint();
    A[x]++;
    s += x;
    if(s >= mod) s -= mod;
  }

  for(int j=0;j<std::min(K, C.ps);j++){
    int p = C.primes[j];
    for(int i=N/p; i; i--){
      A[i] = (A[i] + (long long) p*A[i*p]);
    }
  }
  for(int j=std::min(K, C.ps);j<C.ps;j++){
    int p = C.primes[j];
    for(int i=N/p; i; i--){
      A[i] = (A[i] + (long long) p*A[i*p]) % mod;
    }
  }
  r = mod-s;
  for(int i=1;i<=N;i++){
    r = (r + (long long) A[i] * A[i] % mod * C.phi[i]) % mod;
  }

  write_uintll(r&1?(r+mod)/2:r/2);
  writeall();

  return 0;
}


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

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    LL x,y,ans=1;
    int i,k,n,ng,np;
    vector<LL>pos,neg;
    const LL mod=1e9+7;
    cin >> n >> k;
    for(i=0;i<n;i++)
    {
        cin >> x;
        if(x < 0)neg.emplace_back(x);
        else pos.emplace_back(x);
    }
    ng=neg.size();
    np=pos.size();
    sort(neg.rbegin(),neg.rend());
    sort(pos.begin(),pos.end());
    if(ng == 0)
    {
        while(k--)
        {
            ans=(ans*pos.back())%mod;
            pos.pop_back();
        }
    }
    else if(np == 0)
    {
        if(k & 1)
        {
            for(i=0;i<k-1;i++)ans=(ans*abs(neg[i]))%mod;
            ans*=neg[k-1];
            ans%=mod;
            if(ans < 0)ans+=mod;
        }
        else
        {
            while(k--)
            {
                ans=(ans*abs(neg.back()))%mod;
                neg.pop_back();
            }
        }
    }
    else
    {
        if(k & 1)ans=pos[--np],--k;
        while(k > 1  &&  (np > 1  ||  ng > 1))
        {
            x=y=0;
            if(np > 1)x=pos[np-1]*pos[np-2];
            if(ng > 1)y=neg[ng-1]*neg[ng-2];
            if(x > y)
            {
                np-=2;
                x%=mod;
                ans=(ans*x)%mod;
            }
            else
            {
                ng-=2;
                y%=mod;
                ans=(ans*y)%mod;
            }
            k-=2;
        }
        while(k--)
        {
            if(np > 0)ans=(ans*pos[--np])%mod;
            else ans=((ans*neg[--ng])%mod+mod)%mod;
        }
    }
    cout << ans;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;

const int mx=1e5+777;
vector<vector<ii>> adj(mx);
vector<int> col(mx,-1), deg(mx,0);
int n;

void doit(int cur, int par, int used) {
	int it=0;
	for (auto nxt : adj[cur]) {
		if(nxt.first==par) continue;
		if(it==used) it++;
		col[nxt.second]=it;
		doit(nxt.first,cur,it);
		it++;
	}
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>n;
	for (int i=0; i<n-1; i++) {
		int a,b; cin>>a>>b; a--; b--;
		adj[a].push_back({b,i});
		adj[b].push_back({a,i});
		deg[a]++; deg[b]++;
	}
	
	int mx=*max_element(deg.begin(),deg.end());
	doit(0,-1,-1);
	cout<<mx<<"\n";
	for (int i=0; i<n-1; i++)
		cout<<col[i]+1<<"\n";
	return 0;
}

Measured memory_bytes: 9856
n = int(input())
s = []
sum = 0

for i in range(n):
    s.append(list(map(str,input().split())))
for i in range(n):
    s[i][0] = float(s[i][0])
for i in range(n):
    if s[i][1] == 'JPY':
        sum += s[i][0]
    elif s[i][1] == 'BTC':
        sum = sum + s[i][0] * 380000

print (sum)


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  double n;
  cin >> n;
  int m = ceil(n,2);
  double ans = m / n;
  printf("%.10f", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll pans(int lv, ll n) {
	if (lv == 0) {
		return 1;
	}
	if (n == 1) {
		return 0;
	}
	ll all = (1LL << (lv + 2)) - 3;
	ll mid = all / 2 + 1;
	if (n < mid) {
		return pans(lv - 1, n - 1);
	} else if (n == mid) {
		return pans(lv - 1, n - 2) + 1;
	} else {
		return ((1LL << lv) - 1) + 1 + pans(lv - 1, n - mid);
	}
}
int main() {
	ll n, x;
	cin >> n >> x;
	cout << pans(n, x) << endl;
	return 0;
}

Measured memory_bytes: 3592
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main() {
    fast;
    int a,b,c; cin>>a>>b>>c;
    cout<<min(a*b, c);
}

Measured memory_bytes: 256
import sys
import numpy as np
H, W = map(int, input().split())
I = np.array([list(map(str, input())) for _ in range(H)])
grid = np.zeros([H,W], np.int16)
grid[np.where(I=='#')] = 1
inf = np.inf
dp = np.full([H,W], inf)
if grid[0,0] == 1:
    dp[0,0] = 1
else:
    dp[0,0] = 0

for i in range(H):
    for j in range(W):
        if i + 1 < H:
            if grid[i,j] == grid[i+1,j]:
                dp[i+1,j] = min(dp[i+1,j], dp[i,j])
            else:
                dp[i+1,j] = min(dp[i+1,j], dp[i,j]+1)
        if j + 1 < W:
            if grid[i,j] == grid[i,j+1]:
                dp[i,j+1] = min(dp[i,j+1], dp[i,j])
            else:
                dp[i,j+1] = min(dp[i,j+1],dp[i,j]+1)
if grid[-1,-1] == 1:
    dp[-1,-1,] += 1
ans = dp[-1,-1]//2
print(int(ans))


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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INF = 1000000007;
const ll MOD = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i<3; i++)
    {
        if(s[i] == 'R')
        {
            int j = i;
            while(j < 3 && s[j] == s[i])
            {
                j++;
            }
            ans = max(ans, j-i);
            i = j;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
AC
次数で見る
*/

ll d[5]={},cnt=0,deg[10]={};
vector<ll> v[5];
bool ok=true;

int main(void){
	rep(i,3){
		ll a,b;
		cin>>a>>b;
		v[a-1].push_back(b-1);
		v[b-1].push_back(a-1);
	}
	rep(i,4)deg[v[i].size()]++;
	cout<<(deg[2]==2 && deg[1]==2?"YES":"NO")<<endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s == "SAT") cout << "1" << endl;
    if (s == "FRI") cout << "2" << endl;
    if (s == "THU") cout << "3" << endl;
    if (s == "WED") cout << "4" << endl;
    if (s == "TUE") cout << "5" << endl;
    if (s == "MON") cout << "6" << endl;
    if (s == "SUN") cout << "7" << endl;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

inline void chmin(ll &x, ll y) { if (x > y) x = y; }

const int maxn = 512;
const ll INF = TEN(18);

ll A[maxn][maxn];
ll dp[maxn][maxn];
ll s[2][maxn][maxn];

ll get(int tp, int a, int b, int c, int d) { //sum a <= x <= c, b <= y <= d
	return s[tp][c+1][d+1] - s[tp][c+1][b] - s[tp][a][d+1] + s[tp][a][b];
}

int main() {
	int N; cin >> N;
	rep(i, N) {
		rep(j, N) {
			if (i != j) cin >> A[i][j];
			int tp = (i > j);
			rep(t, 2) {
				s[t][i+1][j+1] = s[t][i+1][j] + s[t][i][j+1] - s[t][i][j];
				if (t == tp) {
					s[t][i+1][j+1] += A[i][j];
				}
			}
		}
	}

	rep(i, maxn) rep(j, maxn) dp[i][j] = INF;
	
	for (int i = 1; i < N; ++i) {
		dp[i][0] = get(0, 0, 0, i-1, i-1);
	}

	for (int i = 1; i < N; ++i) {
		for (int j = 1; j < i; ++j) {
			rep(k, j) {
				chmin(dp[i][j], dp[j][k] + get(0, j, j, i-1, i-1) + get(1, i, k, N-1, j-1));
			}
		}
	}

	ll ans = s[0][N][N];

	for (int i = 1; i < N; ++i) {
		rep(j, i) {
			chmin(ans, dp[i][j] + get(0, i, i, N-1, N-1));
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8448
n, k = map(int, input().split())
sx, sy = [], []
for i in range(n):
    x, y = map(int, input().split())
    sx.append((x, i))
    sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
    px[i] = cx

acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in enumerate(sy):
    for cx in range(n):
        acm[cx][cy] = acm[cx - 1][cy] + acm[cx][cy - 1] - acm[cx - 1][cy - 1] + int(px[i] == cx)

ans = 5e18
for lcx in range(n - k + 1):
    for lcy in range(n - k + 1):
        acm_l = acm[lcx - 1][lcy - 1]
        for ucx in range(lcx + k - 1, n):
            for ucy in range(lcy + k - 1, n):
                if acm[ucx][ucy] - acm[ucx][lcy - 1] - acm[lcx - 1][ucy] + acm_l >= k:
                    ans = min(ans, (sx[ucx][0] - sx[lcx][0]) * (sy[ucy][0] - sy[lcy][0]))
                    break
print(ans)


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


int main(){
  string s;
  cin >> s;
  int n=s.size();
  for(int i=0;i<n;++i){
    cout << 'x';
    if(i==n-1){
      cout << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a,b,k;
  cin >> a >> b >> k;
  if (b-a+1 >= 2*k) {
    for (int i = a; i < a+k; i++) {
      cout << i << "\n";
    }
    for (int i = b-k+1; i <= b; i++) {
      cout << i << "\n";
    }
  } else {
    for (int i = a; i <= b; i++) {
      cout << i << "\n";
    }
  }
  return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

ll x;

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int K;
    int N;
    cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    
    int lar = 0;
    for (int i = 0; i < N-1; i++)
    {
        lar = max(lar, A[i+1] - A[i]);
    }
    lar = max(lar, K - A[N-1] + A[0]);

    cout << K - lar << "\n";
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>          // printf(), scanf()

int
main(int argc, char** argv)
{
	int a, b;

	while (scanf("%d %d", &a, &b) != EOF)
	{
		int c = a + b;

		int count = 0;
		do
		{
			count++;
			c /= 10;
		} while (c != 0);

		printf("%d\n", count);
	}

	return 0;
}

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

int main() {
	int n = 1;
	cin >> n;
	vector<int> p(n) ;
	for(int i = 0; i < n; ++i) {
		cin >> p[i];
	}
	int count = 0;
	for(int i = 1; i < n - 1; ++ i) {
		vector<int> c(3);
		c[0] = p[i - 1];
		c[1] = p[i];
		c[2] = p[i + 1];
		sort(c.begin(), c.end());
		if(c[1] == p[i]) {
			count += 1;
		}
	}
	cout << count << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#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=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const int MOD=1000000007;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin>>a>>b>>c;
	cout<<min(c, b/a)<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;
const  ll NUM=10e8+7;


int main(){
  string N;
  cin>>N;

  if(N[(int)N.size()-1]=='s'){
  cout<<N<<"es"<<endl;
  }
  else{
    cout<<N<<"s"<<endl;
  }

  
 
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define pb push_back
#define eb emplace_back
#define sz(a) (int)a.size()
#define all(c) c.begin(),c.end()
#define FOR(i,a,b) for(i=a; i<b; i++)
#define FORR(i,a,b) for(i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define x first
#define y second
#define mp make_pair

const int INF = 1000000007;
const long long INFLL = (ll)INF * (ll)INF;

int32_t main()
{
	IOS;
	int s,w;
	cin>>s>>w;
	if(w>=s)
	{
		cout<<"unsafe";
	}
	else
	{
		cout<<"safe";
	}
	return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll LL_INF = LLONG_MAX;
const long double PI = (acos(-1));
const ull MOD = 1000000007;


struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];

    ll arai = 0;
    for(ll a : A) arai += a;
    ll snuke = 0;
    ll min_n = LL_INF;
    for(int i = 0; i < N - 1; i++){
        snuke += A[i];
        min_n = min(min_n, abs(arai - 2 * snuke));
    }
    cout << min_n << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	long long r,d,x;cin>>r>>d>>x;
	rep(i,10){
	x=r*x-d;
	cout<<x<<endl;
	}
}

Measured memory_bytes: 256