akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < 4; ++i) {
        if (S[i] == '+') {
            ++ans;
        } else {
            --ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#!/usr/bin/env python3

from collections import deque

H, W = map(int, input().split())
graph = [input() for _ in range(H)]

dist = [[0] * W for _ in range(H)]
dist[0][0] = 1 #マスの数なので、初期値は1
q = deque([(0, 0)])

while q:
    y, x = q.popleft()
    for i, j in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        if (not (0 <= y + i < H and 0 <= x + j < W)
                or graph[y + i][x + j] == "#"
                or dist[y + i][x + j] > 0):
            continue
            
        dist[y + i][x + j] = dist[y][x] + 1
        q.append((y + i, x + j))

if dist[H-1][W-1] > 0:
    print(W * H - dist[H-1][W-1] - sum(s.count("#") for s in graph))
else:
    print(-1)


Measured memory_bytes: 39792
import numpy as np

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

N = int(input())
A = np.array([int(x) for x in input().split()],dtype=object)
gcd = np.frompyfunc(gcd,2,1)

print(gcd.reduce(A))


Measured memory_bytes: 23088
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    Int N,M,X,Y;
    cin >>N>>M>>X>>Y;
    string ans = "War";

    vi x = vi(N+1);
    vi y = vi(M+1);

    x[0] = X;
    y[0] = Y;
    REP(i,1,N+1){
        cin >> x[i];
    }

    REP(i,1,M+1){
        cin >> y[i];
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    if(x[x.size()-1]< y[0]){
        ans = "No War";
    }

    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String txt = scanner.nextLine();
        if (n % 2 == 1) {
            System.out.println("No");
        } else {
            char  [] str1 = txt.toCharArray();
            boolean isEcho = true;
            for (int i = 0, j = n/2; i < n/2; i++, j++){
                if (str1[i] != str1[j]) {
                    isEcho = false;
                    break;
                }
            }
            if (isEcho)
                System.out.println("Yes");
            else
                System.out.println("No");
        }
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim_i = (b); i < lim_i; i++)
#define REP(i, ...) REP_((i), __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Mar  7 21:00:01 JST 2020
 **/

signed main() {
    string s;
    cin >> s;
    cout << (s == "AAA" || s == "BBB" ? "No" : "Yes") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] p = new int[5];
        for(int i=0;i<5;i++){
            p[i] = Integer.parseInt(sc.next());
        }
        int k = Integer.parseInt(sc.next());
        sc.close();
        for(int i=0;i<5;i++){
            for(int j=i+1;j<5;j++){
                if(p[j]-p[i] > k){
                    System.out.println(":(");
                    return;
                }
            }
        }
        System.out.println("Yay!");

    }
    
}

Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Schema;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var S = ReadLine();
            var P = long.Parse(S.Substring(0, 2));
            var A = long.Parse(S.Substring(2, 2));
            var flgP = false;
            var flgA = false;
            if (1 <= P && P <= 12) flgP = true;
            if (1 <= A && A <= 12) flgA = true;
            if (flgP && flgA) WriteLine("AMBIGUOUS");
            else if (!flgP && !flgA) WriteLine("NA");
            else if (flgP) WriteLine("MMYY");
            else WriteLine("YYMM");
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 27432
// #include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#define pb emplace_back
#define LOCAL
  
using namespace std;
  
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5+5;
typedef long long ll;
typedef pair<int,int> Pii;
 
template <typename T>inline void read(T& t){
    char c=getchar();t=0;
    int f=1;
    while(!isdigit(c)){
       if(c=='-')f=-1;
        c=getchar();
    }
    while(isdigit(c))t=t*10+c-48,c=getchar();
    t=f*t;
}
  
template <typename T,typename... Args> inline void read(T& t,Args&... args){
    read(t);read(args...);
}
 
