akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace x
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            System.Console.WriteLine(t.Remove(s.Length) == s ? "Yes" : "No");

        }
    }
    
    static class IOUtils
    {
        public static (int a, int b) Read2Ints()
        {
            var vals = ReadInts();
            return (vals[0], vals[1]);
        }
        public static (int a, int b, int c) Read3Ints()
        {
            var vals = ReadInts();
            return (vals[0], vals[1], vals[2]);
        }
        public static IEnumerable<int[]> ReadIntLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadInts();
            }
        }
        public static IEnumerable<long[]> ReadLongLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadLongs();
            }
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        public static ulong ReadUlong()
        {
            return ulong.Parse(Console.ReadLine());
        }
        public static int[] ReadInts()
        {
            return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
        }

        public static void WriteNums(params int[] nums)
        {
            Console.WriteLine(string.Join(" ", nums));
        }
    }
}


Measured memory_bytes: 25784
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;

pair<int,int> ed[5555];
int n,m;
int uni[55];

int uni_find(int x)
{
	return uni[x]==x?x:uni_find(uni[x]);
}

int unio(int x,int y)
{
	int a=uni_find(x),b=uni_find(y);
	if(a==b) return 0;
	uni[a]=b; return 1;
}

bool ok(int x)
{
	for(int i=1;i<=n;i++) uni[i]=i;
	int got=0;
	for(int i=0;i<m;i++)
	{
		if(i==x) continue;
		got+=unio(ed[i].F,ed[i].S);
	}
	return got<n-1;
}

int main()
{
	cin >> n >> m;
	for(int i=0;i<m;i++)
		cin >> ed[i].F >> ed[i].S;
	int ans=0;
	for(int i=0;i<m;i++)
		ans+=ok(i);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    double n = N;
    double ans = ((n + (N%2)) / 2.0) / n;
    printf("%.8lf\n", ans);
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc072/tasks/arc082_a

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(auto it = c.begin(); it != c.end(); it++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int A_I_MAX = 1e5;

int N;
int a[N_MAX];

map<int, int> mp;

void add(int v) {
  if (mp.count(v) == 0) mp[v] = 1;
  else mp[v]++;
}

void solve() {
  REP(i, N) FOR(j, -1, 1) add(a[i] + j);
  int ans = 0;
  ITR(mp, it) ans = max(ans, it->second);
  printf("%d\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", a + i);
}

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


Measured memory_bytes: 5120
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 long double x;
  cin >> x;

 long double s=100;
 ll ans=0;
 while(s<x){
  s*=1.01;
   s=floor(s);
   ans++;
 }

  cout << ans << endl;
}

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

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int dp[1005][1005];

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

    int ans = k;
    rep(i, 0, n - 1)
        ans *= k - 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
St2=[[1],[0,1]]
2.upto(1000){|n|St2<<[0,*St2[-1].each_cons(2).map.with_index(1){|(x,y),k|x+y*k},1]}
a,b=gets.split.map &:to_i
p (0..b).map{|k|St2[a][k].to_i}.reduce(0,:+)%(10**9+7)



Measured memory_bytes: 239936
#include <stdio.h>
int main(void){
    int h,a,l,l2;
    scanf("%d%d",&h,&a);
    l = h/a;
    l2 = h%a;
    if(l2 == 0){
    printf("%d",l);
    }else{
    printf("%d",l+1);
    }
}

Measured memory_bytes: 256
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    string S;
    ll Q;
    int T, F;
    char C;
    int way = 1; //1: normal, -1: reverse
    deque<char> v;

    cin >> S;
    for(ll i = 0; i < S.length(); i++){
        v.push_back(S[i]);
    }

    cin >> Q;
    for(ll i = 0; i < Q; i++){
        cin >> T;
        if(T == 1){
            way *= -1;
        }else{
            cin >> F >> C;
            if((F == 1 && way == 1) || (F == 2 && way == -1)){
                v.push_front(C);
            }else{
                v.push_back(C);
            }
        }
    }

    if(way == 1){
        for(ll i = 0; i < v.size(); i++){
            cout << v[i];
        }
    }else{
        for(ll i = 0; i < v.size(); i++){
            cout << v[v.size() - i - 1];
        }
    }

    cout << endl;


    return 0;
}


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

