akhauriyash/Code-Regression huggingface dataset:
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  string s;
  cin >> s;
  bool flag = true;
  int c_cnt = 0;

  if(s[0] != 'A') flag = false;
  if(s[1] == 'C') flag = false;
  if(s[s.size()-1] == 'C') flag = false;
  reps(i,1,s.size()) {
    if('A' <= s[i] && s[i] <= 'Z') {
      if(s[i] == 'C') c_cnt++;
      else flag = false;
    }
  }
  if(c_cnt != 1) flag = false;

  cout << (flag ? "AC" : "WA") << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var y int
	fmt.Scan(&n)
	fmt.Scan(&y)

	c10000 := -1
	c5000 := -1
	c1000 := -1
LOOP:
	for i := y / 10000; i >= 0; i-- {
		tmp := y - 10000*i
		for j := tmp / 5000; j >= 0; j-- {
			if i*10000+j*5000+(n-i-j)*1000 == y {
				c10000 = i
				c5000 = j
				c1000 = n - i - j
				break LOOP
			}
		}
	}

	fmt.Printf("%d %d %d\n", c10000, c5000, c1000)
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 10**7
for i in range(a[0], a[n-1]+1):
	cost = 0
	for j in range(n):
		cost += (a[j]-i)**2
	ans = min(ans, cost)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

string s;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> s;
  int l, r, len = 0;
  if (s.size()&1) {
    l = r = s.size()/2;
  } else {
    l = s.size()/2-1, r = s.size()/2;
  }  
  char x = s[l];
  while (l >= 0 && r < s.size() && s[l] == x && s[r] == x) {
    l--; r++;
    len++;
  }
  cout << len + s.size()/2 << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  int oddcounter = 0, fourcounter = 0, counter = 0;
  for(int i = 0; i < N; i++){
    ll a;
    cin >> a;
    if(a%2 == 1) oddcounter++;
    else if(a%4 == 0) fourcounter++;
    else counter++;
  }
  if(fourcounter >= oddcounter) cout << "Yes" << endl;
  else if(counter == 0 && fourcounter == oddcounter - 1) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
S = input()
T = input()

D = [N, M]
while D[1] != 0:
  D[0], D[1] = D[1], D[0] % D[1]