int main(){
    int t=1;
    // read(t);
    while(t--){
        int k;
        read(k);
        int sum=7,ans=-1;
        for(int i=0;i<1e7;i++){
            if(sum%k==0){
                ans=i+1;
                break;
            }
            sum=(sum*10+7)%k;
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3192
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace AtCoderABC114
{
    class Program
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            List<int> l = new List<int>();
            for (int i = 0; i < S.Length - 2; i++)
            {
                l.Add(Math.Abs(int.Parse(S.Substring(i, 3)) - 753));
            }
            l = l.OrderBy(x => x).ToList();
            Console.WriteLine(l[0]);
        }
    }
}

Measured memory_bytes: 13268
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        a: [usize; n],
    }
    println!("{}", a.iter().sum::<usize>() - n);
}



Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <functional>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
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;
}
vb d(10);
int ans(int x)
{
    while (x)
    {
        if (d[x % 10])
            return 0;
        x /= 10;
    }
    return 1;
}
//ここからメイン
int main()
{  
  char b;  
    vector<int>a(27);
    while(cin >>b)
    a[b-97]+=1;
rep(i,26){
if(a[i]%2!=0){
    cout <<"No";
return 0;
}
}
cout <<"Yes";
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool cmp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(N);
    int ans;
    for(int i=1;;i++){
        if(i*i>N) {
            ans=(i-1)*(i-1);
            break;
        }
    }
    printf("%d\n",ans);    

    return 0;
}

Measured memory_bytes: 256
<?php

define('INTEREST', 5);

main();

function main() {
	$p = 100000;
	$w = trim(fgets(STDIN));
	echo debt($p, $w) . "\n";
}

function debt($p, $w) {
	for ($i = 0; $i < $w; $i++) {
		$p += INTEREST * $p / 100;
		$p = roundUp($p);
	}

	return $p;
}

function roundUp($n) {
	return ceil($n / 1000) * 1000;
}

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