int main(){
    double L;
    cin >> L;
    printf("%.7f\n",pow(L/3,3));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF ((1e9)+10000)
#define N 5005
using namespace std;
int n,k,a[N],memo[N][N],minsum[N],ans;
bool used[N][N],used2[N];

int dfs(int x,int sum){
  if(sum>=k)return sum;
  if(x==n)return INF;
  if(used[x][sum])return memo[x][sum];
  used[x][sum]=1;
  int res=INF;
  res=min(res,dfs(x+1,sum+a[x]));
  minsum[x]=min(minsum[x],res);
  res=min(res,dfs(x+1,sum));
  return memo[x][sum]=res;
}

int main(){
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a[i];
    minsum[i]=INF;
  }
  dfs(0,0);
  for(int i=0;i<n;i++)
    if(minsum[i]-a[i]>=k)ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 122880
#include <stdio.h>

int main() {
 
 int a=0,b=0,c=0,son=0;
 
 scanf("%d %d %d",&a,&b,&c);
 
    while(b >= a){
        b = b - a;
        son++;
        if(son == c){
            break;
        }
    }
    printf("%d\n",son);
    return 0;
}

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

int main() {
  int N, Alice, Bob, i;
  Alice = Bob = 0;
  cin >> N;
  vector<int> card(N);
  
  for(i=0; i<N; i++){
    cin >> card.at(i);
  }
  
  if(N % 2 != 0){
    card.push_back(0);
  }
  
  sort(card.begin(),card.end(),greater<int>());
  
  for(i=0; i<N; i+=2){
    Alice += card.at(i);
    Bob += card.at(i+1);
  }
  
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 2e5 + 9, M = 3e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

ll pre[N];

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int n, m, l, r;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    pre[l]++;
    pre[r+1]--;
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    pre[i] += pre[i-1];
    if(pre[i] == m)
      ++cnt;
  }
  cout << cnt;
  return 0;
}


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

int main(void) {
    map<string, int> weekday{
        {"SUN", 7},
        {"MON", 6},
        {"TUE", 5},
        {"WED", 4},
        {"THU", 3},
        {"FRI", 2},
        {"SAT", 1},
    };

    string S;

    cin >> S;
    cout << weekday[S] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int sum;
  while(1){
    cin >> s;
      sum = 0;
    for(int i=0;i<s.size();i++){
      sum += s.at(i) - '0';
    }
    if(sum!=0) cout << sum << endl;
    else break;
  }
}



Measured memory_bytes: 3224
S = input()
Flags = [False] * 4
for s in S:
    if "N" == s:
        Flags[0] =True
    elif "S" == s:
        Flags[1] =True
    elif "W" == s:
        Flags[2] =True
    elif "E" == s:
        Flags[3] =True

if all(Flags) or (Flags[0] and Flags[1] and not Flags[2] and not Flags[3]) or \
        (Flags[2] and Flags[3] and not Flags[0] and not Flags[1]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s;
    int w,i;
    cin>>s;
    cin>>w;
    for (i=0;i<s.size();i+=w)
        cout<<s[i];
}

Measured memory_bytes: 256
import Data.List (group)

-- | Generates the sequence of prime numbers.
-- Based on <http://qiita.com/little_Haskeller/items/614a3ae20a517c19bb1f this article> .
primes2 :: Integral a => [a]
primes2 = map fromIntegral primes2'
    where
        primes2' = [2, 3, 5] ++ sieve2 5 7 (drop 2 primes2')
        sieve2 m s (p : ps) = [n | n <- ns, gcd m n == 1] ++ sieve2 (m * p) (p * p) ps
            where ns = [x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4]]

-- | Factorizes the given integer using 'primes2'.
-- Based on <https://wiki.haskell.org/Testing_primality this page>.
factorize2 :: Integral a => a -> [a]
factorize2 1 = []
factorize2 n = factorize2' n primes2
    where
        factorize2' n ps@(p : pr)
            | p * p > n    = [n]
            | m == 0       = p : factorize2' d ps
            | otherwise    = factorize2' n pr
            where (d, m) = divMod n p

solve :: Int -> Int
solve l = (`div` 2) $ (1 +) $ product $
    map (\ek -> 2 * ek + 1) $ map length $ group $ factorize2 l

main :: IO ()
main = putStr . unlines . map show .
    map solve . takeWhile (/= 0) . map read . lines =<< getContents

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

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

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

ll a[1000];
ll b[1000];
ll c[1000];
ll t_sum[1000000];
ll sum[3000000];

