akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1LL;
    while(n > 0) {
        if(n & 1)
            res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x, ll mod) {
    return mod_pow(x, mod - 2, mod);
}

ll nCr(int n, int r) {
    if(n < r)
        return 0;

    ll ret = 1;
    REP(i, r) {
        (ret *= n - i) %= MOD;
        (ret *= mod_inv(i + 1, MOD)) %= MOD;
    }
    return ret;
}

void solve() {
    ll n;
    cin >> n;

    if(n < 5) {
        cout << 0 << en;
        return;
    }

    n -= 5;
    ll ans = 0;
    REP(i, 12) {
        if(n < i or (n - i) % 2)
            continue;
        //2個セットで分割
        //奇数にしてもいい11区間のうちi箇所を奇数にする
        ans += nCr((n - i) / 2 + 15, 15) * nCr(11, i) % MOD;
        ans %= MOD;
    }
    cout << ans << en;
}

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

    ll t;
    cin >> t;
    while(t--)
        solve();

    return 0;
}


Measured memory_bytes: 3640
<?php
fscanf(STDIN,"%d",$N);
fscanf(STDIN,"%s",$A);
fscanf(STDIN,"%s",$B);
fscanf(STDIN,"%s",$C);

$aA = str_split($A);
$aB = str_split($B);
$aC = str_split($C);

$ans = 0;
for($i=0;$i<$N;$i++) {
    $cns = 0;
    if($aA[$i] != $aB[$i]) {
        $cns++;
    }
    if($aB[$i] != $aC[$i]) {
        $cns++;
    }
    if($aC[$i] != $aA[$i]) {
        $cns++;
    }
    if($cns==3) {
        $ans+=2;
    }elseif($cns==2){
        $ans++;
    }
}
echo $ans;
?>

Measured memory_bytes: 3828
tmp1 = input()
tmp2 = input()
s = ""
t = ""
if (len(tmp1)<=len(tmp2)):
    s = tmp1
    t = tmp2
else:
    t = tmp1
    s = tmp2