int main(){
    int n; cin>>n;
    int x[n],y[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    int p[10]={0,1,2,3,4,5,6,7,8,9};

    double sum=0;
    int divide=0;

    do{
        for(int i=0;i<n-1;i++) sum+=sqrt(pow(x[p[i+1]]-x[p[i]],2)+pow(y[p[i+1]]-y[p[i]],2));
        divide++;
    }while(next_permutation(p,p+n));

    cout<<fixed<<setprecision(7)<<sum/divide<<endl;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

ll binpow(ll x, ll y)
{
	ll res = 1;
	while (y)
	{
		if (y & 1)
			res = mul(res, x, MOD);
		y = (y >> 1);
		x = mul(x, x, MOD);
	}
	return res;
}
void solve()
{
	int n;
	cin >> n;
	v64 arr(n, 0);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	ll ans = 0;
	for (ll bit = 0; bit < 61; bit++)
	{
		ll a = 0, b = 0;
		for (int i = 0; i < n; i++)
		{
			if ((arr[i] & (1ll << bit)))
				a++;
			else
				b++;
		}
		ll temp = mul(a, b, MOD);
		temp = mul(temp, binpow(2, bit), MOD);
		ans = add(ans, temp, MOD);
	}
	cout << ans << ln;
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve();
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 2560
import collections
n,m=map(int,input().split())
A=[int(i) for i in input().split()]
B,BB=[0]*m,[0]*m
C=collections.Counter(A)
for a in A:
  B[a%m]+=1
for c in C.keys():
  BB[c%m]+=C[c]//2
ans=B[0]//2
if m%2==0:
  ans+=B[m//2]//2
for i in range(1,(m+1)//2):
  if B[i]<B[m-i]:
    ans+=B[i]
    ans+=min(B[m-i]-B[i],2*BB[m-i])//2
  else:
    ans+=B[m-i]
    ans+=min(B[i]-B[m-i],2*BB[i])//2
print(ans)


Measured memory_bytes: 21208
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    map<int, int> mp;
    for(int i = 2; i <= n; ++i){
        int x = i;
        for(int j = 2; j * j <= x; ++j){
            while(x % j == 0){
                ++mp[j];
                x /= j;
            }
        }
        if(x != 1)  ++mp[x];
    }
    vector<int> c(5, 0);
    for(auto it : mp){
        if(it.second >= 2)  ++c[0];
        if(it.second >= 4)  ++c[1];
        if(it.second >= 14) ++c[2];
        if(it.second >= 24) ++c[3];
        if(it.second >= 74) ++c[4];
    }
    int ans = c[4];
    ans += c[3] * (c[0] - 1);
    ans += c[2] * (c[1] - 1);
    ans += c[1] * (c[1] - 1) / 2 * (c[0] - 2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main() {
	speed;
    int x, y, tx, ty; cin >> x >> y >> tx >> ty;
    int x1 = x, y1 = y;
    string s1 = "", s2 = "", s3 = "", s4 = "";
    while(x != tx) {
        s1 += 'R';
        s2 += 'L';
        x++;
    }
    while(y != ty) {
        s1 += 'U';
        s2 += 'D';
        y++;
    }
    s3 += 'D';
    s4 += 'U';
    while(x1 != tx + 1) {
        s3 += 'R';
        s4 += 'L';
        x1++;
    }
    while(y1 != ty + 1) {
        s3 += 'U';
        s4 += 'D';
        y1++;
    }
    s3 += 'L';
    s4 += 'R';
    cout << s1 + s2 + s3 + s4 << endl;

}


Measured memory_bytes: 3636
list_arr = []
list_vec = []
list_ans = []
gyou, retsu = list(map(int, input().split()))
for count in range(gyou):
    arr = list(map(int, input().split()))
    list_arr.append(arr)
for count in range(retsu):
    vec = int(input())
    list_vec.append(vec)
for count1 in range(gyou):
    for count2 in range(retsu):
        list_ans.append(list_arr[count1][count2] * list_vec[count2])
    print(sum(list_ans))
    list_ans = []


Measured memory_bytes: 6016
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;

const long long p = 1000000007;

int main() {
    
    vector<long long> sg = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55};
    
    int h, w, k;
    cin >> h >> w >> k;
    if (w == 1) {
        cout << 1 << endl;
        return 0;
    }
    
    vector<vector<long long>> dp(h+1, vector<long long>(w, 0));
    
    dp[0][0] = 1;
    
    for (int y = 1; y <= h; y++) {
        for (int x0 = 0; x0 < w; x0++) {
            // go straight
            dp[y][x0] += dp[y-1][x0] * sg[x0] % p * sg[w-x0-1] % p;
            dp[y][x0] %= p;
            if (x0 > 0) { // to left
                dp[y][x0-1] += dp[y-1][x0] * sg[x0-1] % p * sg[w-x0-1] % p;
                dp[y][x0-1] %= p;
            }
            if (x0 < w-1) { // to right
                dp[y][x0+1] += dp[y-1][x0] * sg[x0] % p * sg[w-x0-2] % p;
                dp[y][x0+1] %= p;
            }
        }
    }
    
    cout << dp[h][k-1] << endl;
    
}

Measured memory_bytes: 256
num = int(input())
arr = [int(i) for i in input().split()]
count = 0
for i in arr:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            count += 1
    else:
        continue
if count != 0:
    print("DENIED")
else:
    print("APPROVED")

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

int main() {
  map<string, int> words;
  string input, word_l, word_f;
  int length, freq;
  while(cin >> input) {
    words[input]++;
    if (words[input] > freq) {
      word_f = input;
      freq = words[input];
    }
    if (input.size() > length) {
      word_l = input;
      length = input.size();
    }
  }
  cout << word_f << " " << word_l << endl;
  return 0;
}


Measured memory_bytes: 1196
n, *abc = map(int, input().split())
cond = {'AB': (0, 1), 'AC': (0, 2), 'BC': (1, 2)}
legend = ['A', 'B', 'C']
ans = []
prev_s = ''
for _ in range(n):
    s = input()
    idx1, idx2 = cond[s]
    if abc[idx1] == abc[idx2] == 0 and ans:
        prev_x = ans.pop()
        if prev_x == prev_s[0]:
            prev_y = prev_s[1]
        else:
            prev_y = prev_s[0]
        ans.append(prev_y)
        abc[legend.index(prev_x)] -= 2
        abc[legend.index(prev_y)] += 2

    if abc[idx1] < abc[idx2]:
        abc[idx1] += 1
        abc[idx2] -= 1
        ans.append(legend[idx1])
    else:
        abc[idx2] += 1
        abc[idx1] -= 1
        ans.append(legend[idx2])
    prev_s = s
    if -1 in abc:
        print('No')
        break
else:
    print('Yes')
    for x in ans:
        print(x)


Measured memory_bytes: 9836
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
  char S[10], T[10], U[10];
  int A, B;
  scanf("%s %s", S, T);
  scanf("%d %d", &A, &B);
  scanf("%s", U);
  assert((1 <= A)&&(A <= 10));
  assert((1 <= B)&&(B <= 10));
  assert(strcmp(S, U)||strcmp(T, U));
  if(strcmp(S, U))
    B--;
  else
    A--;
  printf("%d %d", A, B);
}

Measured memory_bytes: 128
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
int pw(int a, int b) {
    int c = 1;
    for (int i = 0; i  < b;i ++) {
        c = (1LL * c * a) % mod;
    }
    return c;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    ll f = pw(10, n);
    f -= 2LL * pw(9, n);
    f += pw(8, n);
    f %= mod;
    if (f < 0) f += mod;
    cout << f;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

main(){
  int i, d = 0, s = 1, n, data[251];
  scanf("%d", &n);
  for(i=1;i<=n;i++) scanf("%d", &data[i]);
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ", i, data[i]);
    if(i/2) printf("parent key = %d, ", data[i/2]);
    if(2*i<=n) printf("left key = %d, ", data[2*i]);
    if(2*i+1<=n) printf("right key = %d, ", data[2*i+1]);
    printf("\n");
  }
  return 0;
}

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

using namespace std;

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

int main() {
	ll x;
	cin >> x;
	ll ans = 0;
	ll cnt = 0;
	for (ll i = 1; i <= x; i++) {
		ans += i;
		cnt++;
		if (ans >= x) {
			break;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
//Author : Ayush Jain

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	int n,arr[100005],i;
	for(i=0;i<100005;i++) arr[i]=0;
	cin>>n;
	while(n--){
		int k;
		cin>>k;
		k++;
		arr[k]++;
		arr[k-1]++;
		arr[k+1]++;
	}
	int ans=-1;
	for(i=0;i<100005;i++){
		ans=max(ans,arr[i]);
	}	
	cout<<ans<<endl;
	return 0;
	
}

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

using namespace std;

typedef long long  ll;

int n, k;
vector<int> w;

bool isPack(int unit)
{
    int num = 1, sum = 0;
    for (int i = 0; i < n; ++i) {
        if (unit < w[i])
            return false;
        if (sum + w[i] <= unit)
            sum += w[i];
        else {
            sum = w[i];
            ++num;
        }

        if (num > k)
            return false;
    }

    return true;
}

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

    int wi;

    cin >> n >> k;
    w.resize(n);
    for (int i = 0; i < n; ++i)
        cin >> w[i];

    int l = 0, r = 100000 * 10000 + 1;
    while (l < r) {
        int mid = (l + r) * 0.5;
        if (isPack(mid))
            r = mid;
        else
            l = mid + 1;
    }

    cout << l << endl;

    return 0;
}

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

int main()
{
    long long n,ta;
    cin>>n>>ta;
    vector<long long> t(n);
    int i;
    for(i=0;i<n;i++)cin>>t.at(i);
    long long ans = 0;
    long long until=0;
    for(i = 0; i < n; i++)
    {
        if(until <= t.at(i))
        {
            ans += ta;
        }
        else
        {
            ans += t.at(i)+ta-until;
        }
        until = t.at(i)+ta;
    }
    cout << ans << endl;
}

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

int main() {
    int n;cin>>n;
    long long dp[n+1][3],a[n][3];
    for(int i=0;i<n+1;i++) for(int j=0;j<3;j++) dp[i][j]=0;
    for(int i=0;i<n;i++) for(int j=0;j<3;j++) cin>>a[i][j];
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            if(j==0) dp[i+1][j]=max(dp[i][1]+a[i][0],dp[i][2]+a[i][0]);
            else if(j==1) dp[i+1][j]=max(dp[i][0]+a[i][1],dp[i][2]+a[i][1]);
            else if(j==2) dp[i+1][j]=max(dp[i][0]+a[i][2],dp[i][1]+a[i][2]);
        }
    }
    long long ans=max(max(dp[n][0],dp[n][1]),dp[n][2]);
    cout<<ans<<endl;
}

Measured memory_bytes: 4992
N = int(input())
A_array = map(int, input().split())
B_array = map(int, input().split())

AB_use = []
BA_use = []
for a, b in zip(A_array, B_array):

    if a > b:
        BA_use.append((b, a))

    elif b > a:
        AB_use.append((a, b))

ans = N

if len(AB_use):
    if len(AB_use) == 1:
        w, v = AB_use[0]
        ans = v * (ans//w) + (ans % w)
    else:
        ans_array = [0] * (ans + 1)
        for i in range(1, ans + 1):
            ans_max = ans_array[i - 1] + 1
            for j in AB_use:
                w, v = j
                if w <= i:
                    ans_max = max(ans_max, ans_array[i - w] + v)
            ans_array[i] = ans_max
        # print(ans_array)
        ans = ans_array[ans]


if len(BA_use):
    if len(BA_use) == 1:
        w, v = BA_use[0]
        ans = v * (ans//w) + (ans % w)
    else:
        ans_array = [0] * (ans + 1)
        for i in range(1, ans + 1):
            ans_max = ans_array[i - 1] + 1
            for j in BA_use:
                w, v = j
                if w <= i:
                    ans_max = max(ans_max, ans_array[i - w] + v)
            ans_array[i] = ans_max
        ans = ans_array[ans]
        # print(ans_array)
print(ans)

Measured memory_bytes: 227864
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
//#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int main(void)
{
    int n;
    cin >> n;
    vll a(n), b(n), c(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) cin >> b[i];

    ll sum = 0;
    int ans = 0;
    rep(i, 0, n)
    {
        c[i] = a[i] - b[i];
        sum += c[i];
    }
    if (sum < 0)
        ans = -1;
    else
    {
        sort_v(c);
        sum = 0;
        rep(i, 0, n)
        {
            if (c[i] < 0)
            {
                sum += c[i];
                ans++;
            }
            else
                break;
        }
        repm(i, n - 1, 0)
        {
            if (sum < 0)
            {
                sum += c[i];
                ans++;
            }
            else
                break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef  vector<int> vi ;
typedef  vector<string> vs ;
typedef  vector<long long> vl ;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) FOR(i,0,n)
ll freq[10000000] = {0};
int main() {

  int n;
  cin>>n;
  vi lol;
  rep(i,n)
  {
    int p;
    cin>>p;
    lol.push_back(p);
  }
  int cans = 0,minn=1000000;
  rep(i,n)
  {
    cans+=lol[i];
    int ban=0;
    for(int j = i+1; j < n; j++)
    {
      ban+=lol[j];
    }
   // cout<<cans<<" "<<ban<<endl;
    minn = min(minn,abs(cans-ban));
  }
  cout<<minn<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x).size()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

signed main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int a, b;
	cin >> a >> b;
	cout << max(0ll, a - 2 * b) << "\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5, mod = 1e9 + 7;
ll dp[maxn];
set<int> si;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m;
    cin >> n >> m;
    while (m--){
        int x;
        cin >> x;
        si.insert(x);
    }
    dp[0] = 1;
    for (int i = 1; i <= n; ++i){
        if (si.count(i)) continue;
        if (i - 1 >= 0) dp[i] += dp[i - 1];
        if (i - 2 >= 0) dp[i] += dp[i - 2];
        dp[i] %= mod;
    }
    cout << dp[n] << endl;
    return 0;
}


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

int main()
{
	int i,j,k,n;
	
	//cin >> n;
	
	double d,s,t;
	
	cin >> d>> s >>t;
	if(d/s <= t)
		cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


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

#define ll 				long long int
#define gof 			for(long long int i = 0 ; i < n ; i++)
#define for1(i,s,e) 	for(long long int i = s ; i < e ; i++)
#define forr(i,e,s) 	for(long long int i = e ; i >= s; i--)
#define gthru(i,n)		for(long long int i = 0 ; i < n ; ++i)
#define vi 				vector<long long int>
#define all(x) 			x.begin(), x.end()
#define pb(x) 			push_back(x)
#define maxv(x) 		*max_element(x)
#define minv(x) 		*min_element(x)
#define mkvec(type,a,n) vector<type> a(n)

const ll ARR = 1e5;
const ll INF = 1e9;
const ll mod = 1e9+7;

void IO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}

void solve(){

	int n;
	cin >> n;
	ll a[ARR+2];
	gof cin >> a[i];

	ll dp[ARR+2];
	dp[0] = 0; dp[1] = abs(a[1] - a[0]);

	for1(i,2,n){
		dp[i] = min(dp[i-1] + abs(a[i-1] - a[i]),dp[i-2] + abs(a[i-2] - a[i]));
	}

	cout << dp[n-1] << "\n";

}

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




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

using namespace std;

int main(){
  string s;
  cin >> s;
  
  int count =0;
  
  if(s[0] == 'o'){
    count++;
  }
  if(s[1] == 'o'){
    count++;
  }
  if(s[2] == 'o'){
    count++;
  }
  
  cout << 700+100*count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;
using namespace std;

int main(){
    string s;
    cin>>s;
    int ans=0;
    for(int i=0; i<3; i++){
        if(s[i]=='1') ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, heal=0;
  cin >> N;
  vector<int> d(N);
  for (int i=0; i<N; i++)
    cin >> d.at(i);
  for(int i=0; i<N-1; i++){
    for (int j=i+1; j<N; j++){
      heal += d.at(i) * d.at(j);
    }
  }
  cout << heal << endl;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var t = int.Parse(line[1]);

        line = Console.ReadLine().Trim().Split(' ');
        var anscost = 99999999;
       var wcost = int.Parse(line[0]);
        var wt = int.Parse(line[1]);
        if (wt <= t) anscost = wcost;
        for (int i = 1; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (b <= t && a < anscost ){ anscost = a;  }
        }
        if (anscost == 99999999) Console.WriteLine("TLE");
        else Console.WriteLine(anscost);
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  ll s=0;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
    s^=A[i];
  }

  for(int i=0;i<N;i++){
    cout << (ll)(s^A[i]) << " ";
  }

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 4840
#include <stdio.h>

int main(void)
{
    int ans = 0;
    int n, c[100], a = 0, b = 0;
    int i, j;

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &c[i]);

    for (i = 0; i < n - 1; i++)
        for (j = n - 1; j > i; j--)
            if (c[j - 1] < c[j])
            {
                int tmp = c[j - 1];
                c[j - 1] = c[j];
                c[j] = tmp;
            }

    for (i = 0; i < n; i++)
    {
        if (i % 2 == 0)
            a += c[i];
        else
            b += c[i];
    }
    ans = a - b;

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

    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;

//mt19937 random(566);
//uniform_int_distribution<ll> distr;
//ll rnd(ll a, ll b) {return a + distr(random) % (b - a + 1);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vi a{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;
    k--;
    cout << a[k];
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
void compareNum(int a,int b);
using namespace std;
int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a >> b;
    compareNum(a, b);
    return 0;
}
void compareNum(int a,int b){
    if (a > b) {
        cout << "a > b" <<endl;
    }else if (a == b) {
        cout << "a == b" <<endl;
    }else{
        cout << "a < b" <<endl;
    }
}


Measured memory_bytes: 3088
n = int(input())
h = list(map(int, input().split()))

inf = 2**63-1
dp = [inf] * (n+1)
dp[1] = 0

for i in range(1, n):
    if i+1 <= n:
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1-1]-h[i-1]))
    if i+2 <= n:
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2-1]-h[i-1]))

print(dp[n])

Measured memory_bytes: 13928
//Subhash Suman
//Date: 13/02/19 ; Day: Wednesday ; Time: 20::06::02 
//Description : 

#include<bits/stdc++.h>
#define ll long long int
#define MAX INT_MAX
#define MIN INT_MIN
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>

using namespace std;
const int N = 305;
int n;
double dp[N][N][N];
int arr[N];

double func(int a,int b,int c,int t){
    //base case
    if(t==0){
        return 0;
    }
    if(a<0 || b<0 || c<0){
        //cout<<a<<b<<c<<endl;
        return 0;
    }
    if(dp[a][b][c]==0){
        double x = ((double)n/t);
        x += ((double)c/t)*func(a,b+1,c-1,t);
        x += ((double)b/t)*func(a+1,b-1,c,t);
        x += ((double)a/t)*func(a-1,b,c,t-1);
        dp[a][b][c] = x;
        return x;
    }
    else {
        return dp[a][b][c];
    }
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
    cin>>n;
    int a=0,b=0,c=0;
    cout<<setprecision(14)<<fixed;
    for(int i = 0; i < n; i++){
        cin>>arr[i];
        if (arr[i]==1) {
            a++;
        }
        else if(arr[i]==2) {
            b++;
        }
        else {
            c++;
        }
    }
    //cout<<a<<b<<c<<'\n';
    cout<<func(a,b,c,n)<<'\n';
    return 0;
}

Measured memory_bytes: 219392
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, k, n, a, b, ans=0, po=0, x, y;
    char name[30];
    scanf("%lld %lld", &x, &y);
    if(y%2 != 0) printf("No");
    else if(2*x <= y && y <= 4*x) printf("Yes");
    else printf("No");

}