int main(){
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  REP(i, x) cin >> a[i];
  REP(i, y) cin >> b[i];
  REP(i, z) cin >> c[i];
  sort(a, a+x, greater<ll>());
  sort(b, b+y, greater<ll>());
  sort(c, c+z, greater<ll>());
  REP(i, x) REP(j, y) t_sum[i*y+j] = a[i]+b[j];
  sort(t_sum, t_sum+x*y, greater<ll>());
  REP(i, min(3000, x*y)) REP(j, z) sum[i*z+j] = t_sum[i]+c[j];
  sort(sum, sum+min(3000, x*y)*z, greater<ll>());
  REP(i, k) cout << sum[i] << endl;
  return 0;
}

Measured memory_bytes: 31488
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        a: f64, b: f64, x: f64,
    }

    let radian = if a*a*b > 2.0*x {
        ( a*b*b*0.5/x ).atan()
    } else {
        ( 2.0*(a*a*b-x)/(a*a*a) ).atan()
    };
    println!("{}", radian/std::f64::consts::PI*180.0)
}


Measured memory_bytes: 2828
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <math.h>
#include <iomanip>
#include <set>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <functional>
#include <bitset>
#include <limits.h>
#include <cassert>
#include <iterator>
#include <complex>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <random>
#include <array>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) \
                           cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b)
{
    if (a > b)
        a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b)
{
    if (a < b)
        a = b;
}
typedef pair<int, int> P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 2000020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

