akhauriyash/Code-Regression huggingface dataset:
//
//AtCoder Beginner Contest 164
//B - Battle
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define reAll(x) (x).rbegin(),(x).rend()

using ll = long long;

const double PI = 3.14159265358979323846;
const int MOD = 1000000007;

int main()
{
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    int t = 0;
    while(true){

        if (t%2 == 0) {
            c -= b;
        }else{
            a -= d;
        }
        t++;
        if ((a <= 0) || (c <= 0 )) break;
    }
    if (a>0) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
a=[int(input()) for i in range(n)]
a.sort()
if n==2:
    print(a[1]-a[0])
    quit()

ans=0
for i in range((n-1)//2):
    ans-=a[i]
for i in range((n-2)//2):
    ans+=a[n-1-i]
ans*=2
if n%2!=0:
    ans+=a[n//2]+a[n//2+1]
else:
    ans+=a[n//2]-a[n//2-1]

ans2=0
for i in range((n-1)//2):
    ans2+=a[n-1-i]
for i in range((n-2)//2):
    ans2-=a[i]
ans2*=2
if n%2!=0:
    ans2-=a[n//2]+a[n//2-1]
else:
    ans2+=a[n//2]-a[n//2+1]

# print(ans)
# print(ans2)

print(max(ans,ans2))

Measured memory_bytes: 46300
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Diagnostics;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class abc154_d
    {

#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            int N, K;

            readint(out N, out K);
            int[]A = ReadIntArray();

            // 先頭の K 個の合計を求める
            double sumK = 0;
            for(int i=0;i<K;i++)
            {
                sumK += kitai(A[i]);
            }
            double maxK = sumK;

            // 残りの期待値をすべて調査する
            for(int i=K;i<N;i++)
            {
                double nextK = sumK - kitai(A[i - K]) + kitai(A[i]);
                if (nextK > maxK)
                {
                    maxK = nextK;
                }
                sumK = nextK;
            }

            println(maxK.ToString());
        }

        private static void println(string s)
        {
            Console.WriteLine(s);
        }

        private static int readint()
        {
            String s = Console.ReadLine();
            return int.Parse(s);
        }

        static Dictionary<int, double> kitaiDic = new Dictionary<int, double>();

        static double kitai(int n)
        {
            if (kitaiDic.ContainsKey(n))
            {
                return kitaiDic[n];
            }
            // n は 1000 以下
            long sum = 0;
            for(int i=1;i<=n;i++)
            {
                checked
                {
                    sum += (long)i;
                }
            }
            double k = (double) sum / n;
            kitaiDic[n] = k;

            return k;
        }

        private static void readint(out int a, out int b)
        {
            int[] ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i]);
            }
            return ar;
        }

#if TEST
#else
    }
}
#endif

Measured memory_bytes: 28380
#include <stdio.h>
#include <string.h>
 

 
int main(void)
{
    char s[101];
        scanf("%s", &s); 
        int res =0; 
        int n = strlen(s);
  
  for(int i=0;i < n;i++){
        if(s[i] != s[n-1-i]){
                res++;
        }   
  }
  printf("%d\n", res/2);
  return 0;
}


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

typedef long long ll;

main()
{
    int n, sum = 0;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    sort(arr, arr+n, greater<int>());
    arr[0] = arr[0]/2;
    for(int i = 0; i < n; i++){
        sum = sum + arr[i];
    }
    cout << sum;

}





///promy_pompom
//hello world


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

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

    int h, w;
    cin >> h >> w;
    vector<string> v(h + 1);
    for(int i = 1; i <= h; i ++) {
        cin >> v[i];
        v[i] = " " + v[i];
    }

    vector<vector<int>> dpsus(h + 1, vector<int> (w + 1, 0));
    vector<vector<int>> dpst(h + 1, vector<int> (w + 1, 0));
    for(int i = 1; i <= h; i ++) {
        for(int j = 1; j <= w; j ++) {
            if(v[i][j] != '#') {
                dpsus[i][j] = dpsus[i - 1][j] + 1;
                dpst[i][j] = dpst[i][j - 1] + 1;
            }
        }
    }

    vector<vector<int>> dpjos(h + 2, vector<int> (w + 2, 0));
    vector<vector<int>> dpdr(h + 2, vector<int> (w + 2, 0));
    for(int i = h; i >= 1; i --) {
        for(int j = w; j >= 1; j --) {
            if(v[i][j] != '#') {
                dpjos[i][j] = dpjos[i + 1][j] + 1;
                dpdr[i][j] = dpdr[i][j + 1] + 1;
            }
        }
    }

    int ans = 0;
    for(int i = 1; i <= h; i ++)
        for(int j = 1; j <= w; j ++)
            ans = max(ans, dpsus[i][j] + dpjos[i][j] + dpst[i][j] + dpdr[i][j] - 3);
    cout << ans;

    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  double r;cin>>r;
  cout<<fixed<<setprecision(12)<<2*r*M_PI<<endl;

  return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
long M=1e9+7,n,k,ans=1,l,r,b=1,a[1<<18],x,y,i;
main(){
  cin>>n>>k;
  r=n-1;
  for(i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  if(k%2)ans=a[r],r--,k--,b=(ans<0?-1:1);
  while(k){
    x=a[l]*a[l+1],y=a[r]*a[r-1];
    if(x*b>y*b)ans*=x%M,ans%=M,l+=2;
    else ans*=y%M,ans%=M,r-=2;
    k-=2;
  }
  cout<<(ans+M)%M<<endl;
}


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

int main() {
 
  int n, m;
  cin >> n >> m;
  int a, freq[m + 1]= {0}, b;
  for(int i = 0; i < n; ++i) {
   cin >> a;
    for(int j = 1; j <= a; ++j) {
     cin >> b;
      freq[b]++;
    }
  }
  int cnt = 0;
  for(int i = 1; i <= m; ++i) {
   if(freq[i] == n)
      ++cnt;
  }
  cout << cnt;
  
  
}

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

#define all(x) (x).begin(), (x).end()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

int main() {
  _upgrade;

  int n;
  cin >> n;
  if (n >= 1800) {
    cout << 1 << "\n";
  } else if (n >= 1600) {
    cout << 2 << "\n";
  } else if (n >= 1400) {
    cout << 3 << "\n";
  } else if (n >= 1200) {
    cout << 4 << "\n";
  } else if (n >= 1000) {
    cout << 5 << "\n";
  } else if (n >= 800) {
    cout << 6 << "\n";
  } else if (n >= 600) {
    cout << 7 << "\n";
  } else {
    cout << 8 << "\n";
  }

  return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(int, N, K);
    vector<int> a(N);
    read(a);
    sort(all(a), greater<>());
    print(accumulate(begin(a), begin(a) + K, 0LL));

    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	scanf("%d", &n);
	vector<LL> as(n);
	for(int i = 0; i < n; ++i){
		scanf("%lld", &as[i]);
	}
	
	LL ans = as[0] - 1;
	LL m = 2;
	for(int i = 1; i < n; ++i){
		if(as[i] == m){
			++m;
		}
		else{
			ans += (as[i] - 1) / m;
		}
	}
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


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

#define int long long

using namespace std;



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

    int L, R, D;

    cin >> L >> R >> D;

    int res = 0;

    for(int i = L ; i <= R ; i++)
    {
    	if(i%D == 0)res++;
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3612
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		
		String line = scan.nextLine();
		String[] words = line.split(" ");
		int max = 0, longest = 0;
		String sMax = "", sLong = "";
		int len = words.length;
		int[] counts = new int[len];
		for(int i = 0; i < len; i++){
			if(longest < words[i].length()){
				longest = words[i].length();
				sLong = words[i];
			}
			for(int j = i+1; j < len; j++){
				if(words[i].equals(words[j])){
					counts[i]++;
					if(max < counts[i]){
						max = counts[i];
						sMax = words[i];
					}
				}
			}
		}
		System.out.printf("%s %s\n", sMax, sLong);
	}
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second
 
ll mod = 1e9+7;
 
ll max(ll a, ll b ) {
	if(a>b)
		return a;
	else return b;
}
ll min(ll a, ll b ) {
	if(a<b)
		return a;
	else return b;
}
 
ll gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
ll inv(ll a) {
	ll x, y;
	ll g = gcd(a, mod, x, y);
	x = (x % mod + mod) % mod;
	return x;
}
ll binpow(ll a, ll b, ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a%m;
        a = a * a%m;
        b >>= 1;
    }
    return res;
}

int main() {
	ll ttt;
	//cin>>ttt;
	ttt = 1;
	while(ttt--) {
		ll n,x,t; cin>>n>>x>>t;
		ll c = n/x;
		if(n%x!=0) c++;
		cout<<c*t;
 	}	
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) ((x).begin()),((x).end())
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimization ("unroll-loops")
#define int ll
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using pii = pair<int, int>;
using ppp = pair<int , pii>;
const int MOD = 1000000007;
int groups[3];
int a[101010];
int answer = 1;
int32_t main()
{
	usecppio
	int n;
	cin >> n;
	for (int i = 0; i<n; i++)
	{
		cin >> a[i];
		int ct = 0;
		int mark = -1;
		for (int j = 0; j<3; j++)
		{
			if (groups[j] == a[i])
			{
				ct++;
				mark = j;
			}
		}
		groups[mark]++;
		answer *= ct;
		answer %= MOD;
	}
	cout << answer << '\n';
}

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

typedef long long ll;

ll n;

ll enum_div(ll n){
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i){
		if(n%i == 0){
			ret.push_back(i);
		}
	}
	return ret.back();
}

int solve(){
	ll r1 = enum_div(n);
	ll r2 = (ll)n/r1;
	ll a = max(r1, r2);

	int res = 1;
	while (a /= 10){
		res++;
	}
	return res;
}

int main()
{
	cin >> n;
	cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;


int main()
{
	cin >> s; bool c = false, f = false; int cnt = 0;
	rep(i, s.length())
	{
		if (s[i] == 'C')
		{
			c = true; cnt++; break;
		}
		cnt++;
	}
	for (int i = cnt; i < sz(s); i++)
	{
		if (s[i] == 'F')
		{
			f = true; break;
		}
	}
	if (c && f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <tuple>
#include <string>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

int main() {
  intmax_t n, k;
  scanf("%jd %jd", &n, &k);

  if (n == 1) return !printf("%jd\n", k);

  intmax_t lb = 1;
  intmax_t ub = k;
  {
    intmax_t lb0 = 1;
    intmax_t ub0 = ub;
    while (ub0-lb0 > 1) {
      intmax_t sum = 0;
      intmax_t mid = (lb0+ub0) >> 1;
      intmax_t x = mid;
      for (int i = 0; i < n; ++i) {
        sum += x;
        x /= 2;
        if (x == 0) break;
      }
      ((sum > k)? ub0: lb0) = mid;
    }
    lb = lb0;
    ub = ub0;
  }

  printf("%jd\n", lb);
}



Measured memory_bytes: 2760
#include <bits/stdc++.h>
#define itn int
#define gI gi
#define int long long
 
using namespace std;
 
typedef long long ll;
 
inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}
 
inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}
 
int po[103], ans, n, m, a[200003], minn = 200003;
char s[100003];
 
signed main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = gi();
	int xx = n, cnt = 0;
	while (xx)
	{
		xx = xx / 10, ++cnt;
	}
	po[1] = 1;
	for (int i = 2; i <= 8; i+=1) po[i] = po[i - 1] * 10;
	for (int i = 1; i <= n; i+=1)
	{
		int ii = i, x = 0, y = ii % 10;
		if (!y) continue;
		while (ii)
		{
			x = ii % 10, ii /= 10;
		}
		for (int j = 1; j <= cnt; j+=1)
		{
			if (j == 1)
			{
				if (x == y) ++ans;
			}
			else if (j < cnt) ans += po[j - 1];
			else
			{
				int xsl = y * po[cnt] + x, xxsl = xsl;
				for (int k = 2; k < cnt; k+=1)
				{
					xxsl += 9 * po[k];
				}
				if (n >= xsl) 
				{
					ans += (min(xxsl, n) - xsl) / 10 + 1;
				}
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int i = 0; i < H; i++) {
		cin >> S.at(i);
	}

	for (int i = -1; i < H + 1; i++) {
		if (i == -1 || i == H) {
			for (int j = 0; j < W + 2; j++) {
				cout << '#';
			}
			cout << endl;
		} else {
			cout << '#' << S.at(i) << '#' << endl;
		}
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 2e5 + 10;
const int INF = 1e9 + 10;
map<int, int> mp;

int main(){
	int n;	scanf("%d", &n);
	for(int x, i = 0; i < n; ++i) {
		scanf("%d", &x);
		if(mp[x] == 0)	mp[x] = 1;
		else	mp[x] = 0;
	}
	int cnt = 0;
	for(auto it = mp.begin(); it != mp.end(); ++it) {
		if(it->second)	cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 4864
n,m=map(int,input().split())
h=list(map(int,input().split()))
road=[[] for _ in range(n)]
for i in range(m):
	a,b=map(int,input().split())
	road[a-1].append(b-1)
	road[b-1].append(a-1)
cnt=0
for i in range(n):
	mx=0
	for j in road[i]:
		mx=max(mx,h[j])
	if mx<h[i]:
		cnt+=1
print(cnt)

Measured memory_bytes: 29340
nt,nx,ny=0,0,0
ans="Yes"
for _ in range(int(input())):
	t,x,y=map(int, input().split())
	d=abs(x-nx)+abs(y-ny)
	if t-nt < d:
		ans="No"
		break
	elif (t-nt-d) % 2 != 0:
		ans="No"
		break

print(ans)


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

///////////////////////////////////////////
const long long int INF = 1000000000000000000LL;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
///////////////////////////////////////////

int main(){
    vi v;
    int n;
    cin>>n;
    rep(i,n){
        int s;
        cin>>s;
        v.push_back(s);
    }
    sort(all(v));
    cout<<v[n-1]-v[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int max = 0;
    int count = 0;
    for(int i = 0;i < s.length();i++) {
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            count++;
        } else {
            if(max<count) {
                max = count;
            }
            count = 0;
        }
    }
    if(max<count) {
        max=count;
    }
    cout << max << endl;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
cnt = 0
for v in collections.Counter([ri() for _ in range(n)]).values():
    if v&1:
        cnt += 1
print(cnt)















Measured memory_bytes: 38428
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int i,j,k,x,y,z;
        for(i=0;;i++){
            x=sc.nextInt();
            y=sc.nextInt();
            z=sc.nextInt();
            if((x==-1)&&(y==-1)&&(z==-1)){
                break;
            }else if((x==-1)||(y==-1)){
                System.out.println("F");
            }else if(x+y>=80){
                System.out.println("A");
            }else if(x+y>=65){
                System.out.println("B");
            }else if(x+y>=50){
                System.out.println("C");
            }else if(x+y>=30){
                if(z>=50){
                    System.out.println("C");
                }else{
                    System.out.println("D");
                }
            }else{
                System.out.println("F");
            }
        }
    }
}       


Measured memory_bytes: 26280
### ABC081B - Shift only
n = int(input())
a = list(map(int, input().split()))
cnt_list = []

for i in range(n):
    countTemp = 0
    while a[i]%2 == 0:
        a[i] //= 2    
        countTemp += 1
    cnt_list.append(countTemp)
print(min(cnt_list))

Measured memory_bytes: 38512
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#define rep(i,x,y) for(int i=x;i<=y;++i)
using namespace std;
const int Maxn=3e5+5;
const long long Inf=1e16;
int n,a[Maxn];
long long ans,f[Maxn],g[Maxn];
priority_queue<int> pq;
priority_queue<int,vector<int>,greater<int> >q;
int main()
{
	//freopen("std.in","r",stdin);
	cin>>n;ans=-Inf;
	for(int i=1;i<=3*n;i++)
	{
		cin>>a[i];
		if(i<=n)
		{
			f[i]=f[i-1]+a[i];
			q.push(a[i]);
		}
		else if(a[i]>q.top())
		{
			f[i]=f[i-1]-q.top()+a[i];
			q.pop();
			q.push(a[i]);
		}
		else f[i]=f[i-1];
	}
	for(int i=3*n;i>=1;i--)
	{
		if(i>2*n)
		{
			g[i]=g[i+1]+a[i];
			pq.push(a[i]);
		}
		else if(a[i]<pq.top())
		{
			g[i]=g[i+1]-pq.top()+a[i];
			pq.pop();
			pq.push(a[i]);
		}
		else g[i]=g[i+1];
	} 
	for(int i=n;i<=2*n;i++)
		ans=max(ans,f[i]-g[i+1]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 7032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
typedef pair<int, int> pii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
constexpr int INF = 1e9;
constexpr int MOD = 1e9+7;

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

    if (D == 25) {
        cout << "Christmas" << endl;
    } else if (D == 24) {
        cout << "Christmas Eve" << endl;
    } else if (D == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if (D == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

void next_combination(int n,int k,vector<int>& ret) {
    if (ret[0] == n-k) return;
    int cnt = 1,b;
    while (ret.back() == n-cnt) ret.pop_back(),cnt++;
    b = ret.back();
    ret.pop_back();
    for (int i = b+1;i < b+1+cnt;++i) ret.push_back(i);
}

int main() {
    int n,k,a[15];
    cin >> n >> k;
    vector<int> use(k);
    ll combi = 1;
    ll ans = 1e12;
    for (int i = 0;i < n;++i) cin >> a[i];
    for (int i = 0;i < n;++i) combi *= i+1;
    for (int i = 0;i < k;++i) combi /= i+1;
    for (int i = 0;i < n-k;++i) combi /= i+1;
    for (int i = 0;i < k;++i) use[i] = i;
    for (int z = 0;z < combi;++z) {
        ll ret = 0;
        int maxhight = 0;
        int j = 0;
        for (int i = 0;i < n;++i) {
            if (j < k && use[j] == i) {
                ret += max(0,maxhight+1-a[i]);
                maxhight = max(maxhight+1,a[i]);
                j++;
            }
            maxhight = max(maxhight,a[i]);
        }
        ans = min(ret,ans);
        next_combination(n,k,use);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int K;
    cin >> K;
    int a = K/2;
    cout << a*(K-a) << endl;
}

Measured memory_bytes: 256
program main
Implicit None
character::s*100000,t*100000
integer(8)::n,m,x,y,p,q,i,k,a,b
	
	read *,n,m
	read *,s
	read *,t
	
	
	
	call lcm(n,m,y)
	
	p = y/m
	q = y/n
	k = 0
	
	do i = 1,n*m/y
		a = (i-1)*p + 1
		b = (i-1)*q + 1
		
		if(s(a:a) /= t(b:b))then
			k = 1
			exit
		endif
	enddo
	
	if (k == 0)then
		print 102,y
		else
		print 101,"-1"
	endif


101 format(a)
102 format(i0)
end program main


subroutine euc(a1,b1,c)
implicit None
integer(8)::a1,b1,c,a,b
	
	a = a1
	b = b1
	c = 1
	
	do while (a /=0 .and. b /= 0)
		if (a > b)then
			c = b
			a = mod(a,b)
			else
			c = a
			b = mod(b,a)
		endif
	enddo
end subroutine euc

subroutine lcm(a1,b1,c)
implicit none
integer(8)::a1,b1,c
	call euc(a1,b1,c)
	c = a1 * b1 /c

end subroutine lcm



Measured memory_bytes: 896
c = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]

while True:
    try:
        S = input()
    except EOFError:
        break
    for i in c:
        o = True
        x = True
        for j in i:
            if S [j] != 'o':
                o = False
            if S [j] != 'x':
                x = False
        if o:
            print('o')
            break
        elif x:
            print('x')
            break
    else:
        print('d')

Measured memory_bytes: 7344
#include <iostream>

using namespace std;


struct money {
    int x;
    int y;
    int z;
};

money m;



int checkY(int n, int Y, const int x, int y){
    for(int i=y; i>=0; i--){
        int sum = x*10000+i*5000+(n-x-i)*1000;
        if(sum == Y){
            m.x = x;
            m.y = i;
            m.z = n-x-i;
            return 1;
        }
    }
    return -1;
}


int check(int n, int Y){
    if(10000*n < Y){
        return -1;
    }
    if(1000*n > Y){
        return -1;
    }
    for(int i=n; i>=0; i--){
        int sum = i*10000+(n-i)*5000;
        if(sum == Y){
            m.x = i;
            m.y = n-i;
            m.z = 0;
            return 1;
        }else{
            int result = checkY(n, Y, i, n-i);
            if(result == 1){
                return 1;
            }
        }
    }
    return -1;
}


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

    int result = check(n, Y);
    if(result == -1){
        cout << "-1 -1 -1" << endl;
    }else{
        cout << m.x << " " << m.y << " " << m.z << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
int main(void){

    char str[10][100] = {
    {""},
    {".,!? "},
    {"abc"},
    {"def"},
    {"ghi"},
    {"jkl"},
    {"mno"},
    {"pqrs"},
    {"tuv"},
    {"wxyz"}
    };

    int n; scanf("%d",&n);
    for(int i = 0;i < n;i++){
        char in[10000];
        scanf("%s",in);
        int cnt = -1;
        for(int i = 0;i < strlen(in);i++){
            if(in[i] == '0'){
                if(cnt == -1) continue;
                if(in[i-1] == '1'){
                    cnt %= 5;
                }
                else if(in[i-1] == '9' || in[i-1] == '7'){
                    cnt %= 4;
                }
                else{
                    cnt %= 3;
                }
                printf("%c",str[in[i-1]-'0'][cnt]);
                cnt = -1;
            }
            else cnt++;
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 1004
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m,t;
int a[10010];

int main(){
	cin>>n>>m>>t;
	REP(i,10010)
		a[i]=0;
	REP(i,n){
		int at;
		cin>>at;
		for(int i=at;i<t&&i-at<m;i++){
			a[i]=1;
		}
		for(int i=at-1;i>=0&&at-1-i<m;i--){
			a[i]=1;
		}
	}
	int ans=0;
	REP(i,t){
		if(a[i]==0)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3136
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Measured memory_bytes: 40368
#include<cstdio>
using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	int answer = 0;
	for (int i = 0; i < N; ++i){
		int tmp;
		scanf("%d", &tmp);
		answer += tmp - 1;
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 128
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var [w,h,c]= input.trim().split(" ").map(Number);
var max=1;
for(var i=1;i<=1000;i++){
   if(w%i==0 && h%i==0)max=i;
}
console.log(((w*h)/(max*max))*c);


Measured memory_bytes: 15412
#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int maxn = (int)1e6+6;
signed main(){
    int n;
    double den=0.00;
    cin>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        den+=(double)1/x;
    }
    cout<<(double)1/den;
}

Measured memory_bytes: 256
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e5+5;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int n;
    cin>>n;
    vii a(n);
    ll ans=0;
    rep(i,n)
    {
        cin>>a[i];
        ans^=a[i];
    }
    rep(i,n)
    {
        cout<<(ans^a[i])<<" ";
    }
    return 0;
}


Measured memory_bytes: 4768
def prod(arr):
    s = 0
    for x in arr:
        s += x
    return s


def main():
    N, K = (int(x) for x in input().split(" "))
    A = [int(x) for x in input().split(" ")]
    lastest_score = prod(A[0:K])
    result = ["No"] * (N-K+1)
    for i in range(1, N-K+1):
        current_score = lastest_score - A[i-1] + A[i + K-1]
        if lastest_score < current_score:
            result[i] = "Yes"
        lastest_score = current_score
    [print(x) for x in result[1:]]


if __name__ == '__main__':
    main()

Measured memory_bytes: 104688
#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<unordered_map>
#define int long long
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef long double ld;
signed  main() {
	int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1)
		cout << 0 << endl;
	else {
		int sum = 1;
		for (int i = 1; i <= n; i++) {
			sum *= i;
			sum %= 1000000007;
		}
		for (int i = 1; i <= m; i++) {
			sum *= i;
			sum %= 1000000007;
		}
		if (n == m)
			sum *= 2;
		sum %= 1000000007;
		cout << sum << endl;
	}
	getchar(); getchar();
}

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

struct node {
	struct node *parent;
	struct node *child[2];
	int key;
};

void Insert(struct node **root, struct node *p){
	struct node *y = NULL;
	struct node *x = *root;
	while(x!=NULL){
		y = x;
		if(p->key<x->key){
			x = x->child[0];
		}else{
			x = x->child[1];
		}
	}
	p->parent = y;

	if(y==NULL){
		*root = p;
	}else if(p->key<y->key){
		y->child[0] = p;
	}else{
		y->child[1] = p;
	}

}

int find(struct node *root, int p){
	if(root==NULL){
		return 0;
	}else if(root->key==p){
		return 1;
	}else if(root->key>p){
		return find(root->child[0],p);
	}else if(root->key<p){
		return find(root->child[1],p);
	}
	return -1;
}
/*
void calcDepth(int num){
	int i;
	for(i=0;i<2;i++){
		if(tree[num].child[i] == -1){
			continue;
		}
		tree[tree[num].child[i]].depth = tree[num].depth + 1;
		calcDepth(tree[num].child[i]);
	}
	return;
}
*/

/*
int calcHeight(int num){
	int i;
	int temp;
	int h = -1;
	if(num==-1){
		return -1;
	}
	for(i=0;i<2;i++){
		temp = calcHeight(tree[num].child[i]);
		h = (h>temp?h:temp);
	}
	tree[num].height = h + 1;
	return tree[num].height;
}
*/

void Preorder(struct node *p){
	printf(" %d",p->key);
	if(p->child[0]==NULL){
		if(p->child[1]==NULL){
			return;
		}else{
			Preorder(p->child[1]);
		}
		return;
	}
	Preorder(p->child[0]);
	if(p->child[1]==NULL){
		return;
	}
	Preorder(p->child[1]);
	return;
}

void Inorder(struct node *p){
	if(p->child[0]==NULL&&p->child[1]==NULL){
		printf(" %d",p->key);
		return;
	}else if(p->child[0]==NULL&&p->child[1]!=NULL){
		printf(" %d",p->key);
		Inorder(p->child[1]);
	}else if(p->child[0]!=NULL&&p->child[1]==NULL){
		Inorder(p->child[0]);
		printf(" %d",p->key);
	}else{
		Inorder(p->child[0]);
		printf(" %d",p->key);
		Inorder(p->child[1]);
	}
	return;
}

/*
void Postorder(struct node *p){
	if(p->child[0]==NULL&&p->child[1]==NULL){
		printf(" %d",p->key);
		return;
	}else if(p->child[0]==NULL&&p->child[1]!=NULL){
		Postorder(p->child[1]);
	}else if(p->child[0]!=NULL&&p->child[1]==NULL){
		Postorder(p->child[0]);
	}else{
		Postorder(p->child[0]);
		Postorder(p->child[1]);
		printf(" %d",p->key);
	}
}
*/

int main(){
	int n;
	struct node *root = NULL;
	struct node *temp;
	int temp1;
	int i,j;
	char order[32];
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%s",order);
		if(strcmp(order,"insert")==0){
			temp = (struct node *)malloc(sizeof(struct node));
			scanf("%d",&temp->key);
			temp->parent = NULL;
			temp->child[0] = NULL;
			temp->child[1] = NULL;
			Insert(&root,temp);
		}else if(strcmp(order,"print")==0){
			Inorder(root);
			printf("\n");
			Preorder(root);
			printf("\n");
		}else if(strcmp(order,"find")==0){
			scanf("%d",&temp1);
			j = find(root,temp1);
			if(j==1){
				printf("yes\n");
			}else if(j==0){
				printf("no\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin>>a[i];
    sort(all(a));
    int ans = 0;
    int b = 0;
    a.push_back(-1);
    rep(i,N+1){
        if(i==0) b++;
        else if(a[i] == a[i-1] && b > 0) b++;
        else if(b > 0 && b == a[i-1]) b = 1;
        else{
            if(a[i-1] < b) ans += b-a[i-1];
            else ans += b;
            b=1;
            //cout << a[i-1] << " " << ans << endl;
        }
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
 int main(void)
 {
     long A[100000]={};
     int H,N,i,j=0;
     scanf("%d%d",&H,&N);
     for(i=0;i<N;i++)
       scanf("%ld",&A[i]);
     for(i=0;i<N;i++)
       j+=A[i];
     if(H<=j) printf("Yes\n");
     else     printf("No\n");
   return 0;
 }

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int d, t, s;
    cin >> d >> t >> s;
    cout << (t * s >= d ? "Yes\n" : "No\n");
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int a, b;
  cin >> a >> b;
  if (a<=9&&b<=9) cout << a*b << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 256
//37
#include<iostream>
#include<string>
#include<sstream>
#include<cctype>

using namespace std;

int main(){
  string s;
  char c;
  while(cin>>s>>c,c!='X'){
    s[0]=tolower(s[0]);
    string su;
    for(int i=0;i<s.size();i++){
      if(isupper(s[i])){
	su+='_';
      }
      su+=tolower(s[i]);
    }
    if(c=='D'){
      cout<<su<<endl;
    }else{
      string so;
      bool f=false;
      for(int i=0;i<su.size();i++){
	if(su[i]=='_'){
	  f=true;
	}else{
	  so+=(f)?toupper(su[i]):tolower(su[i]);
	  f=false;
	}
      }
      if(c=='U'){
	so[0]=toupper(so[0]);
      }
      cout<<so<<endl;
    }
  }
  return 0;
}
    

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

using namespace std;

int main() {
    
    //cout << ": " <<  << "\n";

    int n,member;
    cin >> n;
    int mem[n+1] = {0};

    for(int i=2 ; i<n+1 ; i++) {
        cin >> member;
        mem[member]++;
    }

    for(int j=1 ; j<n+1 ; j++) {
        cout << mem[j] << "\n";
    }

}

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

int main() {
//	freopen("input.txt", "r", stdin);
//	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	string s;
	cin >> s;

	for (int i = 0; i < (int) s.size(); i++) {

		if (s[i] == 'A') {
			for (int j = s.size() - 1; j > i; --j) {
				if (i != j && s[j] == 'Z')
					return cout << abs(i - j) + 1, 0;
			}
		}
	}

}



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

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

    int a[N][3];
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }

    int dp[N][3];

    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            if(i == 0){
                dp[i][j] = a[i][j];
            }else{
                dp[i][j] = 0;
            }
        }
    }

    for(int i = 1; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k){
                    continue;
                }

                if(dp[i][k] < dp[i - 1][j] + a[i][k]){
                    dp[i][k] = dp[i - 1][j] + a[i][k];
                }
            }
        }
    }

    int ans = 0;

    for(int i = 0; i < 3; i++){
        if(ans < dp[N - 1][i]){
            ans = dp[N - 1][i];
        }
    }

    /*for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/

    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(int argc, char** argv) {
    int n;
    scanf("%d", &n);

    int i;
    for (i = 0; i < n; i++) {
        int k;
        int p;
        scanf("%d %d", &k, &p);
        int res = k % p;
        if (res == 0) {
            printf("%d\n", p);
        } else {
            printf("%d\n", res);
        }
    }
    
    return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

int C[2020][2020] = {}, D[2020][2020], DD[2020][2020];
void solve() {
	int A, B; scanf("%d%d", &A, &B);
	const int MOD = 1e9 + 7;
	rep(i, 2020) {
		C[i][0] = 1;
		for(int j=1;j<=i;j++) C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
	}
	rep(i, 2020) {
		D[i][0] = 1;
		DD[i][0] = 1;
		for(int j=1;j<=i;j++) {
			D[i][j] = (C[i][j] + D[i][j-1]) % MOD;
			DD[i][j] = (DD[i][j-1] + D[i][j]) % MOD;
		}
	}
	ll ans = 0;
	for(int i=0;i<=A;i++) {
		for(int j=1;j<B;j++) {
			if(i + (B-j) <= A) {
				int t = A - i - (B - j);
				int y = B - j - 1;
				if(t > y) ans = (ans + (ll) (t - y) * D[y][y] % MOD * C[B-1][j-1]) % MOD, t = y;
				ans = (ans + (ll) C[B-1][j-1] * DD[y][t]) % MOD;
			}
		}
		ans = (ans + 1) % MOD;
	}
	printf("%lld\n", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end



int main(){
    int n; scanf("%d",&n);
    string s; cin>>s;
    int nxt[30010][10];
    rep(i,0,n+1)rep(j,0,10)nxt[i][j]=n;
    rrep(i,n-1,-1)rep(j,0,10){
        if(s[i]-'0'==j)nxt[i][j]=i;
        chmin(nxt[i][j],nxt[i+1][j]);
    }
    int ans=0;
    rep(i,0,10)rep(j,0,10)rep(k,0,10){
        int s=nxt[0][i]; if(s==n)continue;
        s=nxt[s+1][j]; if(s==n)continue;
        s=nxt[s+1][k]; 
        if(s!=n){ans++;}
    }
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

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

    string n;

    cin >> n;

    if (n[0] == n[2]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = n % 10;
        if(x == 3) System.out.println("bon");
        else if(x == 0 || x == 1 || x == 6 || x == 8) System.out.println("pon");
        else System.out.println("hon");
    }
}

Measured memory_bytes: 35804