Measured memory_bytes: 1736
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections

N = int(input())
A = collections.Counter(prime_factorize(N))

ans = 0
for a in A.values():
	b = 1
	c = 1
	while True:
		if b > a:
			break
		c+=1
		b = b + c
	ans+=c-1
print(ans)




#import math

#A,B = input().split()



#C = int(int(A) * float(B) * 100)


#print(C // 100)

#N = int(input())
#As = list(map(int,input().split()))

#sum = 1

#if any(b == 0 for b in As):
#	sum = 0
#else:
#	for a in As:
#		sum*=a
#		if sum > 1000000000000000000:
#			sum = -1
#			break
#print(sum)


#A,B=map(int,input().split())

#print(A*B)




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

#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

int a[2010];
int N, Z, W;
int dp[2010][2010][2];

int func(int n, int id, int f) {
    //cout << n << " " << id << " " << f << endl;
    if ( n == N ) {
        //cout << n << " " << id << " " << f << endl;
        //cout << abs(a[n] - a[id]) << endl;
        return abs(a[n] - a[id]);
    }
    if ( dp[n][id][f] >= 0 ) return dp[n][id][f];
    int ret;
    if ( f == 0 ) {
        ret = max(func(n+1, id, f), func(n+1, n, f^1));
    } else {
        ret = min(func(n+1, id, f), func(n+1, n, f^1));
    }
    return  (dp[n][id][f] = ret);
}

