akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    char c[h][w];
    rep(i,h)rep(j,w)cin >> c[i][j];
    int ans = 0;
    rep(i,1<<h){
        rep(j,1<<w){
            char a[h][w];
            rep(l,h)rep(r,w)a[l][r] = c[l][r];
            bitset<10> f(i);
            rep(l,h){
                if(f[l] == 1){
                    rep(m,w)a[l][m] = '@';
                }
            }
            bitset<10> g(j);
            rep(m,w){
                if(g[m] == 1){
                    rep(l,h)a[l][m] = '@';
                }
            }
            int cnt = 0;
            rep(l,h)rep(m,w)if(a[l][m] == '#')cnt++;
            if(cnt == k)ans++;
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int w, a, b; cin >> w >> a >> b;
	if (a < b) {
		if (a + w >= b)cout << 0 << "\n";
		else cout << b - (a + w) << "\n";
	}
	else if (a > b) {
		if (b + w >= a)cout << 0 << "\n";
		else cout << a - (b + w) << "\n";
	}
	else cout << 0 << "\n";

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007


int main(){
    int a,b;
    cin >> a >> b;
    cout << max(a+b,max(2*a-1,2*b-1)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
string s, t;
int dp[3005][3005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> s >> t;

  REP(i, s.length()) {
    REP(j, t.length()) {
      if(s[i] == t[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      } else {
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    }
  }

  int d = dp[s.length()][t.length()];
  int y = s.length();
  int x = t.length();
  string ans = "";

  while(d > 0) {
    if(dp[y - 1][x] == d) {
      y--;
    } else if(dp[y][x - 1] == d){
      x--;
    } else {
      ans += s[y - 1];
      d--; y--; x--;
    }
  }

  reverse(ans.begin(), ans.end());

  cout << ans << endl;
}


Measured memory_bytes: 35456
#include <cassert>
#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>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#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>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;

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

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

#define INF LONG_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    ll a[3 * n] = {};
    ll sumf[n + 1] = {}, sumb[n + 1] = {};
    priority_queue<ll, vector<ll>, greater<ll>> front;
    priority_queue<ll> back;
    rep(i, 3 * n) {
        cin >> a[i];
        if (i < n) {
            front.push(a[i]);
            sumf[0] += a[i];
        } else if (i > 2 * n - 1) {
            back.push(a[i]);
            sumb[0] += a[i];
        }
    }

    repl(i, n, 2 * n) {
        sumf[i - n + 1] = sumf[i - n] + a[i];
        front.push(a[i]);
        ll t = front.top(); front.pop();
        sumf[i - n + 1] -= t;
    }

    repr(i, 2 * n, n) {
        sumb[2 * n - i] = sumb[2 * n - 1 - i] + a[i];
        back.push(a[i]);
        ll t = back.top(); back.pop();
        sumb[2 * n - i] -= t;
    }

    ll ans = -INF;
    rep(i, n + 1) maxch(ans, sumf[i] - sumb[n - i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6516
import sys

N=int(input())
C=[int(input()) for i in range(N)]
mod=10**9+7

if N==1:
    print(1)
    sys.exit()

S=[C[0]]

for i in range(1,N):
    if C[i]!=C[i-1]:
        S.append(C[i])

L=len(S)

if L==1:
    print(1)
    sys.exit()

AL=[[] for i in range(2*10**5+1)]

for i in range(L):
    AL[S[i]].append(i)

PLUS=[0]*(2*10**5+1)

NOW=1

for i in range(L):
    NOW,PLUS[S[i]]=(NOW+PLUS[S[i]])%mod,(PLUS[S[i]]+NOW)%mod
    #PLUS[S[i]]+=NOW
    

    #print(NOW,PLUS)

#print(PLUS)
print(NOW)
    
    


Measured memory_bytes: 83796
var a,b,i,j:longint;
var s:ansistring;
begin
  readln(a,b);readln(s);
if (length(s)<>a+b+1) or (s[a+1]<>'-') then begin writeln('No');exit;end;
for i:=1 to a do if not (ord(s[i])-ord('0') in [0..9]) then begin writeln('No');exit;end;
for i:=a+2 to length(s) do if not (ord(s[i])-ord('0') in [0..9]) then begin writeln('No');exit;end;
writeln('Yes');end.

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll N, A, x, ans{};
  cin >> N >> A;
  vector<map<int, ll>> V(A * N + 1);
  V[0][0] = 1;
  while (cin >> x)
    for (int i = A * N; i >= x; --i)
      for (auto &[a, b] : V[i - x]) V[i][a + 1] += b;
  for (int i = 1; i <= N; ++i) ans += V[i * A][i];
  cout << ans << endl;
}


Measured memory_bytes: 4972
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
//#define for(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define print(x) std::cout << x << std::endl;

using namespace std;

typedef long long ll;

template<class T, class U> std::string replace(std::string s, const T& target, const U& replacement, bool replace_first = 0, bool replace_empty = 0);
bool isContain(int value, int under, int top);
vector<int> range(int x);

int main(void) {
	//Program Start

	int A, B;
	cin >> A >> B;

	int res = 0;
	if (A > B) {
		res += A; A--;
	}
	else {
		res += B; B--;
	}
	if (A > B) {
		res += A; A--;
	}
	else {
		res += B; B--;
	}

	cout << res << endl;




ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}


vector<int> range(int y) {
	vector<int> result(y);
	for (int i = 0; i < y; i++)
		result[i] = i;
	return result;
}

bool isContain(int value, int under, int top) {
	if (under <= value && value <= top) return true;
	return false;
}

template<class T, class U> std::string replace(std::string s, const T& target, const U& replacement, bool replace_first, bool replace_empty) {
	using S = std::string;
	using C = std::string::value_type;
	using N = std::string::size_type;
	struct {
		auto len(const S& s) { return s.size(); }
		auto len(const C* p) { return std::char_traits<C>::length(p); }
		auto len(const C  c) { return 1; }
		auto sub(S* s, const S& t, N pos, N len) { s->replace(pos, len, t); }
		auto sub(S* s, const C* t, N pos, N len) { s->replace(pos, len, t); }
		auto sub(S* s, const C  t, N pos, N len) { s->replace(pos, len, 1, t); }
		auto ins(S* s, const S& t, N pos) { s->insert(pos, t); }
		auto ins(S* s, const C* t, N pos) { s->insert(pos, t); }
		auto ins(S* s, const C  t, N pos) { s->insert(pos, 1, t); }
	} util;

	N target_length = util.len(target);
	N replacement_length = util.len(replacement);
	if (target_length == 0) {
		if (!replace_empty || replacement_length == 0) return s;
		N n = s.size() + replacement_length * (1 + s.size());
		s.reserve(!replace_first ? n : s.size() + replacement_length);
		for (N i = 0; i < n; i += 1 + replacement_length) {
			util.ins(&s, replacement, i);
			if (replace_first) break;
		}
		return s;
	}

	N pos = 0;
	while ((pos = s.find(target, pos)) != std::string::npos) {
		util.sub(&s, replacement, pos, target_length);
		if (replace_first) return s;
		pos += replacement_length;
	}
	return s;
}


Measured memory_bytes: 504
//Super Metropolis
#include <iostream>

using namespace std;

int main() {
    int W, H, N;
    cin >> W >> H >> N;

    int x, y, sx, sy, cost = 0;
    for(int i = 0; i < N; i++) {
        cin >> sx >> sy;
        if(i != 0) {
            if((x - sx) * (y - sy) >= 0) cost += max(abs(x - sx), abs(y - sy));
            else cost += abs(x - sx) + abs(y - sy);
        }
        x = sx;
        y = sy;
    }

    cout << cost << endl;
}


Measured memory_bytes: 3096
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		String s1 = s.next();
		String s2 = s.next();
		StringBuffer s3 = new StringBuffer();
		s3.append(s1);
		s3 = s3.reverse();
		String s4 = s3.toString();
		if(s4.equals(s2)){
		    System.out.println("YES");
		}
		else{
		    System.out.println("NO");
		}
	}
}


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

int main() {
	int n;cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<int> b;
	int i;
	for(i=n-1;i>=0;i-=2){
		cout<<a[i]<<' ';
	}
	for(i=-1-i;i<n;i+=2){
		cout<<a[i]<<' ';
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 2944
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a int
	fmt.Scan(&a)

	list := make([]int, a)
	for i := 0; i < a; i++ {
		fmt.Scan(&list[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(list)))

	alice := 0
	bob := 0
	for i := 0; i < a; i++ {
		if i%2 == 0 {
			alice += list[i]
		} else {
			bob += list[i]
		}
	}
	fmt.Println(alice - bob)
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A;
  cin >> N >> A;
  int amari = N % 500;
  if(amari <= A)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
 PROGRAM-ID.     TEST103.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
  01 INP        PIC X(400).
  01 A1         PIC 9(3).
  01 A2         PIC 9(3).
  01 A3         PIC 9(3).
  01 WANS       PIC 9(2).
  01 ANS        PIC Z9.

 PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO A1 A2 A3.

  EVALUATE TRUE
      WHEN (A1 <= A2 AND A2 <= A3) OR
           (A1 >= A2 AND A2 >= A3)
        COMPUTE WANS = A1- A3
      WHEN (A2 <= A1 AND A1 <= A3) OR 
           (A2 >= A1 AND A1 >= A3)
        COMPUTE WANS = A2 - A3
      WHEN (A1 <= A3 AND A3 <= A2) OR
           (A1 >= A3 AND A3 >= A2)
        COMPUTE WANS = A1 - A2
  END-EVALUATE.
  MOVE WANS     TO ANS.
  DISPLAY FUNCTION TRIM(ANS).
 STOP RUN.

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF=1000000000;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
vector<string> v;
queue<P> Q;
int main(){
  int N,K;
  cin>>N>>K;
  double sum=0.0;
  for(int i=1;i<=N;i++){
       double tmp=1.0/(double)N;
       int now=i;
       while(now<K){
           now*=2;
           tmp/=2;
       }
       sum+=tmp;
  }
  
  cout<<setprecision(12)<<sum<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int w, h;
vector<int> ans;
vector<vector<bool>> visited(55, vector<bool>(55));
vector<vector<int>> grid(55, vector<int>(55));
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

void _init() {
	rep (i, 51) rep (j, 51) visited[i][j] = false;
}

int dfs(int sy, int sx) {
	visited[sy][sx] = true;
	rep (k, 8) {
		int x = sx + dx[k];
		int y = sy + dy[k];
		if (0 <= x && x < w && 0 <= y && y < h && grid[y][x] && !visited[y][x]) dfs(y, x);
	}

	return 1;
}

int main(void) {
	while (1) {
		cin >> w >> h;
		if (w == 0 || h == 0) break;

		_init();

		rep (i, h) rep (j, w) cin >> grid[i][j];

		int res = 0;
		rep (i, h) rep (j, w) if (!visited[i][j] && grid[i][j]) res += dfs(i, j);
		ans.pb(res);
	}

	rep (i, ans.size()) cout << ans[i] << endl;
	return 0;
}


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

int N;
string S;
int w[300001], e[300001];

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

    cin >> N >> S;
    w[0] = 0; e[N-1] = 0;

    for (int i = 1; i < N; i++) {
        w[i] = w[i-1];
        if (S[i-1] == 'W') w[i] = w[i-1] + 1;

        e[N-i-1] = e[N-i];
        if (S[N-i] == 'E') e[N-i-1] = e[N-i] + 1;
    }

    int ans = 1e9;
    for (int i = 0; i < N; i++) {
        ans = min(ans, w[i] + e[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 2964
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#define M 1010
#define N 1000000
#define LL long long
#pragma GCC optimize(2)
using namespace std;
LL mod=1e9+7,a[N],sum=0,n,ans=0;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++) 
	{
		cin>>a[i];
		ans+=a[i];
	}
	for(int i=0;i<n;i++)
	{
		ans-=a[i];
		sum=sum%mod+(ans%mod)*(a[i]%mod)%mod;
		sum%=mod;
	}
	cout<<sum%mod;
	return 0;
}
/*
*/


Measured memory_bytes: 5168
w, h, n = input().split()              
w, h, n = int(w), int(h), int(n)       
x = []                                 
y = []                                 
a = []                                 
                                       
for _ in range(n):                     
    x_, y_, a_ = input().split()       
    x.append(int(x_))                  
    y.append(int(y_))                  
    a.append(int(a_))                  
W = w                                  
H = h                                  
w_r = w                                
w_l = 0                                
h_u = h                                
h_l = 0                                
for i in range(n):                     
    if a[i] is 1 and x[i]>w_l:         
        w_l = x[i]                     
    if a[i] is 2 and x[i]<w_r:         
        w_r = x[i]                     
    if a[i] is 3 and y[i]>h_l:         
        h_l = y[i]                     
    if a[i] is 4 and y[i]<h_u:         
        h_u = y[i]                     
                                       
ans = (w_r - w_l)*(h_u - h_l)          
if (w_r - w_l) < 0 or (h_u - h_l) < 0: 
    ans = 0                            
print(ans)                             


Measured memory_bytes: 3064
#include <stdio.h>

int main(void) ;

int main(void)
{
  char a[4]={'A','C','G','T'} ;
  char b ;

  scanf("%c", &b) ;

  int i=0 ;
  while(a[i++]!=b)
    ;

  printf("%c", a[4-i]) ;

  return 0 ;
}


Measured memory_bytes: 128
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
using namespace std;
const int N(111);
struct Point {
	double x, y;
	void scan() {
		scanf("%lf%lf", &x, &y);
	}
	Point() {
	}
	Point(const double & a, const double & b) : x(a), y(b) {
	}
	double sqrlen() const {
		return x * x + y * y;
	}
	double len() const {
		return sqrt(max(0., sqrlen()));
	}
	Point zoom(const double & l) const {
		double lambda(l / len());
		return Point(lambda * x, lambda * y);
	}
	Point rev() const {
		return Point(-y, x);
	}
	void print() const {
		printf("%.10f %.10f\n", x, y);
	}
} s[N], t[N];
struct Line {
	Point s, d;
	Line(const Point & a, const Point & b) : s(a), d(b) {
	}
	Line() {
	}
} l[N], l4[N][2];
double eps(1e-10);
__inline int sign(const double & x) {
	return fabs(x) <= eps ? 0 : (x > 0 ? 1 : -1); 
}
__inline bool equal(const double & a, const double & b) {
	return sign(a - b) == 0;
}
__inline Point operator + (const Point & a, const Point & b) {
	return Point(a.x + b.x, a.y + b.y);
}
__inline Point operator - (const Point & a, const Point & b) {
	return Point(a.x - b.x, a.y - b.y);
}
__inline Point operator * (const double & a, const Point & b) {
	return Point(a * b.x, a * b.y);
}
__inline double operator * (const Point & a, const Point & b) {
	return a.x * b.y - a.y * b.x;
}
__inline double operator % (const Point & a, const Point & b) {
	return a.x * b.x + a.y * b.y;
}
__inline Point intersection(const Line & a, const Line & b) {
	double lambda((b.s - a.s) * b.d / (a.d * b.d));
	return a.s + lambda * a.d;
}
__inline double dis(const Point & a, const Point & s, const Point & t) {
	return fabs((s - a) * (s - t)) / (s - t).len();
}
__inline bool operator < (const Point & a, const Point & b) {
	if(!equal(a.x, b.x)) {
		return a.x < b.x;
	}
	if(!equal(a.y, b.y)) {
		return a.y < b.y;
	}
	return false;
}
int main() {
	int n;
	for(int _ = 1; ; _++) {
		scanf("%d", &n);
		if(n == 0) {
			break;
		}
		for(int i(1); i <= n; i++) {
			s[i].scan();
			t[i].scan();
		}
		if(n <= 2) {
			printf("Many\n");
			continue;
		}
		for(int i(1); i <= 3; i++) {
			l[i] = Line(s[i], t[i] - s[i]);
		}
		for(int i(1); i <= 2; i++) {
			if(sign(l[i].d * l[i + 1].d) == 0) {
				l4[i][0] = l4[i][1] = Line(0.5 * (l[i].s + l[i + 1].s), l[i].d);
			}else {
				l4[i][0] = Line(intersection(l[i], l[i + 1]), 0.5 * (l[i].d.zoom(1) + l[i + 1].d.zoom(1)));
				l4[i][1] = Line(intersection(l[i], l[i + 1]), 0.5 * (l[i].d.zoom(-1) + l[i + 1].d.zoom(1)));
			}
		}
		set<Point> st;
		for(int i(0); i < 2; i++) {
			for(int j(0); j < 2; j++) {
				if(sign(l4[1][i].d * l4[2][j].d) != 0) {
					Point p(intersection(l4[1][i], l4[2][j]));
					double d(dis(p, s[1], t[1]));
					bool flag(true);
					for(int k(2); k <= n; k++) {
						double d1(dis(p, s[k], t[k]));
						if(!equal(d1, d)) {
							flag = false;
							break;
						}
					}
					if(flag) {
						st.insert(p);
					}
				}
			}
		}
		if(st.size() == 0) {
			printf("None\n");
		}else if(st.size() >= 2) {
			printf("Many\n");
		}else if(st.size() == 1) {
			st.begin()->print();
		}
	}
}

Measured memory_bytes: 1120
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

//0 -> 使ってない 1 -> 使った
long long dp[100005][2];

long long cal(vector<long long> p) {
	rep(i, p.size() + 4) {
		dp[i][0] = 0;
		dp[i][1] = 0;
	}

	rep(i, p.size()) {
		dp[i+1][0] = max(dp[i][0], dp[i][1]);
		dp[i+1][1] = dp[i][0] + p[i];
	}



	return max(dp[p.size()][0], dp[p.size()][1]);
}

int main(){
	long long N, K, G, C, P;
	string T;
	cin >> N >> K >> G >> C >> P >> T;

	long long ans = 0;
	
	rep(start, K) {
		vector<long long> p;
		char ch = 'x';
		long long cur = start;

		while(cur < N) {
			if(ch == T[cur]) {
				long long num;
				if(ch == 'r') {
					num = P;
				} else if(ch == 's') {
					num = G;
				} else {
					num = C;
				}
				p.push_back(num);
			} else {
				ans += cal(p);
				p.clear();
				ch = T[cur];

				long long num;
				if(ch == 'r') {
					num = P;
				} else if(ch == 's') {
					num = G;
				} else {
					num = C;
				}
				p.push_back(num);
			}

			cur += K;
		}
		ans += cal(p);

	}
	cout << ans << endl;


}


Measured memory_bytes: 6500
object Main{
  def main(args:Array[String]){
    val sc=new java.util.Scanner(System.in)
    val r,c=sc.nextInt
    val a=Array.fill(r,c)(sc.nextInt)
    a.foreach(b=>println(b.mkString(" ")+" "+b.sum))
    var SUM=0
    for(i<-0 until c){
      var sum=0
      for(j<-0 until r){
        sum+=a(j)(i)
        SUM+=a(j)(i)
      }
      print(sum+" ")
    }
    println(SUM)
  }
}

Measured memory_bytes: 58952
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for(i = a; i < b; i++)
#define per(i, a, b) for(i = a; i >= b; i--)
#define all(x) x.begin(), x.end()
#define trav(x, it) for(auto it = x.begin(); it != x.end(); it++)
#define pr(x) cout << #x << " = " << x << endl
#define fill(x,y) memset(x,y,sizeof(x))
#define endl "\n"
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
double eps = 1e-7;
ll mod = 1000000007;
ll N = 998244353;

ll binpow(ll b, ll p){ ll ans = 1; while(p > 0){if(p & 1) ans = (ans * b) % mod; b = (b * b) % mod; p >>= 1;}return ans;}
ll modinv(ll x){return binpow(x, mod - 2);}

void solve()
{
	ll a;
	double b;
	cin >> a >> b;
	ll b2 = b * 100 + 0.5;
	ll ans = a * b2 / 100;
	cout << ans << endl;

}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int t = 1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3744
a, b, c = map(int, input().split())
if a == b and b == c:
    if a % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    count = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
        count += 1
    print(count)

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,x,y,ans[100010];
bool vis[100010]; 
vector <int> g[100010];
queue <int> q;

int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		scanf("%d%d",&x,&y);
		g[x].pb(y);
		g[y].pb(x);
	}
	vis[1]=0;
	q.push(1);
	while(!q.empty())
	{
		int pos=q.front();
		q.pop();
		rep(i,g[pos].size())
		{
			if(vis[g[pos][i]]) continue;
			vis[g[pos][i]]=true;
			ans[g[pos][i]]=pos;
			q.push(g[pos][i]);
		}
	}
	bool ok=true;
	for(int i=2;i<=n;i++) if(ans[i]==0) ok=false;
	if(!ok) puts("No");
	else
	{
		puts("Yes");
		for(int i=2;i<=n;i++) cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 10656
import math
import copy
import sys
import fractions
# import numpy as np
# import statistics
import decimal
import heapq
import collections
import itertools
import bisect


# from operator import mul

# sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputIntList():
    outputDataList = []
    inputData = input().split()
    outputDataList = [int(n) for n in inputData]

    return outputDataList

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())
data = getInputIntList()
t = int(input())
candidate = getInputIntList()

D = set(data)

ans = 0
for c in candidate:
    if c in D:
        ans += 1

print(ans)





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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rell(i,n) for (ll i=0; i< (ll)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());

string yes="Yes",no="No";

ll mod=1e9+7;

int main() {
 ll n;
 cin>>n;
 ll ten=1;
 ll nine=1;;
 ll eig=1;
 rep(i,n){
     ten*=10;
     eig*=8;
     nine*=9;
     ten%=mod;
     nine%=mod;
     eig%=mod;
 }
 ll ans=ten+eig-2*nine;
 ans+=(2*mod);
 ans%=mod;
 cout<<ans<<endl;
    
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,k;cin >> n >>k;
    vl v(n);
    rep(i,n)cin >> v[i];
    ll ans=INF;
    rep(bit,1<<n){
        if(bit%2==0)continue;
        if(__builtin_popcount(bit)<k)continue;
        ll h=v[0]-1;
        ll cost=0;
        rep(i,n){
            if(bit&1<<i&&v[i]>h){
                h=v[i];
                continue;
            }
            if(bit&1<<i&&v[i]<=h){
                cost+=h+1-v[i];
                h++;
                continue;
            }
            if(!(bit&1<<i)&&v[i]>h){
                h=v[i];
                continue;
            }
        }
        chmin(ans,cost);
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 100050
#define LL long long
using namespace std;
int a,b,A,B;
char s[110][110];
int main(){
	//freopen("1.out","w",stdout);
	scanf("%d%d",&a,&b);
	if(a==1&&b==1){
		printf("99 99\n");
		for(int i=1;i<=99;i++){
			for(int j=1;j<=99;j++) s[i][j]='#';
		}
			s[1][1]='.';
			for(int i=1;i<=99;i++){
			for(int j=1;j<=99;j++){
				printf("%c",s[i][j]);
			}
			printf("\n");
		}
		return 0;
	}
	for(int i=1;i<=99;i++){
		for(int j=1;j<=99;j++){
			if(i%4==0) s[i][j]='.';
			else if(j%4==0) s[i][j]='.';
			else if(i%2==0&&j%2==0) s[i][j]='.';
			else s[i][j]='#';
		}
	}
	A=25*25+1;B=25*25;
	int i,j;
	i=2;j=2;
	while(A>a){
		s[i][j]='#';
		j+=4;
		if(j>99){
			i+=4;j=2;
		}
		A--;
	}
	i=0;j=4;
	while(B>b){
		s[i][j]='#';
		s[i][j+1]='#';s[i][j+2]='#';s[i][j+3]='#';
		s[i+1][j]='#';s[i+2][j]='#';s[i+3][j]='#';
		j+=4;
		if(j>99){
			i+=4;j=0;
		}
		B--;
	}
	if(b==1) s[1][1]='.';
	printf("99 99\n");
	for(int i=1;i<=99;i++){
		for(int j=1;j<=99;j++){
			printf("%c",s[i][j]);
		}
		printf("\n");
	}
	return 0;
}
/*
5
5 3 3
2 1 2
2 1 1
4 2 2
4 2 1
2 2 1

*/

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        string cin = Console.ReadLine();
        int ans_n = 0;
        string ans_s = "";
        for (int i = 0; i < 1 << 3; i++)
        {
            ans_n = int.Parse(cin[0].ToString());
            ans_s = "" + cin[0];
            for (int j = 0; j < 3; j++)
            {
                if ((1 & i >> j) == 1)
                {
                    ans_n += int.Parse(cin[j + 1].ToString());
                    ans_s = ans_s + "+" + cin[j + 1];
                }
                else
                {
                    ans_n -= int.Parse(cin[j + 1].ToString());
                    ans_s = ans_s + "-" + cin[j + 1];
                }
            }
            if (ans_n == 7) break;
        }
        Console.WriteLine(ans_s + "=7");
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

#define debug(x) cerr << #x << " = " << x << endl;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;
typedef vector<PII> VPII;

// TEMPLATE DEFINITIONS END

int K;
int DR, IR;

void read_input(){
    cin >> K >> DR;
}

void solve(){

    cout << ((K >= 10) ? DR : DR + (100 * (10 - K))) << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    read_input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n,m; cin >> n >> m;
  int ans = 0;
  for (int i = 1; i*i <= m; i++) {
    if(m%i != 0) continue;
    int q = m/i;
    if(i > ans && i <= m/n) ans = i;
    if(q > ans && q <= m/n) ans = q;
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll l,r;
    cin >> l >> r;
    if(r-l>=2018){
        print(0);
        return;
    }
    ll ans=2019;
    repi(i,l,r){
        repi(j,i+1,r+1){
            chmin(ans,(i*j)%2019);
        }
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<ll> l(n);
  for (int i = 0; i < n; i++) cin >> l[i];
  sort(l.rbegin(), l.rend());
  ll sum = 0;
  for (int i = 0; i < k; i++) sum += l[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
 string s;
 cin >> s;
 if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl; 
 else  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
  vector<int> S = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << S.at(K - 1) << endl;
}

Measured memory_bytes: 256
N = input()


def f(d, used, next):
    num = len(used | set(next))
    if d == 0:
        if num == 3:
            return 1
        else:
            return 0
    elif num == 3:
        return 3 ** d
    elif num == 2:
        return 3 ** d - 2 ** d
    else:
        return 3 ** d - 2 * (2 ** d) + 1


def high(N, used, ret):
    if N:
        if N[0] > "3":
            ret += f(len(N) - 1, used, "3")
        if N[0] > "5":
            ret += f(len(N) - 1, used, "5")
        if N[0] > "7":
            ret += f(len(N) - 1, used, "7")
    else:
        if len(used) == 3:
            ret += 1
        return ret
    if N[0] in ["3", "5", "7"]:
        ret = high(N[1:], used | set(N[0]), ret)
    return ret


def low():
    ret = 0
    for i in range(len(N) - 1):
        ret += 3 * (3 ** i - 2 ** (i + 1) + 1)
    return ret


def main():
    print(high(N, set(), low()))
    return


main()


Measured memory_bytes: 3064
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

S,T = input().split()
A,B = imn()
U = input()

if S == U:
    print(A-1, B, sep=' ')
elif T == U:
    print(A, B-1, sep=' ')

Measured memory_bytes: 5680
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
total = sum(A)
thre = total / (4 * M)

for a in A:
    if a < thre:
        break
    ans += 1

if ans >= M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61960
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
const ll MOD = 1000000007;

ll dfs(int K, const vector<vector<int>>& G, int now, int from)
{
    int availableColorNum = 0;
    if (from == -1)
    {
        availableColorNum = K - 1;
    }
    else
    {
        availableColorNum = K - 2;
    }

    if (K < G[now].size())
    {
        return 0;
    }

    ll caseNum = 1;
    for (const ll to : G[now])
    {
        if (to == from) continue;

        caseNum *= availableColorNum;
        --availableColorNum;
        caseNum %= MOD;
    }

    for (const ll to : G[now])
    {
        if (to == from) continue;

        caseNum *= dfs(K, G, to, now);
        caseNum %= MOD;
    }

    return caseNum;
}

void _main()
{
    int N, K;
    cin >> N >> K;

    vector<vector<int>> G(N);
    rep(i, 0, N - 1)
    {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = K * dfs(K, G, 0, -1);
    ans %= MOD;
    cout << ans << endl;
}


Measured memory_bytes: 11648
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
 
using namespace std;
 
 
int main()
{	int n = 0;
 	long long sum = 0;
 	cin>>n;
    vector<long long> A;
    vector<long long> B;
 for(int i = 0;i<=n;i++){
  int a = 0;
   cin>>a;
   A.push_back(a);
 }
 for(int i = 0;i<n;i++){
  int a = 0;
   cin>>a;
   B.push_back(a);
 }
 
   
  long long nokori = 0;
 for(int i = 0;i<=n;i++){
if(A[i] <= nokori) nokori = A[i];
if(B[i]+nokori>A[i]){
    sum+=A[i];
 
    nokori = B[i] - (A[i]- nokori) ;
}else{
    sum+=B[i]+nokori;
    nokori = 0;
}
 
 }
 cout<<sum;
}

Measured memory_bytes: 2548
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		for (int i = 0; i < H; i++) {
			String s = sc.next();
			System.out.println(s);
			System.out.println(s);
		}
		sc.close();
	}
}

Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;
const int maxn = 5050;
int main(){
    string good = "AKIHABARA";
    string now;
    cin >> now;
    string f;
    int ptr = 0;
    for(int e = 0; e < now.size(); e++){
        if(ptr < good.size() && good[ptr] == 'A' && good[ptr] != now[e]) ptr++;
        if(ptr < good.size() && now[e] == good[ptr]) ptr++;
        else{
            return ! printf("NO\n");
        }
    }
    if(ptr >= good.size()-1) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <map>
#include <random>
#include <string>
#include<vector>
#include<stack>
#include <cstdlib>


using namespace std;


int main() {
	long long ans, a, b, c, k;
	cin >> a >> b >> c >> k;
	if (a > k) {
		ans = k;
	}
	else {
		ans = a;
	}
	
	if (a + b < k) {
		ans -= (k - a - b);
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;

const int INF = 1e9 ;
const int maxN = 1e5 + 5;

int n,Q;
int a[maxN];
int b[maxN];
ll sump;
ll sumn;
ll maxp = 0;
ll maxn = 0;

vector<int> v;
int cntp = 0;
int cntn = 0;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=b[i])
		{
			sump += (ll)(a[i] - b[i]);
			v.push_back(a[i] - b[i]);
		}
		else
		{
			sumn += (ll)(b[i] - a[i]);
			cntn ++;
		}
	}
	if(sump < sumn)
	{
		puts("-1");
		return 0;
	}
	else if(cntn == 0)
	{
		puts("0");
		return 0;
	}
	else
	{
		sort(v.begin(),v.end());
		reverse(v.begin(),v.end());
		ll tmp = 0;
		for(int i=0;i<v.size();i++)
		{
			cntp++;
			tmp += v[i];
			if(tmp >= sumn)
				break; 
		}
	}
	printf("%d\n",cntp + cntn);
	return 0;
} 

Measured memory_bytes: 1660
H, N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
inf = float("inf")
dp = [[inf] * (H+10**4+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(H+10**4+1):
        if j-AB[i][0] >= 0:
            dp[i+1][j] = min(dp[i+1][j-AB[i][0]]+AB[i][1], dp[i][j]) 
        else:
            dp[i+1][j] = dp[i][j]
ans = inf
for i in range(H,H+10**4+1):
    ans = min(ans, dp[-1][i])
print(ans)

Measured memory_bytes: 564232
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (int i = 2; i < MAX; 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(int n, int k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  string s;
  cin>>s;
  if(s=="Sunny") cout<<"Cloudy"<<endl;
  if(s=="Cloudy") cout<<"Rainy"<<endl;
  if(s=="Rainy") cout<<"Sunny"<<endl;
}

Measured memory_bytes: 3552
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

int prime(int num){
    if (num == 2||num == 3) return 1;
    if ((num%2)*(num%3) == 0) return 0;
    
    if (num <= 4) {
        return 0;
    }
    for (int k = 3; k <= int(sqrt(num))+2; k+=2) {
        if (num % k == 0) return 0;
    }
    return 1;
}

int main(){
    int N;
    cin >> N;
    int count = 0;
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        count += prime(num);
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1164