dp = [[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if (s[i]==t[j]):
            dp[i+1][j+1] = max(dp[i][j]+1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

ret = ""
i = len(s)
j = len(t)

while(i>0 and j>0):
    if(dp[i][j]==dp[i-1][j]):
        i -= 1
    elif(dp[i][j]==dp[i][j-1]):
        j -= 1
    elif(dp[i][j] != dp[i-1][j-1]):
        ret = s[i-1] + ret
        i -= 1
        j -= 1

print(ret)

Measured memory_bytes: 112604
import heapq
t = 1
def max(a,b):
	if a > b:
		return a
	return b
while t > 0:
	t -= 1
	a,b,c = map(int,input().split())
	k = int(input())
	# v = []
	# l = []
	# if a >= b:
	while k > 0 and a >= b:
		b *= 2
		k -= 1
	while k > 0 and b >= c:
		c *= 2
		k -= 1
	# if c < b:
	# 	c *= 2
	# elif b < a:
	# 	b *= 2
	if a < b and b < c:
		print("Yes")
	else:
		print("No")
	# v = list(map(int,input().strip().split()))[0:n]
	# for i in range(q):
	# 	p = int(input().strip())
	# 	v.append(p)
	# for i in range(n):
	# 	l.append(0)
	# for i in v:
	# 	l[i-1] += 1
	# for i in range(n):
	# 	if(l[i] <= q-k):
	# 		print("No")
	# 	else:
	# 		print("Yes")


Measured memory_bytes: 62196
#include<stdio.h>
int main()
{
	int r=0,j,i;
	char s[128];
	while(scanf("%s",s)!=EOF){
		j=0;
		i=0;
		while(s[i]!=0){
			if(s[i]>='0'&&s[i]<='9'){
				j*=10;
				j+=(s[i]-'0');
			}else{
				r+=j;
				j=0;
			}
			i++;
		}
		r+=j;
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 2588
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    P = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    mini = [IINF]
    for i in range(N):
        mini.append(min(mini[-1],P[i]))
    ans = 0
    for i in range(N):
        if mini[i+1] == P[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    solve()


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

using namespace std;

int main(){
  long long int n;
  long long int a[1000010],b[1000010];
  cin >> n;
  
   for(int i=0;i<n;i++){
  cin >> a[i] >> b[i];
   }
  
 if(n % 2 == 1){
   sort(a,a+n);
   sort(b,b+n);
   
   cout << b[(n/2)]-a[(n/2)]+1 << endl;
 }
  
  else{
    sort(a,a+n);
   sort(b,b+n);
   
    cout << (b[(n/2)]+b[(n/2)-1]-a[(n/2)]-a[(n/2)-1])+1 << endl;
  }
  

  
 
}


Measured memory_bytes: 6748
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//templete
int main() {
	int A,P;
	cin>>A>>P;
	cout<<(A*3+P)/2<<endl;
    return 0;
}

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

int main() {
  string s,t;
  cin >> s;
  rep(i,s.size()) {
    if(s.at(i)!='B') {
      t += s.at(i);
    }
    else if(t!="") {
      t.pop_back();
    }
  }

  cout << t << endl;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    const ll mod=1e9+7;
    int n;
    string s;
    cin >> n >> s;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1));
    dp[0][s.size()]=1;
    rep(i,1,n+1){
        dp[i][0]=dp[i-1][0];
        rep(j,0,n+1){
            //dp[i][j]=dp[i-1][j-1]*2+dp[i-1][j+1];
            if(j>0) dp[i][j]=(dp[i][j]+dp[i-1][j-1]*2%mod)%mod;
            dp[i][j]=(dp[i][j]+dp[i-1][j+1])%mod;
            //cerr << i << " " << j << " " << dp[i][j] << endl;
        }
    }
    cout << dp[n][0] << endl;
}

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


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

int main() {

    int a[3];
    for (int i=0; i<3; i++) {
        cin >> a[i];
    }
    int remain = a[1] + a[2] - a[0];

    if (remain > 0) {
        cout << remain << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = pow(10, 5) + 1;//+1しないとREになる(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

int main(void) {
	ll N;
	cin >> N;
	vector<ll> X(N), L(N), right_end(N), left_end(N);
	typedef pair<ll, ll> P_ll;
	vector<P_ll> p(N), p2(N);
	for (ll i = 0; i < N; i++) {
		cin >> X[i] >> L[i];
		p[i] = P_ll(X[i], L[i]);
		right_end[i] = X[i] + L[i];
		left_end[i] = X[i] - L[i];
		p2[i] = P_ll(right_end[i], left_end[i]);
	}
	sort(p.begin(), p.end());
	//for (ll i = 0; i < N; i++) cout << i << ": " << p[i].first << ", " << p[i].second << endl;
	//sort(right_end.begin(), right_end.end());
	sort(p2.begin(), p2.end());

	ll ans = N;
	ll delete_count = 0;
	for (ll i = 1; i < N; i++) {
		if (p2[i - 1 - delete_count].first > p2[i].second) {
			delete_count++;
			ans--;
		}
		else delete_count = 0;
	}
	cout << ans << endl;
	/* WA解法
	ll ans = N;
	ll delete_count = 0;
	for (ll i = 1; i < N; i++) {
		ll left_robot = p[i - 1 - delete_count].first + p[i - 1 - delete_count].second;
		ll now_robot = p[i].first - p[i].second;
		if (left_robot > now_robot) {
			delete_count++;
			ans--;
		}
		else delete_count = 0;
	}
	
	cout << ans << endl;
	*/

}


Measured memory_bytes: 6528
s=list(map(int,input().split()))
if s[3]<=s[0]:
  print(s[3])
else:
  if s[3]-s[0]<=s[1]:
    print(s[0])
  else:
    if s[3]-s[0]-s[1]<=s[2]:
      print(2*s[0]+s[1]-s[3])
    else:
      print(s[0]-s[2])

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
#define MAXN 2005
#define INF 1000000007


int main()
{ 
	FIN;
	
	#ifdef input
		//freopen("test1.txt", "r", stdin);
	#endif
	
	int x, y;
	cin >> x >> y;
	if(y%2 == 1) cout << "No\n";
	else if(4*x < y) cout << "No\n";
	else if(2*x > y) cout << "No\n";
	else cout << "Yes\n";
	
	
	
	return 0;
}


Measured memory_bytes: 3656
a = int(input())
input_list = input().split()
ans_list=[]
S1 = []
S2 = []
total = 0
for i in range(a):
    total += int(input_list[i])
half_point = total / 2
S1_total_pre = 0
S1_total = 0
for i in range(a):
    S1_total = 0
    for x in range(i+1):
        S1_total += int(input_list[x])
    if abs(half_point-S1_total_pre)==0:
            print(abs(total-S1_total_pre*2))
            break
        
    if  abs(half_point-S1_total) / abs(half_point-S1_total_pre) < 1:
        
        S1_total_pre = S1_total
       
        
    else:
        print(abs(total-S1_total_pre*2))
        break

Measured memory_bytes: 3064
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	a = readline() |> parseInt
	b = readline() |> parseInt
	c = readline() |> parseInt
	d = readline() |> parseInt
	e = readline() |> parseInt
	x = min(a,b,c,d,e)
	k = n%x==0?div(n,x):div(n,x)+1
	println(k+4)
end
main()

Measured memory_bytes: 109724
h, w = gets.split(/\s+/).map(&:to_i)
s = Array.new
h.times do
  s << gets.chomp.split(//)
end

d = Array.new(h){|i| Array.new(w){|j| (i == 0 && j == 0) ? 0 : 100000}}
prev = Array.new(h){|_| Array.new(w)}

queue = Array.new
h.times do |i|
  w.times do |j|
    queue << [i, j] if s[i][j] == "."
  end
end

blank = 0
h.times do |i|
  w.times do |j|
    blank += 1 if s[i][j] == "."
  end
end

until queue.empty?
  ui, uj = queue.min_by{|i, j| d[i][j]}
  queue.delete([ui, uj])
  if ui - 1 >= 0 && s[ui - 1][uj] == "." && d[ui - 1][uj] > d[ui][uj] + 1
    d[ui - 1][uj] = d[ui][uj] + 1
    prev[ui - 1][uj] = [ui, uj]
  end
  if ui + 1 < h && s[ui + 1][uj] == "." && d[ui + 1][uj] > d[ui][uj] + 1
    d[ui + 1][uj] = d[ui][uj] + 1
    prev[ui + 1][uj] = [ui, uj]
  end
  if uj - 1 >= 0 && s[ui][uj - 1] == "." && d[ui][uj - 1] > d[ui][uj] + 1
    d[ui][uj - 1] = d[ui][uj] + 1
    prev[ui][uj - 1] = [ui, uj]
  end
  if uj + 1 < w && s[ui][uj + 1] == "." && d[ui][uj + 1] > d[ui][uj] + 1
    d[ui][uj + 1] = d[ui][uj] + 1
    prev[ui][uj + 1] = [ui, uj]
  end
end

if prev[h - 1][w - 1]
  current = [h - 1, w - 1]
  min = 1
  until current == [0, 0]
    current = prev[current[0]][current[1]]
    min += 1
  end
  puts(blank - min) 
else
  puts(-1)
end

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

Measured memory_bytes: 26672
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b,h;
    cin >> a >> b >> h;
    cout << ((a+b)*h)/2;

    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<cmath>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
ll N, W;
int main() {
	scanf("%lld%lld", &N, &W);
	vector<ll> weight(N), v(N);
	vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));
	rep(i, 0, N)scanf("%lld%lld", &weight[i], &v[i]);
	rep(i, 0, N) {
		rep(w, 0, W + 1) {
			if (w >= weight[i]) dp[i + 1][w] = max(dp[i][w - weight[i]] + v[i], dp[i][w]);
			else dp[i + 1][w] = dp[i][w];
			//printf("%lld ", dp[i + 1][w]);
		}
		//puts("");
	}
	ll ans = 0;
	rep(i, 0, W + 1)ans = max(ans, dp[N][i]);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int n, k; cin >> n >> k;
    int res=0;
    while(n){
        n=n/k;
        res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
//__________________Do_What_You_want___//
//__________I_DO_What_I_Want___________________________//

#include<bits/stdc++.h>
#include <map>
#include "ext/pb_ds/assoc_container.hpp" 
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/detail/standard_policies.hpp"
using namespace __gnu_pbds;
using namespace std ;

//----------------------------------INDEX_TREE-----------------------------------------//
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> multiordered_set;

//-------------------------------------------------------------------------------------//
#define pb push_back 
#define eb emplace_back
#define F first 
#define mk make_pair
#define S second
#define siz(v) (int)v.size() 
#define all(v) (v).begin(),(v).end() 
#define endl '\n'
#define int long long
const int mod = 1000000007 ;
//------------------------------FUNCTIONS----------------------------------------------//
int powermod(int a,int b){int res=1;while(b){if(b&1)(res*=a)%=mod;b/=2;(a*=a)%=mod;}return res%mod;}

int power(int a,int b){int res=1;a%=mod;while(b>0){if(b&1)res*=a;b/=2;a*=a;}return res;}

bool isprime(int n){for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

vector<int> sieve(int n){vector<int> prime ;vector<int> vis(n+1,false);
for(int i=2;i*i<=n;i++){if(vis[i] == false){for(int j=i*i;j<=n;j+=i){vis[j]=true;}}}
for(int i=2;i<=n;i++){if(vis[i]==false){prime.push_back(i);}}return prime;}

long double to_deg(long double x) { return x * 180 / acos(-1); }
int logi(int x){int p = 0 ;while(x>1){p++;x/=2;}return p ;}

int ncr(int n,int r){int p = 1 , l = 1 ;if(n-r < r) r = n-r ;
    while(r){p *= n ;l *= r ;int g = __gcd(p,l) ;p /= g ;l /= g ;n--;r--;}
    return p ;
}

vector<int>_x{0,0,0,1,1,1,-1,-1,-1} ;
vector<int>_y{0,1,-1,0,1,-1,0,1,-1} ;

int mul(int a , int b){return (a*b)%mod ;}
int add(int a , int b){return (a+b)%mod ;}

//-------------------------------------------------------------------------------------//

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    //--------------------------------GETLINE------------------------------------------//
    //cin.ignore();
    //--------------------------------input/output-------------------------------------//
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    //----------------code-------------------------------------------------------------//
    int n,k;
    cin>>n>>k;
    vector<int> a(n) ;
    for(int i=0;i<n;i++) cin>>a[i] ;

    vector<bool> dp(k+1) ;
    for(int stones = 0 ; stones <= k ; stones++){
        for(int i : a){
            if(stones >= i and dp[stones-i] == 0) dp[stones] = 1 ;
        }
    }
    if(dp[k]) cout<<"First" ;
    else cout<<"Second";
}


Measured memory_bytes: 3632
/*
Author: Fuadul Hasan(fuadul202@gmail.com)
BSMRSTU,Gopalganj
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
//#include<bits/stdc++.h>
using namespace std;
 
int         cinn()              {int x; scanf("%d", &x); return x;}
long long   scll()              {long long x; scanf("%lld", &x); return x;}
double      scd()               {double x; scanf("%lf", &x); return x;}
void        coutt(int x)        {printf("%d ", x);}
 
#define  scll                   scll()
#define  gcd(a,b)               __gcd(a,b)
#define  lcm(a,b)               (a*b)/gcd(a,b)
#define  PI                     acos(-1.0)
#define  vi                     std::vector<int>
#define  vll                    std::vector<ll>
#define  vit                    vector<int> :: iterator
#define  sit                    set<int> :: iterator
#define  mpsi                   std::map<string, int>
#define  pb                     push_back
#define  ll                     long long int
#define  ld                     long double
#define  ull                    unsigned long long int
#define  min3(a,b,c)            min(a,min(b,c))
#define  min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define  max3(a,b,c)            max(a,max(b,c))
#define  max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define  nl                     printf("\n");
#define  no                     printf("No");
#define  yes                    printf("Yes");
#define  F                      first
#define  S                      second
 
const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 1e6 + 5;
const int nn           = 2e5 + 5;



int solve()
{
	int a,n,sum=0;
	cin>>a>>n;
	while(n--){
		int x;
		cin>>x;
		sum+=x;
	}
	if(sum>=a){
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	
	
}


int main()
{
    int test = 1, tc = 0;
    //scanf("%d", &test);
   // (void)getchar();
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
using namespace std;

//#define fileio

#ifndef fileio
#include <iostream>
#endif
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <assert.h>
#include <functional>
#include <math.h>
#include <string>
#include <ctime>

typedef long long ll;

#ifdef fileio
ifstream cin;
ofstream cout;
#endif



bool grid[1005][1005];
bool seen[1005][1005];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifdef fileio
    cin.open("Text.txt");
    cout.open("Output.txt");
    #endif
    vector<vector<int> > dirs = { {1, 0}, {0, 1}, {-1, 0}, {0, -1} };
    vector<vector<int> > dirs2 = {};
    for (int i = -2; i < 3; i++) {
        for (int j = -2; j < 3; j++) {
            if (i == 0 && j == 0)continue;
            dirs2.push_back({ i, j });
        }
    }
    int h, w;
    cin >> h >> w;
    int sh, sw, eh, ew;
    cin >> sh >> sw >> eh >> ew;
    sh--;
    sw--;
    eh--;
    ew--;
    vector < pair<int, int>> todo;
    vector < pair<int, int>> nxt;
    int index = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char x;
            cin >> x;
            grid[i][j] = (x == '.');
            seen[i][j] = false;
        }
    }
    todo.push_back({sh, sw});
    int mag = 0;
    while (true) {
        while (index < todo.size()) {
            auto cur = todo[index];
            index++;
            //cout << cur.first << " " << cur.second << endl;
            if (seen[cur.first][cur.second]) continue;
            seen[cur.first][cur.second] = true;
            if (cur.first == eh && cur.second == ew) {
                cout << mag << endl;
                return 0;
            }
            for (auto dir : dirs) {
                if (!(cur.first + dir[0] >= 0 && cur.first + dir[0] < h && cur.second + dir[1] >= 0 && cur.second + dir[1] < w && grid[cur.first + dir[0]][cur.second + dir[1]])) continue;
                todo.push_back({ cur.first + dir[0], cur.second + dir[1] });
            }
            for (auto dir : dirs2) {
                if (!(cur.first + dir[0] >= 0 && cur.first + dir[0] < h && cur.second + dir[1] >= 0 && cur.second + dir[1] < w && grid[cur.first + dir[0]][cur.second + dir[1]])) continue;
                nxt.push_back({ cur.first + dir[0], cur.second + dir[1] });
            }
           
        }
        todo = nxt;
        nxt.clear();
        index = 0;
        if (todo.empty()) break;
        mag++;
    }
    cout << -1 << endl;

}

Measured memory_bytes: 8588
#include<stdio.h>
#include<math.h>
double pi=acos(-1);
int main()
{
    double r;
    scanf("%lf",&r);

    double A,C;

    A=pi*(r*r);
    C=2*pi*r;
    printf("%.6lf %.6lf\n",A,C);
    return 0;
}



Measured memory_bytes: 2708
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n; cin>>n;
	int pr=0;
	bool c=false;
	for(int i=0;i<n;i++)
	{
		int x,y; cin>>x>>y;
		if(x==y)pr++;
		else pr=0;
		if(pr==3)c=true;
	}
	if(c)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3632
package main

import (
	"fmt"
)

func main() {
	var n int
	var amount, total float64
	var unit string

	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&amount, &unit)
		switch unit {
		case "JPY":
			total += amount
		case "BTC":
			total += amount * 380000.0
		}
	}

	fmt.Printf("%.4f\n", total)
}


Measured memory_bytes: 512
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod 1000000007
#define pii pair<int, int>
#define PI 2*acos(0.0)

int dp[3][3];

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

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)









 
int main(){
    ll n;
    cin >> n;
    for(ll i = 1; i <= 9; i++){
        for(ll j = 1; j <= 9; j++){
            if(i * j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
S = input()
q = int(input())
for i in range(q):
    cmd = input().split()
    a = int(cmd[1])
    b = int(cmd[2])
    
    if cmd[0] == "print":
        print(S[a:b+1])
        
    elif cmd[0] == "replace":
        S = S[0:a] + cmd[3] + S[b+1:len(S)]
    
    elif cmd[0] == "reverse":
        r = S[a:b+1]
        S = S[0:a] + r[::-1] + S[b+1:len(S)]
        
        


Measured memory_bytes: 5612
from collections import Counter
n = int(input())
dum = [0]*n
a_li = list(map(int,input().split()))
a_counter = Counter(a_li)
a_most = a_counter.most_common()
count = 0
for i,j in a_most:
    if j >= 2:
        dum[count] = i
    count += 1
dum.sort(reverse=1)
if a_counter[dum[0]] >= 4:
    print(dum[0]**2)
else:
    print(dum[0]*dum[1])

Measured memory_bytes: 22436
<?php

fscanf(STDIN, "%d %d %d", $N, $A, $B);

for($i = 0; $i < $N; $i++) {
    $h[] = trim(fgets(STDIN));
}

//$count = simple_solve($h, $N, $A, $B);
$count = binary_search_solve($h, $N, $A, $B);

echo $count . PHP_EOL;


function simple_solve($h, $N, $A, $B) {
    $array = $h;
    $count = 0;

    do {
        $count++;
        rsort($h);

        // 最大の魔物の体力から$Aを引く
        $h[0] -= $A;

        for($i = 1; $i < count($h); $i++) {
            // その他の魔物の体力から$Bを引く
            $h[$i] -= $B;
        }

        $array = array_filter($h, function($element) {
            return $element > 0;
        });

    } while(!empty($array));

    return $count;
}

function binary_search_solve($hp, $N, $A, $B) {
    $min = 0;
    $max = 10000000000;

    while($max - $min > 1) {

        $burst_count = floor(($min + $max) / 2);

        $count = 0;
        foreach($hp as $h) {
            if ($h > $B * $burst_count) {
                $count += ceil(($h - $B * $burst_count) / ($A - $B));
            }
        }

        if ($count <= $burst_count) {
            $max = $burst_count;
        } else {
            $min = $burst_count;
        }

    }

    return $max;
}


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){ cin >> A[i];}
  
  int count = 0;
  bool flag = false;
  while(true){
    for(int i=0;i<N;i++){
      if(A[i]%2==0){
        A[i] /= 2;
      }else{
        flag=true;
        break;
      }
    }
    if(flag){
      break;
    }
    count++;
  }
  cout << count << endl;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,ans;
string s;

signed main() {
    cin >> n >> s;
    rep(i,s.size()) {
        int a[5000]={},cnt=0,tmpans=0;
        a[0] = s.size()-i;
        rep11(j,s.size()-i) {
            while(j+cnt < s.size()-i && s[i+cnt] == s[i+cnt+j]) cnt++;
            a[j] = cnt;
            tmpans = max(tmpans, min(cnt,j));
            int d = 1;
            while(i+d < s.size() && d+a[d] < cnt) a[j+d] = a[d], d++;
            j += d-1;
            cnt = max(0LL, cnt-d);
        }
        ans = max(ans, tmpans);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    v = [int(i) for i in input().split()]
    v.sort(reverse=True)
    for i in range(N-1):
        tmp = (v.pop()+v.pop())/2
        v.append(tmp)
        v.sort(reverse=True)
    print(v[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
read S
ans=0
for l in $(seq 1 ${#S}); do
    for i in $(seq $l ${#S}); do
        c=$(echo $S|cut -c $i)
        if [ "$c" = A ] || [ "$c" = T ] || [ "$c" = G ] || [ "$c" = C ]; then
            len=$((i-l+1))
            if [ $len -gt $ans ]; then
                ans=$len
            fi
        else
            break
        fi 
    done
done

echo $ans

Measured memory_bytes: 820
from itertools import accumulate
N, C = map(int, input().split())
Distances, Values = [], []
for i in range(N):
    d, v = map(int, input().split())
    Distances.append(d)
    Values.append(v)

# 右回り・左回りそれぞれのvalue累積(左回りは右回り最後尾が0番目になる)
right_acc_values = list(accumulate(Values))
left_acc_values = list(accumulate(Values[::-1]))

# 右回り・左回りそれぞれのdistance(左回りは右回り最後尾が0番目になる)
right_distances = Distances
left_distances = [C - d for d in Distances[::-1]]

# 右回り・左回りに進んでいった場合に手に入るエネルギー
right_result = [v - d for d, v in zip(right_distances, right_acc_values)]
left_result = [v - d for d, v in zip(left_distances, left_acc_values)]

# 右回り・左回りに進んでいった場合に手に入るエネルギーの累積max
right_result_max = [0]
left_result_max = [0]
for i in range(N):
    right_result_max.append(max(right_result_max[-1], right_result[i]))
    left_result_max.append(max(left_result_max[-1], left_result[i]))


ans = 0
for i in range(N):
    ans = max(ans,
              right_result[i],
              left_result[i],
              right_result[i] + left_result_max[N - i - 1] - right_distances[i],
              left_result[i] + right_result_max[N - i - 1] - left_distances[i])

print(ans)


Measured memory_bytes: 35284
N,M=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
MOD=10**9+7
dp=[]
for i in range(len(s)+1):
  dp.append([0]*(len(t)+1))
for i in range(len(s)):
  for j in range(len(t)):
    if s[i] == t[j]: 
      dp[i+1][j+1] = (dp[i+1][j]+dp[i][j+1]+1)%MOD
    else:
      dp[i+1][j+1] = dp[i+1][j]+dp[i][j+1]-dp[i][j]
print((dp[len(s)][len(t)]+1)%MOD)

Measured memory_bytes: 330368
from collections import defaultdict
N,K = map(int,input().split())
A_list = list(map(int,input().split()))
dic = defaultdict(lambda: 0)

for key in A_list:
    dic[key] += 1

change = len(dic) -K

if change <= 0:
  print(0)
else:
  sorted_list = sorted(list(dic.values()))
  Answer = sum(sorted_list[:change])
  print(Answer)

Measured memory_bytes: 32564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

int main() {
    vector<int> vec(5);
    rep(i, 5) {
        cin >> vec[i];
    }

    vector<int> t;
    rep(i, 5) {
        if (vec[i] % 10 != 0) {
            t.push_back((vec[i] / 10 + 1) * 10);
        } else {
            t.push_back(vec[i]);
        }
    }

    vector<int> T;
    rep(i, 5) {
        T.push_back(vec[i] % 10);
    }
    sort(T.begin(), T.end());

    int minIdx;
    int min;
    rep(i, 5) {
        if (T[i] != 0) {
            min = T[i];
            break;
        } else {
            min = 0;
            minIdx = i;
        }
    }
    rep(i, 5) {
        if (vec[i] % 10 == min) {
            minIdx = i;
            break;
        }
    }

    int ans = 0;
    rep(i, 5) {
        if (i == minIdx) continue;
        ans += t[i];
    }
    ans += vec[minIdx];

    print(ans);

}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

from bisect import bisect_left

def solve(n, A, B):
  if sum(A) < sum(B):
    print(-1)
    return

  under = []
  over = []
  for a, b in zip(A, B):
    if a < b: under.append(b-a)
    elif a > b: over.append(a-b)

  over_acc = [0]
  for v in sorted(over, reverse=True):
    over_acc.append(over_acc[-1] + v)

  ans = len(under)
  ans += bisect_left(over_acc, sum(under))
  print(ans)

solve(n, A, B)

Measured memory_bytes: 18356
#include <iostream>
#include <iomanip>
#include<cmath>
using namespace std;

int main(){
    double r;
    cin >> r;
    double pi =acos(-1);

    cout <<fixed <<setprecision(6);
    double area = r*r*pi;
    double cir =(r+r)*pi;
    cout << area<<" " <<cir<<endl;
    
}



Measured memory_bytes: 3276
n = input()
N = int(n)
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

i=0
man=0
oldA=1
for A in a:
  #print(A)
  B = b[int(A)-1]
  #print(B)
  man = man + int(B)
  if i>0:
    if oldA+1==A:
      C = int(c[oldA-1])
      man = man + C
      #print(C)
  i=i+1
  oldA=A
print(man)

Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll p[100005],q[100005],r[100005],d[300005];
ll sum,cnt;
stack<ll> pp,qq;
int main()
{
    int x,y,a,b,c; cin>>x>>y>>a>>b>>c;
    for(int i=1;i<=a;i++)
        scanf("%lld",&p[i]);
    sort(p+1,p+1+a,greater<ll>());
    for(int i=1;i<=x;i++)
        d[cnt++]=p[i];
    for(int i=1;i<=b;i++)
        scanf("%lld",&q[i]);
    sort(q+1,q+1+b,greater<ll>());
    for(int i=1;i<=y;i++)
        d[cnt++]=q[i];
    for(int i=1;i<=c;i++)
    {
        scanf("%lld",&r[i]);
        d[cnt++]=r[i];
    }
    sort(d,d+cnt,greater<int>());
    for(int i=0;i<x+y;i++)
        sum+=d[i];
    cout<<sum;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
long long a[100005];
int main(){
    int n;
    while(~scanf("%d",&n)){
        for(int i=0;i<n;i++)
            scanf("%lld",&a[i]);
        sort(a,a+n);
        long long x,y,ans;
        x=y=0;
        ans=1;
        for(int i=1;i<n;i++){
            if(a[i]==a[i-1])
                ans++;
            else{
                if(ans>=4){
                    x=a[i-1];
                    y=a[i-1];
                }
                else if(ans>=2){
                    x=y;
                    y=a[i-1];
                }
                ans=1;
            }
        }
        if(ans>=4){
            x=a[n-1];
            y=a[n-1];
        }
        else if(ans>=2){
            x=y;
            y=a[n-1];
        }
        //printf("%lld %lld\n",x,y);
        printf("%lld\n",x*y);
    }
return 0;}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

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

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}



const int N_MAX = 2000;
const int A_MAX = 2000;
int N;
int A[N_MAX];

int main(void)
{
    cin >> N;
    REP(i, N) cin >> A[i];
    int S_all = accumulate(A, A + N, 0);
    const int m = N_MAX * A_MAX / 64;
    uint64_t d[m+1];
    REP(i, m + 1) d[i] = 0;
    d[0] = 1ULL << 63;
    for (int i = 0; i < N; i++) {
        int q = A[i] >> 6;
        int r = A[i] & 63;
        for (int j = m - q; j > 0; j--) {
            d[j+q] |= (r == 0 ? 0 : (d[j-1] >> (64-r))) | (d[j] << r);
        }
    }
    FOR(s, (S_all + 1) / 2, S_all + 1) {
        int q = 1 + ((s-1) >> 6);
        int r = (s-1) & 63;
        if (d[q] & (1ULL << r)) {
            cout << s << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    map<string, int> mp;
    string s;
    rep(0, i, N)
    {
        cin >> s;
        mp[s]++;
    }
    int M;
    cin >> M;
    string t;
    rep(0, i, M)
    {
        cin >> t;
        mp[t]--;
    }

    int ans = 0;
    for (auto m : mp)
    {
        ans = max(ans, m.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<climits>
using namespace std;

int main(void){
    int N;
    cin >> N;
    int w[N];
    int min_sub = INT_MAX;
    for(int i=0;i<N;i++){
        cin >> w[i];
    }
    for(int t=0;t<N;t++){
        int s1=0, s2=0;
        for(int i=0;i<t;i++){
            s1 += w[i];
        }
        for(int i=t;i<N;i++){
            s2 += w[i];
        }
        if(abs(s1-s2) < min_sub) min_sub = abs(s1-s2);
    }
    cout << min_sub << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;
 
int main(){
    int a;
    int b;
    int ans;
    cin >> a;
    cin >> b;
    for(int i=1; i<=3; i++){
        if(i!=a && i!=b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int a[33];
int main(void){
  string s;
  string al = "qwertasdfgzxcvb";
  for(int i = 0; i < (int)al.size(); i++){
    a[al[i]-'a'] = 1;
  }

  while(cin >> s && s != "#"){
    int h = a[s[0]-'a'];
    int res = 0;
    for(int i = 1; i < (int)s.size(); i++){
      if(h != a[s[i]-'a']){
	h = a[s[i]-'a'];
	res++;
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a.at(i);
    sort(a.begin(), a.end());
    string ans = "YES";
    for(int i = 1; i < n; ++i){
        if(a.at(i) == a.at(i - 1)) ans = "NO";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3980
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define input freopen("input.txt", "r", stdin);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll x, k, d, pos=LLONG_MAX, neg=LLONG_MAX;
    cin>>x>>k>>d;
    if(x==0){
        if(k%2) cout<<d;
        else cout<<0;
    }
    else{
        x = abs(x);
        ll m = x%d;
        ll c = (x-m)/d;
        ll mv = max(0ll, k-c);
        x=x-(k-mv)*d;
        k=mv;
        if(k%2==0) pos = x;
        else pos = x-d;
        if(k>0){
            k--;
            if(k%2==0) neg = x-d;
            else neg = x;
        }
        ll ans = min(pos, neg);
        cout<<abs(ans);
    }
}


Measured memory_bytes: 3512
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {

    char result[100][100];
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 100; j++) {
            result[i][j] = '.';
        }
    }
    for (int i = 50; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            result[i][j] = '#';
        }
    }

    int a, b;
    cin >> a >> b;

    int x = 0, y = 1;
    for (int i = 1; i < b; i++) {
        if (y >= 100) {
            y = 1;
            x += 2;
        }
        result[x][y] = '#';
        y += 2;
    }
    x = 99;
    y = 1;
    for (int i = 1; i < a; i++) {
        if (y >= 100) {
            y = 1;
            x -= 2;
        }
        result[x][y] = '.';
        y += 2;
    }

    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            cout << result[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 384
using System;

namespace abc148
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            var ans = 0;
            var left = 0;
            for (int i = 0; i < n; i++)
            {
                var right = Array.IndexOf(a, i + 1, left);
                if (right < 0)
                {
                    ans += n - left;
                    break;
                }

                ans += right - left;
                left = right + 1;
            }

            if (ans == n) ans = -1;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 33244
#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int *p = new int[n];
    long double *ex = new long double[n];
    long double max = -1;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }

    for (int i = 0; i < n; i++) {
        ex[i] = 1 + 0.5 * (p[i] - 1);
    }

    long double tmp = 0.0;
    for (int i = 0; i < k; i++) {
        tmp += ex[i];
        if (tmp > max) {
            max = tmp;
        }
    }
    for (int i = k; i < n; i++) {
        tmp = tmp + ex[i] - ex[i - k];
        if (tmp > max) {
            max = tmp;
        }
    }

    cout << setprecision(10) << max << endl;
    return 0;
}


Measured memory_bytes: 4096
n,k = map(int, input().split())
d=[]
A=[]
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
ans=0
s=[]
for h in range(1,n+1):
    for i in range(k):
        for j in range(d[i]):
            if A[i][j] == h:
                if not h in s:
                    ans +=1
                    s.append(h)
    
print(n-ans)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n-1) cin >> a[i];
    map<int, int> m;
    rep(i,n-1){
        m[a[i]]++;
    }
    rep(i,n) cout << m[i+1] << endl;
}

Measured memory_bytes: 13556
// Shift-JIS（シフトジス）

#include <bits/stdc++.h>
using namespace std;

int N;
vector<int> V(50);
vector<int> C(50);


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

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

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

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

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const ll inf = 900900900100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,a;
    cin >> n >> a;
    int x[55]={};
    ll dp[3010][55]={};
    rep(i,n) cin >> x[i];
    dp[0][0]=1;
    rep(i,n){
        rrep(j,2501){
            rrep(k,i+1){
                dp[j+x[i]][k+1] += dp[j][k];
            }
        }
    }
    ll ans=0;
    // REP(i,1,2501){
    //     if(i%a==0){
    //         ans += dp[i][i/a];
    //     }
    // }
    REP(i,1,n+1){
        ans += dp[a*i][i];
    }
    cout << ans << endl;
    return 0;
}


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

int main(void){
    int n = 0;
    int ans = 0, l = 0, r = 0;

    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        scanf("%d%d", &l, &r);
        ans += r - l + 1;
    }

    printf("%d\n", ans);

    return 0;

} 


Measured memory_bytes: 256
#include <stdio.h>

int fi(int *, int);

main(){
  int n, a[45], i;

  scanf("%d", &n);

  for(i = 0;i < 45;i++)a[i] = 0;

  i = fi(a, n);

  printf("%d\n", i);

  return 0;
}
int fi(int *sum, int i){
  if(i == 0||i == 1) return sum[0] = 1;
  else if(sum[i] != 0) return sum[i];
  else return sum[i] = fi(sum, i - 2) + fi(sum, i - 1);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define lol long long
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >>s;
  int ans=0;
  for(int i=0;i<4;i++){
    if(s[i]=='2') ans++;
  }
  cout <<ans<<'\n';
  return (0);
}

Measured memory_bytes: 3608