signed main() {
    cin >> N >> Z >> W;
    memset(dp, -1, sizeof(dp));
    Rrep(i, 1, N+1) cin >> a[i];
    a[0] = W;
    cout << func(1, 0, 0) << endl;
}


Measured memory_bytes: 63488
#include <bits/stdc++.h>
using namespace std;
int a,b,c,x,ans;
int main()
{
    cin>>a>>b>>c>>x; 
    for(int i=0;i<=a;i++)
        for(int j=0;j<=b;j++)
            for(int k=0;k<=c;k++)
                if(500*i+100*j+50*k==x)
					ans++;
    cout<<ans; 
    return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int MAXV = 1e5 + 10;
const int MAXN = 1e3 + 10;
const ll INF = 1e13;
int main()
{
	ll dp[MAXV];
	ll n,W,V=0;
	cin>>n>>W;
	ll w[n],v[n];
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
		V+=v[i];
	}
	dp[0]=0;
	for(ll i=1;i<=V;i++)
	dp[i]=INF;
	for(ll k=1;k<=n;k++)
	{
		for(ll i=V;i>=v[k];i--)
		{
			dp[i]=min(dp[i],dp[i-v[k]]+w[k]);
		}
	}
	for(ll i=V;i>=0;i--)
	{
		if(dp[i]<=W)
		{
			cout<<i<<endl;
			break;
		}
	}
}