R = D[0]
L = R * (N // R) * (M // R)
E = L
for i in range(R):
  if S[i * (L // M)] != T[i * (L // N)]:
    E = -1
print(E)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e9;

int main()
{
	lld a,b,c;
	cin >> a >>b >> c;

	lld cnt = 0;

	if (a%2==1 || b%2== 1 || c%2==1)
		{
			cout << cnt << endl;
			return 0;
		}

	if (a==b && b==c)
	{
		cout << -1 << endl;
	}else
	{
		while(1)
		{
			cnt++;
			lld x=b+c,y=c+a,z=a+b;
			a = x / 2;
			b = y / 2;
			c = z / 2;

			if (a%2==1 || b%2== 1 || c%2==1)
			{
				cout << cnt << endl;
				break;
			}
			if (a == b && b == c)
			{
				cout << -1 << endl;
				break;
			}
		}
	}

	return 0;
}

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

const int N = 2e5;

int main() {
  int n;
  cin >> n;
  int cnt4 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 4 == 0) cnt4 += 1;
    else if (x % 2 == 0) cnt2 += 1;
  }
  if (n/2 <= cnt4 || (cnt2/2 + cnt4 >= n/2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int n;
vector<ll> h, dp;

ll rec(int i) {
    if (dp[i] < inf) return dp[i];
    if (i == 0) return 0;

    ll res = inf;
    chmin(res, rec(i - 1) + abs(h[i] - h[i - 1]));
	if (i > 1) {
		chmin(res, rec(i - 2) + abs(h[i] - h[i - 2]));
	}

    return dp[i] = res;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	cin >> n;
	h.resize(n);
	dp.resize(n, inf);
	rep(i, n) cin >> h[i];

	out(rec(n - 1));

	return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
  string s;
  cin>>s;
  int n=s.size();
  int a=0;
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      a++;
    }
  }
  cout<<a<<endl;
  return 0;
}

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


int main() {

	int n, k;
	cin >> n >> k;
	vi v(n);
	rep(i, n)cin >> v[i];

	vi lsum(n + 1, 0), rsum(n + 1, 0);
	rep1(i, n) {
		lsum[i] = lsum[i - 1] + v[i - 1];
		rsum[i] = rsum[i - 1] + v[n - i];
	}

	int ans = -INF;
	rep(i, n+1)rep(j, n+1) {
		if (i + j > min(n, k))continue;
		priority_queue<int,vi,greater<int>> pq;
		rep(l, i)if (v[l] < 0)pq.push(v[l]);
		rep(l, j)if (v[n - 1 - l] < 0)pq.push(v[n - 1 - l]);
		int val = lsum[i] + rsum[j];
		rep(l, k - i - j)if (pq.size() > 0) { val -= pq.top();pq.pop(); }
		ans = max(ans, val);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

VVLL matmul(VVLL& a, VVLL& b) {
	int n = a.size();
	VVLL ret(n, VLL(n,0));
	REP(i, n) {
		REP(j, n) {
			REP(k, n) {
				ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % MOD;
			}
		}
	}
	return ret;
}

VVLL matpow(VVLL& a, LL p) {
	int n = a.size();
	VVLL ret(n, VLL(n, 0));
	REP(i, n)ret[i][i] = 1;
	VVLL tmp(a);
	while (p) {
		if (p & 1)ret = matmul(tmp, ret);
		p >>= 1;
		tmp = matmul(tmp, tmp);
	}
	return ret;
}

int main() {
	int n;
	LL k;
	scanf("%d%lld", &n, &k);
	VVLL mat(n, VLL(n, 0));
	REP(i, n)REP(j, n)scanf("%lld", &mat[i][j]);
	VVLL tmp = matpow(mat, k);
	LL ret = 0;
	REP(i, n)REP(j, n)ret = (ret + tmp[i][j]) % MOD;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if (x - r >= 0 && x + r <= W)
        {
            if (y - r >= 0 && y + r <= H)
            {
                System.out.println("Yes");
            }
            else
            {
                System.out.println("No");
            }
        }
        else
        {
            System.out.println("No");
        }
    }
}



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

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

const int INF=1e9;
const int MOD=1e9+7;

struct UnionFind{

    vector<int> par;
    vector<int> sizes;

    UnionFind(int n):par(n),sizes(n,1){
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int find(int x) { //xの根を得る
        if (x == par[x]) return x;
        return par[x] = find(par[x]); //根を張り替えながら再帰的に根ノードを探す
    }

    //2つの要素が属する集合を併合
    void unite(int x, int y) { 
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    //2つの要素が同じ集合に属するか判定する
    bool same(int x, int y) {
        return find(x) == find(y);
    }

    //集合のサイズを取得
    int size(int x) {
        return sizes[find(x)];
    }
    
};

int main(){
    int N,M; cin >> N >> M;
    UnionFind uf(N);
    for(int i=0;i<M;i++){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
    }
    int ans=0;
    for(int i=0;i<N;i++){
        ans=max(ans,uf.size(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4844
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
    char s[10000];
    int sum1,sum2,mi = 0;
    int t[1000],t2[1000];
    int n ;
    cin >> n;
    cin >> s;
    int len = strlen(s);
    for(int i = 0 ; i < len ; i ++)
    {
        sum2 = 0;
        memset(t,0,sizeof(t));
        for(int j = 0 ; j < i ; j ++)
        {
            if(t[s[j]] == 0)
            {
                t[s[j]] ++;
            }
        }
        for(int j = i ; j < len ; j ++)
        {
            if(t[s[j]] == 1)
            {
                t[s[j]] ++;
                sum2 ++;
            }
        }
        mi = max(mi,sum2);
    }
    cout << mi << endl;
    return 0;
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(1,n):
    walk = (X[i] - X[i-1]) * a
    tel = b
    if walk >= tel:
        ans += tel
    else:
        ans += walk
print(ans)

Measured memory_bytes: 14252
import heapq
import sys
input=sys.stdin.readline
n,m,s,t=map(int,input().split())
edge1=[[] for i in range(n)]
edge2=[[] for i in range(n)]
for i in range(m):
    u,v,a,b=map(int,input().split())
    edge1[u-1].append(a*(10**6)+(v-1))
    edge1[v-1].append(a*(10**6)+(u-1))
    edge2[u-1].append(b*(10**6)+(v-1))
    edge2[v-1].append(b*(10**6)+(u-1)) 

def dijkstra_heap(edge,s):
  d=[float("inf")]*n
  used=[True]*n
  d[s]=0
  used[s]=False
  edgelist=[]
  for e in edge[s]:
    heapq.heappush(edgelist,e)
  while edgelist:
    minedge=heapq.heappop(edgelist)
    minedge_cost=minedge//(10**6)
    minedge_v=minedge%(10**6)
    if not used[minedge_v]:
      continue
    d[minedge_v] = minedge_cost
    used[minedge_v] = False
    for e in edge[minedge_v]:
      e_cost=e//(10**6)
      e_v=e%(10**6)
      if used[e_v]:
        heapq.heappush(edgelist,e+minedge_cost*10**6)
  return d

d1=dijkstra_heap(edge1,s-1)
d2=dijkstra_heap(edge2,t-1)
d=[0]*n

for i in range(n):
  d[i]=d1[i]+d2[i]
for i in range(n-1):
  d[-i-2]=min(d[-i-2],d[-i-1])
for dd in d:
  print(10**15-dd)


Measured memory_bytes: 109856
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>


using namespace std;

void Solution()
{
    string s;
    
    getline(cin, s); // ensure the last char by "enter"
    
    transform(s.begin(), s.end(), s.begin(), ::toupper);
    
    cout << s << endl;
    
    return;
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1180
#include<iostream>

using namespace std;

int main(){
    int n;
    while(true){
        cin>>n;
        if(n==0){
            break;
        }
        int a[500010],sum=0,cnt=0;
        for(int i=0;i<n;++i){
            cin>>a[i];
            sum+=a[i];
        }
        for(int i=0;i<n;++i){
            if(n*a[i]<=sum){
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }

    return 0;
}


Measured memory_bytes: 3124
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    MOD = 1000000007

    N, M = map(int, input().split())
    A = set()
    for _ in range(M):
        a = int(input())
        A.add(a)

    dp = [0] * (N + 1)
    dp[0] = 1
    for i in range(1, N + 1):
        if i not in A:
            if i == 1:
                dp[i] = dp[i - 1]
            else:
                dp[i] = dp[i - 1] + dp[i - 2]

    # print(dp)
    print(dp[N] % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 471416
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define has_bit(bit_mask, x) ((bit_mask) & (1Uint << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1Uint << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1Uint << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define int ll
#define double ld
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
#define MOD 1000000007

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    stringstream a, b;
    for (int i = 0; i < m; ++i) a << to_string(n);
    for (int i = 0; i < n; ++i) b << to_string(m);
    string p = a.str(), q = b.str();
    if (p < q) cout << p << '\n';
    else cout << q << '\n';
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template<class T>bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template<class T>bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

#define MAX_N 300
ll d[MAX_N][MAX_N];
void warshall_floyd(int n) {
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            for(int k=0;k<n;k++)
                d[j][k] = min(d[j][k],d[j][i]+d[i][k]);
}
signed main() {
    REP(i,MAX_N) REP(j,MAX_N) d[i][j]=INF;
    REP(i,MAX_N) d[i][i]=0;
    int N,M,R;
    cin>>N>>M>>R;
    vector<int> r(R);
    cin>>r;
    REP(i,M) {
        int a,b,c;
        cin>>a>>b>>c;
        a--; b--;
        d[a][b]=c;
        d[b][a]=c;
    }
    warshall_floyd(N);
    sort(ALL(r));

    int ans=INF;
    do {
        int tmp=0;
        REP(i,R-1) {
            tmp+=d[r[i+1]-1][r[i]-1];
        }
        chmin(ans,tmp);
    } while(next_permutation(ALL(r)));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    bool alpha[26] = {false};
    for(int i = 0; i < S.length();i++){
        alpha[S[i]-'a'] = true;
    }
    for(int i = 0; i < 26;i++){
        if(alpha[i] == false){
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
n = int(input())
xs = list(map(int, input().split()))
xs_min = min(xs)
xs_max = max(xs)

fatigue_min = float("inf")

for i in range(xs_min, xs_max + 1):
  fatigue = 0
  for x in xs:
    fatigue += (x - i) ** 2
  if fatigue < fatigue_min:
    fatigue_min = fatigue
  else:
    print(fatigue_min)
    exit()
else:
  print("0")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;

typedef long long int ll;

int main()
{
// 入力

	int n;
	cin >> n;
	vector<int> a(n), c(n - 1);
	int b, sum = 0;
	REP(i, n) cin >> a[i];
	REP(i, n)
	{
		cin >> b;
		sum += b;
	}
	REP(i, n - 1) cin >> c[i];

// 処理

	REP(i, n - 1)
	{
		if (a[i + 1] - a[i] == 1)
		{
			sum += c[a[i] - 1];
		}
	}

// 出力

	cout << sum;
	return 0;
}

Measured memory_bytes: 256
/*input
abcab
*/

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main()
{

	string S;
	cin >> S;

	int count = S.size()-2;

	set<char> key;
	key.insert(S[0]);
	key.insert(S[S.size()-1]);

	for(int i=1;i<S.size()-1;i++){
		if(S[i-1]==S[0] && S[i+1]==S[0]){
			key.insert(S[i]);
		}
	}

	for(int i=S.size()-2;i>0;i--){
		if(S[i-1]==S[S.size()-1] && S[i+1]==S[S.size()-1]){
			key.insert(S[i]);
		}
	}

	for(int i=1;i<S.size()-1;i++){
		bool flag = false;

		for(auto k:key){
			flag &= S[i] == k;
		}
		
		if(flag) count--;
	}

	if(S[0] != S[S.size()-1]){
		if(count & 1){
			cout << "First" << endl;
		}else{
			cout << "Second" << endl;
		}
	}else{
		if(count & 1){
			cout << "Second" << endl;
		}else{
			cout << "First" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
#include<bitset> 
#include<type_traits>
#include<numeric>
#include<array>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

const int mod = 1000000007;
const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
ll myPow(ll a,ll b,ll M) {
    ll ret = 1;
    ll tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
ll nCk(ll n,ll k,ll M) {
    ll ret = 1;
    ll mi = min(k, n-k);
    for(ll i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(ll i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (ll)ret;
}

int main(){
    int N,K;cin >> N >> K;

    pl(N-K+1)

    return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = map( int, input().split() )
ruto = []

for i in range(0,tx-sx):
    ruto.append("R")
for i in range(0,ty-sy):
    ruto.append("U")
for i in range(0,tx-sx):
    ruto.append("L")
for i in range(0,ty-sy):
    ruto.append("D")

ruto.append("D")
for i in range(0,tx-sx+1):
    ruto.append("R")
for i in range(0,ty-sy+1):
    ruto.append("U")
ruto.append("L")
ruto.append("U")
for i in range(0,tx-sx+1):
    ruto.append("L")
for i in range(0,ty-sy+1):
    ruto.append("D")
ruto.append("R")




for i in range(0,len(ruto)):
    print(ruto[i],end="")

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

int main(){
    int a,b;
    cin>>a>>b;
    if (a==1){
        a=14;
    }
    if (b==1){
        b=14;
    }
    if (a==b){
        cout<<"Draw";
    } else if (a<b){
        cout<<"Bob";
    } else {
        cout<<"Alice";
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a, b, x[1000], y[1000], p, sum, ok; char c;
int main() {
	while (cin >> a >> c >> b) {
		if (a + b == 0) { break; }
		x[a] = b; p++;
	}
	sum = 1;
	for (int i = 30; i >= 0; i--) {
		ok = 0;
		for (int j = 1; j <= p; j++) {
			if (x[j] == i) { y[j] = sum; ok = 1; }
		}
		if (ok) { sum++; }
	}
	while (cin >> a) {
		cout << y[a] << endl;
	}
}

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

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
  nimble;
  int tt=1;//cin>>tt;
  while(tt--){
    int k,x;
    cin>>k>>x;
    if(500*k>=x)
        cout<<"Yes";
    else cout<<"No";
  }
  return 0;
}


Measured memory_bytes: 256
/*input
5 5
.#.#.
#.#.#
.#.#.
#.#.#
.#.#.
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (int)(lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
    out<<'('<<P.F<<','<<P.S<<')';
    return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
    REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
    return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}


int dp[105][105];

string s[maxn];
int main(){
    IOS;
    int n,m;
    cin>>n>>m;
    REP(i,n) cin>>s[i];

    REP(i,n) REP(j,m){
        if(i==0&&j==0){
            if(s[i][j]=='#') dp[i][j]=1;
            else dp[i][j]=0;
        }
        else if(i==0){
            if(s[i][j-1]=='.'&&s[i][j]=='#') dp[i][j]=dp[i][j-1]+1;
            else dp[i][j]=dp[i][j-1];
        }
        else if(j==0){
            if(s[i-1][j]=='.'&&s[i][j]=='#') dp[i][j]=dp[i-1][j]+1;
            else dp[i][j]=dp[i-1][j];
        }
        else{
            dp[i][j]=min(
                        dp[i-1][j]+(s[i-1][j]=='.'&&s[i][j]=='#'),
                        dp[i][j-1]+(s[i][j-1]=='.'&&s[i][j]=='#')
                );
        }
    }
    cout<<dp[n-1][m-1]<<'\n';
    return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod.m での a の逆元 a^ { -1 } を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x /gcd(x, y) * y );
}

ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
char c[2010][2010];
ll sum[2010][2010];
ll res[10][10];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] += 32;
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int maxn = 100000 + 5;

char s[maxn]; int n;

int main() {
    scanf("%s", s); n = strlen(s);
    vector<char> v;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (v.empty()) v.push_back(s[i]);
        else if (v.back() != s[i]) {
            v.pop_back(); ans += 2;
        } else v.push_back(s[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for _ in [0]*n]
B = [list(map(int, input().split())) for _ in [0]*m]
C = [[0 for _ in range(l)] for _ in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
            
[print(*C[_]) for _ in range(n)]


Measured memory_bytes: 7076
#include <stdio.h>

int main(){
  int x,y;

  while(1){
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0)break;
    else if(x > y){
      int emp = 0;
      emp = x;
      x = y;
      y = emp;
    }
    printf("%d %d\n",x,y);
  }

}



Measured memory_bytes: 1980
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;
    bool flag=true;
    cin>>n;
    vector<pair<ll,ll>> v;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        if(a>b) flag=false;
        v.push_back(make_pair(b,a));
    }
    SORT(v);
    ll now=0;
    rep(i,n){
        now+=v[i].second;
        if(now>v[i].first){
            flag=false;break;
        }
    }
    if(flag)    cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 6524
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    string s, t;
    cin >> s >> t;

    rep(i, s.size()){
        bool flag = true;
        rep(j, s.size()){
            if(s[(i+j) % s.size()] != t[j]) flag = false;
        }
        if(flag){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

}



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

using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	int ans = 0;
	for (int i = stoi(a); i <= stoi(b); ++i) {
		const string current = to_string(i);
		bool isok = true;
		for (int d = 0; d < current.size() / 2; d++) {
			if (current[d] != current[current.size() - d -1]) {
				isok = false;
				break;
			}
		}
		if (isok) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int C;
  long long S;
  int F;
  cin>>N;
  
  vector<int> vc;
  vector<long long> vs;
  vector<int> vf;
  for (int i=0;i<N-1;i++){
    cin>>C>>S>>F;
    
    vc.push_back(C);
    vs.push_back(S);
    vf.push_back(F);
  }
  long long ans;
  for (int i=0;i<N-1;i++){
    ans=vs[i]+vc[i];
    for (int j=i+1;j<N-1;j++){
      if (vs[j]>ans){
        ans=vs[j]+vc[j];
      }
      else{
        if (ans%vf[j]==0){
          ans+=vc[j];
        }
        else{
          ans+=(vf[j]-ans%vf[j]+vc[j]);
        }

      }
    }
    cout<<ans<<endl;

  }
  cout<<0<<endl;
}


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

using namespace std;

int main()
{
    int n;
    string a;
    cin>>n>>a;
    int ile=0;
    for(int i = 2;i<a.size();i++)
    {
        if(a[i]=='C'&&a[i-1]=='B'&&a[i-2]=='A')ile++;
    }
    cout<<ile;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
int main()
{
	string s;
	cin >> s;
	int c = 700;
	if (s[0] == 'o') c += 100;
	if (s[1] == 'o') c += 100;
	if (s[2] == 'o') c += 100;
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
import bisect as bi
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in b:
    A=bi.bisect_left(a,i)
    C=n-bi.bisect_right(c,i)
    ans+=A*C
print(ans)

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

using namespace std;

typedef pair<int,int> pii;

int main(){
  int N;
  while(cin >> N, N > 0){
    int M[N],D[N],h[N],m[N],e[N],p[N],back=0,now=0;
    char ch;
    bool flg[1001]={};

    map<int,int> point;
    for(int i = 0 ; i < N ; i++){
      scanf("%d/%d %d:%d %c %d",
	    &M[i],&D[i],&h[i],&m[i],&ch,&p[i]);
      back=now;
      now=h[i]*60+m[i];
      //cout<<now<<" "<<back<<endl;
      
      if(flg[0]){
	for(int j=1;j<1001;j++){
	  if(!flg[j])continue;
	  point[j]+=(now-back);
	}
      }
      e[p[i]]=(ch=='I');
      flg[p[i]]=e[p[i]];
    }
    
    int ans = 0;
    map<int,int>::iterator it;
    for(it = point.begin() ; it != point.end() ; ++it){
      ans = max(ans,it->second);
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;


int N, P[100000];

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> P[i];
    --P[i];
  }
  stack< int > st;

  string tap;
  for(int i = N - 1; i >= 0; i--) {
    while(st.size() && st.top() > P[i]) {
      tap += "(";
      st.pop();
    }
    tap += ")";
    st.push(P[i]);
  }
  while(st.size()) {
    tap += "(";
    st.pop();
  }
  reverse(tap.begin(), tap.end());


  int ptr1 = 0, ptr2 = 0;
  for(int i = 0; i < tap.size(); i++) {
    if(tap[i] == '(') {
      st.emplace(ptr1++);
    } else {
      if(st.empty() || P[ptr2++] != st.top()) {
        cout << ":(" << endl; // うくやめてえ
        return 0;
      }
      st.pop();
    }
  }

  cout << tap << endl;

}



Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int n;
long long c;
long long x[100100],v[100100],a[100100],b[100100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>c;
	for(int i=1;i<=n;i++)
		cin>>x[i]>>v[i];
	for(int i=1;i<=n;i++)
		a[i]=a[i-1]+v[i]-(x[i]-x[i-1]);
	x[n+1]=c;
	for(int i=n;i>=1;i--)
		b[i]=b[i+1]+v[i]-(x[i+1]-x[i]);
	for(int i=1;i<=n;i++)
		a[i]=max(a[i],a[i-1]);
	for(int i=n;i>=1;i--)
		b[i]=max(b[i],b[i+1]);
	long long res=0;
	for(int i=1;i<=n;i++){
		res=max(res,a[i]); 
		res=max(res,b[i]); 
		res=max(res,a[i]-x[i]+b[i+1]); 
		res=max(res,b[i]-(c-x[i])+a[i-1]); 
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3456
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

		Set<String> ans = new HashSet<String>();
		Set<String> x = new HashSet<String>();
		Set<String> y = new HashSet<String>();

		int max = 0;

		for (int i = 1; i < n; i++) {
			for (int ind = 0; ind < n; ind++) {
				if (ind < i) {
					x.add(s[ind] + "");
				} else {
					y.add(s[ind] + "");
				}
			}

			for (String ss : x) {
				if (y.contains(ss))
					ans.add(ss);
			}

			if (max < ans.size())
				max = ans.size();

			ans = new HashSet<String>();
			x = new HashSet<String>();
			y = new HashSet<String>();
		}

		System.out.println(max);

	}
}


Measured memory_bytes: 24404
using System;
using System.IO;
using System.Linq;

namespace ABC125B
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().Solve();
        }

        void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var V = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var C = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var total = 0;

            for (int i = 0; i < N; i++)
            {
                if (C[i] < V[i])
                {
                    total += V[i] - C[i];
                }
            }

            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

int b[30];
int main(){
	int n,m,c;cin>>n>>m>>c;
	rep(i,m)scanf("%d",&b[i]);
	int ans=0;
	rep(i,n){
		int cnt=c;
		rep(j,m){
			int a;scanf("%d",&a);
			cnt+=a*b[j];
		}
		if(cnt>0)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
#define INF 999999999
#define FOR(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define lin long long

int c[200001];

int main(void)
{
    int n, k;
    cin >> n >> k;
    REP(i, n)
    {
        int a;
        cin >> a;
        c[a]++;
    }

    sort(c, c + 200000);
    reverse(c, c + 200000);

    int res = 0;
    FOR(i, k, n)
    {
        res += c[i];
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N,count = 0,mod = 0;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);}
    while(count >= 0)
    {
        for (int i = 0; i < N; i++)
        {
            mod += A.at(i)%2;
            A.at(i) = A.at(i)/2;
        }
        if(mod != 0)break;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3136
n=int(input())
s=[input()[0] for _ in [0]*n]
l=['M','A','R','C','H']
L=[s.count(x) for x in l]
a=0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            a+=L[i]*L[j]*L[k]
print(a)

Measured memory_bytes: 4632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  // 1回目の往復
  for(int i=0; i < (ty-sy); ++i) cout << "U";
  for(int i=0; i < (tx-sx); ++i) cout << "R";
  for(int i=0; i < (ty-sy); ++i) cout << "D";
  for(int i=0; i < (tx-sx); ++i) cout << "L";
  // 2回目の往復
  cout << "L";
  for(int i=0; i < (ty-sy)+1; ++i) cout << "U";
  for(int i=0; i < (tx-sx)+1; ++i) cout << "R";
  cout << "D";
  cout << "R";
  for(int i=0; i < (ty-sy)+1; ++i) cout << "D";
  for(int i=0; i < (tx-sx)+1; ++i) cout << "L";
  cout << "U";
  cout << endl;
  return 0;
}


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

int main()
{
	int N, R;
	std::cin >> N >> R;

	int ans;
	if (N >= 10)
	{
		ans = R;
	}
	else
	{
		ans = R + 100 * (10 - N);
	}

	std::cout << ans;
}

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

int main() {
  
  double N, D, X, Y;
  cin >> N >> D;

  int answer = 0;
  
  for (int i = 0; i < N; i++) {
      cin >> X >> Y;
      double distance = sqrt(X * X + Y * Y);
      if (distance <= D) {
        answer++;
      }
  }

  cout << answer << endl;
  return 0;

}

Measured memory_bytes: 3832
#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--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;
    int ans = 1000 - N%1000;
    if (ans == 1000) ans = 0;
    cout << ans  << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>

using namespace std;

int main()
{
    int a , b;
    char op;
    cin >> a >> op >> b;
    if (1 <= a && a <= 10000000000&& 1 <= b && b <= 10000000000)
    {
        if (op == '-')
            cout << a - b;
        else if (op == '+')
            cout << a + b;
    }
    return 0;


}


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

signed main(){
  lint N, M; cin >> N >> M;
  vector<lint> a(M);
  lint sum = 0;
  for(lint i = 0; i < M; i++){
    cin >> a[i]; sum += a[i];
  }
  if(sum > N) cout << -1 << endl;
  else cout << N - sum << endl;
}


Measured memory_bytes: 3708
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int ans = 1;
    if (k % 2 == 1) {
        if (a[n-1] == 0) return cout << 0 << endl, 0;
        else if (a[n-1] < 0) {
            int p = 1;
            for (int i = n - 1; i >= n - k; i--) {
                p = (p * a[i] % MOD + 10 * MOD) % MOD;
            }
            cout << p << endl;
            return 0;
        }
        else {
            k--;
            ans = ans * a[n-1] % MOD;
            n--;
        }
    }
    if (k % 2 == 0) {
        int l = 0, r = n - 1;
        for (int i = 0; i < k / 2; i++) {
            if (a[l] * a[l+1] > a[r] * a[r-1]) {
                ans = ans * (a[l] * a[l+1] % MOD + 10 * MOD) % MOD;
                l += 2;
            }
            else {
                ans = ans * (a[r] * a[r-1] % MOD + 10 * MOD) % MOD;
                r -= 2;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N;//回数
  int K;//タス数
  int x;//表示数
  int a;//2倍
  int b;//k足す
  
  cin>>N>>K;
  x=1;
  
  rep(i,N){
    a=x*2;
    b=x+K;
    
    if(a>b){
      x=x+K;
    }
    
    else if(a<=b){
      x=2*x;
    }
  }
    cout<<x<<endl;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(s,e)     ((s)+((e)-(s))/2) 

#define fo(i,a,b)     for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***

    ll l,r,d;

ll cnt(ll n){
    return n/d;
}

void solve()
{
    rd(l,r,d);
    pp(cnt(r)-cnt(l-1));   
    
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    cout<<"\n";
    return 0;
}

Measured memory_bytes: 3540
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

W,H,x,y=rl()
men = W*H/2
dif = 10**(-9)
ans = 0
if W/2-dif <= x and x <= W/2+dif and H/2-dif <= y and y <= H/2+dif:
    ans = 1 

print('{:.6f} {}'.format(men,ans))

Measured memory_bytes: 3064