void solve()
{
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p(A), q(B), r(C);
    REP(i, A)
        cin >> p[i];
    REP(i, B)
        cin >> q[i];
    REP(i, C)
        cin >> r[i];
    VSORT(p);
    VREVERSE(p);
    VSORT(q);
    VREVERSE(q);
    VSORT(r);
    VREVERSE(r);
    priority_queue<int, vector<int>, greater<int>> que;
    REP(i, X)
    que.push(p[i]);
    REP(i, Y)
    que.push(q[i]);
    priority_queue<int> rem;
    REP(i, C)
    rem.push(r[i]);
    int ans = 0;
    while (!que.empty())
    {
        //cerr<<rem.top()<<" "<<que.top()<<endl;
        
        if (rem.empty())
        {
            ans += que.top();
            que.pop();
        }
        else if (que.top() < rem.top())
        {
            ans += rem.top();
            que.pop();
            rem.pop();
        }
        else
        {
            ans += que.top();
            que.pop();
        }
    }
    print(ans);
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //int q; cin >> q;
    //while (q--)
    solve();
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    for (int i=1;i<=b;i++){
        if ((a*i-c)%b==0){
            cout<<"YES"<<endl;
            return 0;
        }
    }cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<string> A(N), B(M);
	for (int i = 0; i<N; i++) cin >> A[i];
	for (int i = 0; i<M; i++) cin >> B[i];

	int flag = 1, ans = 0;
	for (int i = 0; i <= N - M; i++) {
		for (int j = 0; j <= N - M; j++) {
			flag = 1;
			for (int k = 0; k<M; k++) {
				if (A[i + k].substr(j, M) != B[k])
					flag = 0;
			}
			if (flag) ans = 1;
		}
	}

	if (ans) cout << "Yes";
	else cout << "No";


	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// AtCoder DP Contest B. Frog 2.

#define INF 1000000000

void solve()
{
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for(int &i: h) cin >> i;
	
	vector<int> dp(n, INF);
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for(int i = 2; i < n; i++) {
		for(int j = 1; j <= k and j <= i; j++) {
			dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << dp[n-1];
}

int main()
{
	int t = 1;
	//cin >> t;
	while(t--) {
		solve();
		cout << '\n';
	}
}


//to reach i -> i-k, i-k+1, ...i-2, i-1;

//i-j >= 0

//j <= i


Measured memory_bytes: 3968
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cassert>
#include<map>
#include<queue>
#include<string>
#include<cstring>
#include<set>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define all(n) (n).begin(),(n).end()
#define MAX_V 1100

using namespace std;

//follow
struct edge
{
  int to,cap,rev;
  edge(int to=inf,int cap=inf,int rev=inf):to(to),cap(cap),rev(rev){}
};

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
bool used[MAX_V];

void init(int V)
{
  rep(i,V)G[i].clear();
}

void add_edge(int from,int to,int cap)
{
  G[from].push_back(edge(to,cap,G[to].size()));
  G[to].push_back(edge(from,0,G[from].size()-1));
}
/*
void bfs(int s)
{
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s] = 0;
  que.push(s);
  while(!que.empty())
    {
      int v = que.front(); que.pop();
      for(int i=0;i<G[v].size();i++)
	{
	  edge &e = G[v][i];
	  if(e.cap > 0 && level[e.to] < 0)
	    {
	      level[e.to] = level[v] + 1;
	      que.push(e.to);
	    }
	}
    }
}
*/
int dfs(int v,int t,int f)
{
  if(v == t)return f;
  used[v] = true;
  for(int i=0;i<G[v].size();i++)
    {
      edge &e = G[v][i];
      if(e.cap > 0 && !used[e.to])
	{
	  int d = dfs(e.to,t,min(f,e.cap));
	  if(d > 0)
	    {
	      e.cap -= d;
	      G[e.to][e.rev].cap += d;
	      return d;
	    }
	}
    }
  return 0;
}

int max_flow(int s,int t)
{
  int flow = 0;
  for(;;)
    {
      memset(used,0,sizeof(used));
      int f = dfs(s,t,inf);
      if(f == 0)
	{
	  return flow;
	}
      flow += f;
    }
}


//

int main()
{
  int N;
  while(cin >> N,N)
    {
      int k,day,V,s,t;
      cin >> k;

      V = 2 + k + N;
      s = k + N;
      t = s + 1;
      init(V);
      map<int,int> days;
      vector<int> vday;
      rep(i,k)
	{
	  cin >> day;
	  vday.push_back(day);
	  add_edge(s,i,1);
	}
      sort(all(vday));
      rep(i,k)
	{
days[vday[i]] = i;
	}

      int index = k;
      int K = k;

      rep(i,N)
	{
	  cin >> k;
	  rep(j,k)
	    {
	      cin >> day;
	      if(days.find(day) != days.end())
		{
		  add_edge(days[day],K+i,1);
		}
	    }
	  add_edge(K+i,t,1);
	}


      cout << max_flow(s,t) << endl;

    }
  return 0;
}

Measured memory_bytes: 1532
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	m := iScan()
	x := -1
	y := -1
	for i := 0; i < m; i++ {
		d, c := iScan(), iScan()
		x += d * c
		y += c
	}
	fmt.Println(y + x/9)
}


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

#define mod 1000000007
#define MAX_N 200010
long long inv[MAX_N];
long long factorial[MAX_N];
long long inv_factorial[MAX_N];

void GetInv(){
    for (int i = 1; i < MAX_N; i++) {
        if (i == 1) inv[i] = 1;
        else {
            inv[i] = (mod - (mod / i) * inv[mod % i]) % mod;
            if (inv[i] < 0) inv[i] += mod;
        }
    }
}
void GetFactorial(){
    factorial[0] = 1; inv_factorial[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        factorial[i] = factorial[i-1] * i;
        factorial[i] %= mod;
        inv_factorial[i] = inv_factorial[i-1] * inv[i];
        inv_factorial[i] %= mod;
    }
}

long long combination(int n, int r) {
    long long ret = factorial[n] * inv_factorial[r];
    ret %= mod;
    ret *= inv_factorial[n-r];
    return ret % mod;
}

long long dp[1010][1010];

int main() {
    GetInv(); GetFactorial();
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    memset(dp, 0, sizeof(dp));
    dp[0][a-1] = 1;
    for (int j = a; j <= b; j++) {
        for (int i = 0; i <= n; i++) {
            // dp[i][j]
            long long mul = 1;
            for (int k = 0; k <= n; k++) {
                if (k == 0) {
                    dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod;
                }
                if (k >= c && k <= d) {
                    long long tmp = mul * inv_factorial[k] % mod;
                    dp[i+j*k][j] += tmp * dp[i][j-1] % mod;
                    dp[i+j*k][j] %= mod;
                }
                if (k == d) break;
                if (n-i-j*k < j) break;
                mul = mul * combination(n-i-j*k, j) % mod;
            }
        }
    }
    cout << dp[n][b] << endl;
    return 0;
}

Measured memory_bytes: 12928
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	w := cint(getNextInt(scanner))
	vv := make([]int, n)
	ww := make([]cint, n)
	for i := 0; i < n; i++ {
		vv[i] = getNextInt(scanner)
		ww[i] = cint(getNextInt64(scanner))
	}
	dp := make([]cint, 10001)
	for i := 1; i < 10001; i++ {
		dp[i] = math.MaxInt64 >> 5
	}
	for i := 0; i < n; i++ {
		for j := 10000; j >= vv[i]; j-- {
			dp[j].minAs(dp[j-vv[i]] + ww[i])
		}
	}
	for i := 10000; i >= 0; i-- {
		if w >= dp[i] {
			fmt.Fprintln(writer, i)
			return
		}
	}
}

type cint int64

func (ct *cint) minAs(x cint) *cint {
	*ct = ct.min(x)
	return ct
}
func (ct *cint) maxAs(x cint) *cint {
	*ct = ct.max(x)
	return ct
}
func (ct cint) min(x cint) cint {
	if ct > x {
		return x
	}
	return ct
}
func (ct cint) max(x cint) cint {
	if ct < x {
		return x
	}
	return ct
}



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

int main(){
	int a,b,c;
	int ans;
	int cnt=0;
	
	while(cin>>a>>b){
		//-----test-----
		if(a==1) continue;
		
		
		//--------------
		c=a+b;
		ans=1;
		while(10<=c){
			c/=10;
			ans++;
		}
		cout<<ans<<endl;
		cnt++;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[]) {
  long double a, b, x;
  cin >> a >> b >> x;


  // case1
  long double empty_v = a * a * b - x;
  long double y = 2 * empty_v / pow(a, 2);
  long double angle = atan(y / a);

  // case2
  long double w = 2 * x / (a * b);
  long double angle2 = atan(w / b);

  long double ret = angle / 3.14159265358979 * 180;
  long double ret2 = 90.0 - angle2 / 3.14159265358979 * 180;

  if (x < a * a * b / 2)
    cout << std::fixed << std::setprecision(15) << ret2 << endl;
  else
    cout << std::fixed << std::setprecision(15) << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, s; cin >> n >> s;
  	int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
  	long long mod = 998244353LL;
  	long long dp[n+1][s+1];
  	for (int i = 0; i <= n; i++)
    	for (int j = 0; j <= s; j++)
          	dp[i][j] = 0LL;
  dp[0][0] = 1LL;
  	for (int i = 0; i < n; i++)
      for (int j = 0; j <= s; j++) {
      	dp[i+1][j] += 2 * dp[i][j];
       	dp[i+1][j] %= mod;
        if (j + a[i] <= s) {
        	dp[i+1][j+a[i]] += dp[i][j];
          	dp[i+1][j+a[i]] %= mod;
        }
      }
  cout << dp[n][s] << endl;
  return 0;
}


Measured memory_bytes: 73852
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var A = sc.nextLong();
        var B = sc.nextLong();
        var X = sc.ArrayLong(N);

        long ans = 0;
        for (int i = 1; i < N; i++) {
            if ((X[i] - X[i-1]) * A < B) {
                ans += (X[i] - X[i - 1]) * A;
            } else {
                ans += B;
            }

        }
        WriteLine(ans);
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

int A[12][12];

int main(){
  int n, m, x;
  vector<int> C(n);

  cin >> n >> m >> x;
  rep(i, n){
    cin >> C[i];
    rep(j, m){
      cin >> A[i][j];
    }
  }

  int ans = INF;

  rep(s,1 << n){
    int cost = 0;
    vector<int> d(m);
    rep(i,n){
      if (s>>i&1) {
        cost += C[i];
        rep(j,m) d[j] += A[i][j];
      }
    }
    bool ok = true;
    rep(j,m) if (d[j] < x) ok = false;
    if (ok) ans = min(ans, cost);
  }

  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 100100;
int N;

int main() {
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int dp[n+10][m+10][3];
    
    rep(i,n+1){
        rep(j,m+1){
            if(i==0&&j==0){
                dp[0][0][0] = 0;
                dp[0][0][1] = 0;
                dp[0][0][2] = 0;
            }else if(i==0){
                dp[i][j][0] = dp[i][j-1][0];
                dp[i][j][1] = i;
                dp[i][j][2] = j-1;
            }else if(j==0){
                dp[i][j][0] = dp[i-1][j][0];
                dp[i][j][1] = i-1;
                dp[i][j][2] = j;
            }else if(s[i-1]==t[j-1]){
                dp[i][j][0] = dp[i-1][j-1][0] + 1;
                dp[i][j][1] = i-1;
                dp[i][j][2] = j-1;
            }else{
                if(dp[i-1][j][0]>=dp[i][j-1][0]){
                    dp[i][j][0] = dp[i-1][j][0];
                    dp[i][j][1] = i-1;
                    dp[i][j][2] = j;
                }else{
                    dp[i][j][0] = dp[i][j-1][0];
                    dp[i][j][1] = i;
                    dp[i][j][2] = j-1;
                }
            }
        }
    }

    rep(i,n+1){
        rep(j,m+1){
            //cout << dp[i][j][0];
        }
        //cout << endl;
    }

    int x = n;
    int y = m;
    string u;
    while((x!=0)||(y!=0)){
        if(dp[x][y][1]==(x-1)&&dp[x][y][2]==(y-1)){
            u += s[x-1];
        }
        //cout << x << ' ' << y << endl;
        int xx = x;
        int yy = y;
        x = dp[xx][yy][1];
        y = dp[xx][yy][2];

    }

    reverse(u.begin(),u.end());
    cout << u << endl;

    return 0;
}
 
 


Measured memory_bytes: 106112
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
using ULL = uint64_t;
const LL LLHUGE = numeric_limits<LL>::max() / 5; // for int64_t: 1.8 * 10^18
using P = pair<LL, LL>;
#define rep(i, n) for (LL i = 0; i < (n); ++i)
#define all(v) (v).begin(), (v).end()
//#define DEBUG


// LL dfs(const LL depth, const LL d, const LL g,
//        const vector<LL> &p, const vector<LL> &c,
//        vector<LL> &completed) {
//   if (depth == d) {
//     LL cost = 0;
//     LL point = 0;
//     rep(i, d) {
//       // completed i
//       if (completed.at(i) == 1) {
//         point += (i + 1) * 100 * p.at(i) + c.at(i);
//         cost += p.at(i);
//       }
//     }
// //    cout << depth << " : " << cost << " : " << point << endl;
//     if (point >= g) {
//       return cost;
//     }
// //    cout << cost << endl;
//     for (int i = d - 1; i >= 0; --i) {
//       if (completed.at(i) == 0) {
//         if ((i + 1) * 100 * (p.at(i) - 1) < g - point) {
//           return HUGE; // infeasible
//         }
//         cost += (g - point) / ((i + 1) * 100);
//         cost += ((g - point) % ((i + 1) * 100) ? 1 : 0);
//         return cost;
//       }
//     }
//     abort(); // cannot happen
//   }
// 
//   LL min_cost = HUGE;
//   rep(i, 2) {
//     completed.at(depth) = i;
//     min_cost = min(min_cost, dfs(depth + 1, d, g, p, c, completed));
//   }
//   return min_cost;
// }

template <typename V>
void print_all(const V& v) {
  for (const auto e: v) {
    cout << e << "\t";
  }
  cout << endl;
}

int main() {
  LL d, g;
  cin >> d >> g;
  vector<LL> p(d, -1);
  vector<LL> c(d, -1);
  rep(i, d) {
    cin >> p.at(i) >> c.at(i);
  }
  
  vector<LL> priority(d, -1);
  iota(all(priority), (LL)0);

  LL n_problems_min = LLHUGE;
  do {
    LL n_problems = 0;
    LL pending_point = g;
    //print_all(priority);
    for (const auto i: priority) {
      // Solving i-th problem set:
      const LL this_problem_point = (i + 1) * 100;

      const LL this_point_sum = p.at(i) * this_problem_point + c.at(i);
      const LL this_point_sum_no_last = (p.at(i) - 1) * this_problem_point;
      if (pending_point > this_point_sum) {
        n_problems += p.at(i);
        pending_point -= this_point_sum;
      } else if (pending_point > this_point_sum_no_last) {
        n_problems += p.at(i);
        break;
      } else {
        n_problems += pending_point / this_problem_point;
        n_problems += pending_point % this_problem_point ? 1 : 0;
        break;
      }
    }
    n_problems_min = min(n_problems_min, n_problems);
  } while (next_permutation(all(priority)));

  
  cout << n_problems_min << endl;
  
  #ifdef DEBUG
  cout << "D: " << d << endl;
  cout << "G: " << g << endl;
  #endif
}



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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int N = input();
    vector< i64 > A(N);
    cin >> A;

    i64 ans = 0;
    int p = 1;
    range(i, 0, N) {
        ans += (A[i] - 1) / p;
        if (A[i] - 1 >= p) A[i] = 1;
        if (p == A[i]) p++;
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 1024
def greedy(n, value, cost):
    m = int(n)
    total_value = 0
    total_cost = 0
    for i in range(m):
        v = int(value[i])
        c = int(cost[i])
        if v > c:
            total_value += v
            total_cost += c
        else:
            pass
    else:
        print("%d" %(total_value - total_cost))

if __name__ == '__main__':
    n = raw_input()
    value = raw_input().split()
    cost = raw_input().split()

#    print("%s" %n)
#    print("%s" %value)
#    print("%s" %cost)


    greedy(n,value,cost)

Measured memory_bytes: 2568
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int a, b;
	std::cin >> a >> b;

	int diff = b - a;
	int right = diff * (diff + 1) / 2;
	int depth = right - b;
	
	std::cout << depth << "\n";
}


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

// card[i][j] := プレイヤー i が j 回目に出したカード.
string card[4][13];
// Trump := 基準となる強いマーク, trump := この回で強いマーク.
char Trump, trump;
// h[c] := 文字 c に対応する数字.
char h[256] = {0};
// 解
string ans_team;
int ans_score;

// n := カードの数字, id := 順番, m := マーク.
struct State{
	int n, id;
	char m;
	State(){};
	State(int n_, int id_, char m_){
		n = n_; id = id_; m = m_;
	};
};
// カードの順序を定義.
bool operator<(const State &a, const State &b){
	if( a.m == trump ){
		return ( b.m == trump )? a.n < b.n : false;
	}else{
		if( b.m == trump ){
			return true;
		}else{
			return ( a.n == b.n )? a.id > b.id : a.n < b.n;
		}
	}
}

State get_state(string s, int p, int start){
	int n = h[s[0]], id;
	char m = s[1];
	
	for(int i = 0, k = start ; i < 4 ; i++, k = (k+1) % 4 ){
		if( k == p ){
			id = i;
			break;
		}
	}
	return State(n, id, m);
}

void solve(){
	int prev_win = 0, NS = 0, EW = 0;
	
	for(int j = 0 ; j < 13 ; j++ ){
		int win;
		State win_s;
		
		// マーク Trump を出したプレイヤーがいるかどうか. 
		bool flag = false;
		for(int i = 0 ; i < 4 ; i++ ){
			State s = get_state(card[i][j], i, prev_win);
			
			if( s.m == Trump ){
				flag = true;
				break;
			}
		}
		if( flag ){
			trump = Trump;
		}else{
			State s = get_state(card[prev_win][j], prev_win, prev_win);
			trump = s.m;
		}
		
		// どのプレイヤーが勝ったかチェック.
		for(int i = 0 ; i < 4 ; i++ ){
			State s = get_state(card[i][j], i, prev_win);
			
			if( i == 0 ){
				win = 0;
				win_s = s;
			}else if( win_s < s ){
				win = i;
				win_s = s;
			}
		}
		// 勝ったプレイヤーのチームに勝ち点追加.
		(win == 0 || win == 2)? NS++ : EW++;
		prev_win = win;
	}
	if( EW < NS ){
		ans_team = "NS";
		ans_score = NS - 6;
	}else{
		ans_team = "EW";
		ans_score = EW - 6;
	}
}

int main(){
	h['T'] = 10; h['J'] = 11; h['Q'] = 12; h['K'] = 13; h['A'] = 14;
	for(char c = '2' ; c <= '9' ; c++ ){
		h[c] = c - '0';
	}
	
	while( cin >> Trump, Trump != '#' ){
		for(int i = 0 ; i < 4 ; i++ ){
			for(int j = 0 ; j < 13 ; j++ ){
				cin >> card[i][j];
			}
		}
		solve();
		cout << ans_team << " " << ans_score << endl;
	}
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,i;
    cin>>a>>b;
    if(a>b)
    {
        for(i=0;i<a;i++)
        {
            cout<<b;
        }
        
    }
    else
    {
      for(i=0;i<b;i++)
        {
            cout<<a;
        }  
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbg(x) cerr << #x << " : " << x << endl;
typedef long double ld;
int main(){
    int n;
    cin >> n;
    vector<ld> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    ld ans=0;
    sort(a.rbegin(),a.rend());
    for(int i=n-1;i>=1;i--){
        a[i-1]=(a[i]+a[i-1])/2;
    }
    cout.precision(12);
    cout << fixed;
    cout << a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long

int main() {
	int n;
	ll y;
	cin >> n >> y;
	for (int i = 0; i <= n; i++) { //10000円札をi枚で固定
		for (int j = 0; j <= n - i; j++) {
			if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) {
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100003)
n,m=map(int,input().split())
bridges=[list(map(int,input().split())) for i in range(m)][::-1]
inconv=[n*(n-1)//2]*m
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for i in range(N)]
 
    def merge(self, a, b):
        if self.issame(a,b):
            return
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
        self.size[pb] += self.size[pa]
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
        
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    
    def getsize(self, x):
        return self.size[self.root(x)]
uf = UnionFind(n)
for i in range(m-1):
    if uf.issame(bridges[i][0]-1,bridges[i][1]-1):
        inconv[i+1]=inconv[i]
        continue
    inconv[i+1]=inconv[i]-uf.getsize(bridges[i][0]-1)*uf.getsize(bridges[i][1]-1)
    uf.merge(bridges[i][0]-1,bridges[i][1]-1)
for i in range(m):
    print(inconv[m-i-1])

Measured memory_bytes: 48204
H, W = map(int, input().split())
A = [input() for i in range(H)]

visited = [[False]*W for i in range(H)]
visited[0][0] = True
d = [[0, 0, -1, -1]]
while d:
  x, y, px, py = d.pop()
  num = 0
  flag = False
  for dx, dy in [[1, 0], [0, 1], [-1, 0], [0, -1]]:
    if 0<=x+dx<H and 0<=y+dy<W and [x+dx, y+dy]!=[px, py] and A[x+dx][y+dy]=='#' and not visited[x+dx][y+dy]:
      visited[x+dx][y+dy] = True
      num += 1
      d.append([x+dx, y+dy, x, y])
      if dx < 0 or dy < 0:
        flag = True
  if (num >= 2) or flag:
    print('Impossible')
    quit()

print('Possible')

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
   int a, b;

   scanf("%d %d", &a, &b);

   if( a > b){
      printf("a > b");
   }else if( a < b){
      printf("a < b");
   }else{
      printf("a == b");
   }

   printf("\n");

   return 0;

}

Measured memory_bytes: 584
n=int(input())
H=[]
S=[]
C=[]
D=[]
list=[]
cards=[0]*52
cards=[]
for i in range(n):
    n,a=input().split()
    a=int(a)
    if n=="S":
        S.append(a)
    elif n=="H":
        H.append(a)
    elif n=="C":
        C.append(a)
    else:
        D.append(a)
for i in range(1,14):
    if i in S:
        x=0
    else:
        print("S",i)
for i in range(1,14):
    if i in H:
        x=0
    else:
        print("H",i)
for i in range(1,14):
    if i in C:
        x=0
    else:
        print("C",i)
for i in range(1,14):
    if i in D:
        x=0
    else:
        print("D",i)
    


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

        using namespace std;
        #define sd(x) scanf("%d",&x);
        #define sdl(x) scanf("%lld",&x);
        #define pr(x) printf("%d\n",x);
        #define prl(x) printf("%lld\n",x);
    
    long long int mod=1000000007;

    long long int gcd(long long int a,long long int b)
    {
        if (b<a)return gcd(b,a);
        else if (b%a==0)return a;
        else return gcd(b%a,a);

    }

    long long fast_exp(long long a,long long n,long long mod1)
    {

    if (n==0)return 1;
    else if (n==1)return a;
    if (n%2==0)return fast_exp((a*a)%mod1,n/2,mod1);
    else return (a*fast_exp((a*a)%mod1,n/2,mod1))%mod1;
    }
    bool is_square(long long  a)
    {
    long long int b=sqrt(a);
    if (b*b==a)return true;
    else return false;
    }
    long long n_fact[1000001];
    void calc_fact(int n) // calculates the factorial % mod and stores in n_fact upto n 
    {
        n_fact[0]=1;
        for (int c(1);c<=n;c++)
            n_fact[c]=(c*n_fact[c-1])%mod;
        return ;
    }
    long long calc_inverse_mod(long long x,long long mod)
    {
        return fast_exp(x,mod-2,mod);

    }
    bool n_primes[100001]={false};
    void calc_primes(int n)
    {
        for (int c(2);c<=100000;c++)
        {
            if (n_primes[c]==true)continue;
            for (int c1(c+c);c1<=100000;c1=c1+c)
                n_primes[c1]=true;
        }
        return ;
    }
bool is_palindrome(string a)
{
    string b=a;
    reverse(b.begin(),b.end());
    if (b==a)
        return true;
    else return false;
}
    int main ()
    {
    
        ios_base::sync_with_stdio(false);
        int t;
        //cin >> t;
        t=1;
        for (int tt=0;tt<t;tt++)
        {
            double a;
            scanf("%lf",&a);
            printf("%.7f",(a*a*a)/27);

            
        }
        


        
            
        
    return 0;




        
    }


Measured memory_bytes: 256