Measured memory_bytes: 1024
kanban = input()
Kanban = list(kanban)

K_n = 0
U_n = 0
P_n = 0
C_n = 0

for i in Kanban:
    if i == 'K':
        K_n += 1
    elif i == 'U':
        U_n += 1
    elif i == 'P':
        P_n += 1
    elif i == 'C':
        C_n += 1

n = [K_n, U_n, P_n, C_n]
print(min(n))


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

using namespace std;

int main() {
    int N;
    cin >> N;
    set<string> s;

    string tmp = "";
    for (int i = 0; i < N; ++i) {
        cin >> tmp;
        s.insert(tmp);
    }
    cout << to_string(s.size()) << endl;

}


Measured memory_bytes: 19268
#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() {
    int n;
    cin >> n;

    int cpN = n;
    int digitSum = 0;
    while(cpN > 0) {
        digitSum += cpN % 10;
        cpN /= 10;
    }
    if (n % digitSum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

int main() {
	int N, x, max;
	x = 0;
	max = 0;
	string s;
	cin >> N;
	cin >> s;

	for (int i = 0; i < N; i++) {
		char moji;
		moji = (char)s[0];
		if (moji == 'I') {
			x++;
		}
		else if (moji = 'D') {
			x--;
		}
		if (max < x) {
			max = x;
		}
		s.erase(s.begin());
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;
typedef vector<int> ve;
int main(){
    string S;
    int K;
    cin>>K>>S;
    if(S.size()<=K){
        cout<<S<<endl;
    }else{
        cout<<S.substr(0,K)+"..."<<endl;
    }



    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 1001002003004005006ll;
const ll INF = 1001001001;
const double pi = acos(-1);

int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    vector<ll> b(m);
    vector<ll> cuma(n + 1, 0);
    vector<ll> cumb(m + 1, 0);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        cuma[i + 1] += cuma[i] + a[i];
    }
    for (ll i = 0; i < m; i++)
    {
        cin >> b[i];
        cumb[i + 1] += cumb[i] + b[i];
    }
    ll s = 0;
    ll t = 0;
    ll ti = 0;
    ll ans = 0;
    for (int i = 0; i <= n; i++)
    {
        ll tmp = k - cuma[i];
        if (tmp < 0)
        {
            break;
        }
        ll x = lower_bound(cumb.begin(), cumb.end(), tmp) - cumb.begin();
        if (tmp == cumb[x])
        {
            ans = max(ans, i + x);
        }
        else
        {
            ans = max(ans, i + x - 1);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9588