akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

// pairとバケットを用いて実装しようとしたがソートができず失敗

int main(){
    int N,M;
    int P[100000], Y[100000];
    vector<int> yd[100001];

    cin >> N >> M;
    rep(i, M){
        cin >> P[i] >> Y[i];
        yd[P[i]].pb(Y[i]);
    }
    rep(i, N){
        sort(yd[i+1].begin(), yd[i+1].end());
    }
    rep(i, M){
        printf("%012lld\n", ll(P[i])*1000000+int(lower_bound(yd[P[i]].begin(),yd[P[i]].end(), Y[i])-yd[P[i]].begin())+1);
    }

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    long long int a;
    static long long int c = 1e9;
    bool *hantei = (bool *)malloc(sizeof(bool) *c);
    for (long long int i = 0; i < c; i++)
        hantei[i] = false;
    
    bool b = false;

    for (int i = 0; i < n; i++) {
        cin >> a;
        if (hantei[a] == true) {
            b = true;
            cout << "NO\n";
            break;
        }
        hantei[a] = true;
    }

    if (b == false)
        cout << "YES\n";

    free(hantei);

    return 0;
}

Measured memory_bytes: 976768
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
class modint{
public:
  long long x;
  constexpr modint(long long x=0):x((x%MOD+MOD)%MOD){}
  constexpr modint operator-() const{return modint(-x);}
  constexpr modint& operator+=(const modint& a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  constexpr modint& operator-=(const modint& a){
    if((x+=MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  constexpr modint& operator*=(const modint& a){
    (x*=a.x)%=MOD;
    return *this;
  }
  constexpr modint operator+(const modint& a) const{return modint(*this)+=a;}
  constexpr modint operator-(const modint& a) const{return modint(*this)-=a;}
  constexpr modint operator*(const modint& a) const{return modint(*this)*=a;}
  constexpr bool operator==(const modint& a) const{return this->x==a.x;}
  constexpr bool operator!=(const modint& a) const{return this->x!=a.x;}
  constexpr modint pow(long long expo) const{
    if(expo==0)  return 1;
    modint a=pow(expo>>1);
    a*=a;
    if(expo&1)  a*=(*this);
    return a;
  }
  //for prime MOD
  constexpr modint inv() const{return pow(MOD-2);}
  constexpr modint& operator/=(const modint& a){return (*this)*=a.inv();}
  constexpr modint operator/(const modint& a) const{return modint(*this)/=a;}
};
istream& operator>>(istream& is,const modint& a){return is >> a.x;}
ostream& operator<<(ostream& os,const modint& a){return os << a.x;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  string S;
  int D;
  cin >> S >> D;
  int N=sz(S);

  vector<vector<vector<modint>>> dp(N+1,vector<vector<modint>>(2,vector<modint>(D,0)));
  dp.at(0).at(1).at(0)=1;
  for(int i=0;i<N;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<D;k++){
        if(j==0){
          for(int l=0;l<10;l++) dp.at(i+1).at(0).at((k+l)%D)+=dp.at(i).at(0).at(k);
        }
        else if(j==1){
          int tmp=S.at(i)-'0';
          for(int l=0;l<tmp;l++)  dp.at(i+1).at(0).at((k+l)%D)+=dp.at(i).at(1).at(k);
          dp.at(i+1).at(1).at((k+tmp)%D)+=dp.at(i).at(1).at(k);
        }
      }
    }
  }
  cout << dp.at(N).at(0).at(0) -1 +dp.at(N).at(1).at(0) << endl;

  return 0;
}

Measured memory_bytes: 17024
package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func main() {

	// 繰り返し回数
	N, _ := strconv.Atoi(readLine())

	strWords := strings.Fields(readLine())

	arr := make([]int, 0)
	for _, strWord := range strWords {
		intWord, _ := strconv.Atoi(strWord)
		arr = append(arr, intWord)
	}

	changeNum := 0
	// n
	for n := 0; n < N-1; {
		last := N - 1
		first := n

		// 最終ラインまで
		for ; first != last; {

			last_m := arr[last]
			last_n := arr[last-1]

			// 比較する
			//fmt.Println(last_n, "##", last_m)
			if last_n > last_m {
				changeNum ++
				temp := arr[last]
				arr[last] = arr[last-1]
				arr[last-1] = temp

				//fmt.Println(reduce(arr), "交換")
			}

			// 最後から減らしていく。
			last -= 1
		}
		//fmt.Println(reduce(arr))
		n++
	}
	fmt.Println(reduce(arr))

	fmt.Println(changeNum)

	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func reduce(intArray []int) string {
	reducedString := ""
	for _, inz := range intArray {
		reducedString += " " + strconv.FormatInt(int64(inz), 10)
	}
	return strings.Trim(reducedString, " ")
}



Measured memory_bytes: 3280
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define COUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

class CRectangleCutting {
public:
    ll W, H, x, y;

    void solve(std::istream& in, std::ostream& out) {
        in >> W >> H >> x >> y;
        out << W * H / 2.0;
        out << " ";
        int ans = abs(x - W / 2.0) < 1.0 / INF && abs(y - H / 2.0) < 1.0 / INF ? 1 : 0;
        COUT(ans);
    }
};


int main() {
    CRectangleCutting solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    ll A,B;
    cin>>A>>B;
    cout<<A*B;
    return 0;
}

Measured memory_bytes: 3588
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
if k==0:
    print(n*n)
    exit()
sm = 0
for i in range(k+1,n+1):
    sm += (i-k)*(n//i)+max(0,n+1-(n//i)*i-k)
    #ddprint(f"sm {sm} i {i} n//i {n//i} t1 {(i-k)*(n//i)} t2 {n+1-k-(n//i)*i}")
print(sm)


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

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N;
int A[100010];
int B[100010];
int C[100010];
ll sums[100010];

int main(){


    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    for(int i = 0; i < N; i++) cin >> C[i];

    sort(A, A + N);
    sort(B, B + N);
    sort(C, C + N);
    
    // Bそれぞれの要素からみて、自分より大きくなる要素の数を数える
    // そしてついでに累積和を求める
    for(int i = N - 1; i >= 0; i--){
        int idx = upper_bound(C, C + N, B[i]) - C;
        int cnt = N - idx;
        sums[i] = sums[i + 1] + cnt;
    }

    ll sum = 0;
    for(int i = 0; i < N; i++){
        int idx = upper_bound(B, B + N, A[i]) - B;
        sum += sums[idx];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 2304
//Author:xht37
#include <bits/stdc++.h>

#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double

#define pi pair <int, int>
#define fi first
#define se second
#define mp make_pair

#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)

#define vi vector <int>
#define pb push_back
#define pq priority_queue

#define dbg(x) cerr << #x" = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)

#define fl(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

using namespace std;

namespace io {
	const int SI = 1 << 21 | 1;
	char IB[SI], *IS, *IT, OB[SI], *OS = OB, *OT = OS + SI - 1, c, ch[100];
	int f, t;
	#define gc() (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin), IS == IT ? EOF : *IS++) : *IS++)
	inline void flush() {
		fwrite(OB, 1, OS - OB, stdout), OS = OB;
	}
	inline void pc(char x) {
		*OS++ = x;
		if (OS == OT) flush();
	}

	template <class I>
	inline void rd(I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + (c & 15), c = gc());
		x *= f;
	}
	template <class I>
	inline void rd(I &x, I &y) {
		rd(x), rd(y);
	}
	template <class I>
	inline void rd(I &x, I &y, I &z) {
		rd(x), rd(y), rd(z);
	}
	template <class I>
	inline void rda(I *a, int n) {
		for (int i = 1; i <= n; i++) rd(a[i]);
	}
	inline void rdc(char &c) {
		for (c = gc(); c < 33 || c > 126; c = gc());
	}
	inline void rds(char *s, int &n) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (n = 0; c >= 33 && c <= 126; s[++n] = c, c = gc());
		s[n+1] = '\0';
	}
	inline void rds(string &s) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (s.clear(); c >= 33 && c <= 126; s.pb(c), c = gc());
	}

	template <class I>
	inline void print(I x, char k = '\n') {
		if (!x) pc('0');
		if (x < 0) pc('-'), x = -x;
		while (x) ch[++t] = x % 10 + '0', x /= 10;
		while (t) pc(ch[t--]);
		pc(k);
	}
	template <class I>
	inline void print(I x, I y) {
		print(x, ' '), print(y);
	}
	template <class I>
	inline void print(I x, I y, I z) {
		print(x, ' '), print(y, ' '), print(z);
	}
	template <class I>
	inline void printa(I *a, int n) {
		for (int i = 1; i <= n; i++) print(a[i], " \n"[i==n]);
	}
	inline void printc(char c) {
		pc(c);
	}
	inline void prints(char *s, int n) {
		for (int i = 1; i <= n; i++) pc(s[i]);
		pc('\n');
	}
	inline void prints(string s) {
		int n = s.length();
		while (t < n) pc(s[t++]);
		pc('\n'), t = 0;
	}
	struct Flush {
		~Flush() {
			flush();
		}
	} flusher;
}
using io::rd;
using io::rda;
using io::rdc;
using io::rds;
using io::print;
using io::printa;
using io::printc;
using io::prints;

int main() {
	int x;
	rd(x);
	int t = 1;
	while (1) {
		if (t * x % 360 == 0) {
			return print(t), 0;
		}
		++t;
	}
	return 0;
}

Measured memory_bytes: 3640
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    print(int(math.log(n,k))+1)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38640
from collections import defaultdict
from bisect import bisect_left,bisect_right
S = input()
T = input()

s_map = defaultdict(list)

for i, s in enumerate(S + S):
    s_map[s].append(i + 1)

ans = 0
current_index = 0
for t in T:
    if not s_map[t]:
        print(-1)
        exit()

    index = bisect_right(s_map[t],current_index)
    current_index = s_map[t][index]
    # print(current_index,ans)
    if current_index > len(S):
        ans += current_index // len(S) * len(S)
        current_index = current_index % len(S)


print(ans + current_index)


Measured memory_bytes: 12276
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int sum_dig(int x) {
  int ret = 0;
  while (x > 0) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}

int main() {
  int n;
  scan(n);
  if (n % sum_dig(n) == 0) {
    print("Yes");
  } else {
    print("No");
  }
  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 REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);



int main(){
  faster();
  ll h,n,maximum=0;
  cin >> h >> n;
  vl a(n);
  rep(i,n){
    cin >> a[i];
    maximum += a[i];
  }
  if(maximum >= h) cout << "Yes";
  else cout << "No";
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



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

using namespace std;

#define M1 1000000021
#define M2 1000000033

int n, at[250005];
pair< long long, long long > tmp;
pair< long long, long long > pp[600005];
pair< long long, long long > inv[600005];
pair< long long, long long > cur[250005];
map< pair< long long, long long >, int > mm;
map< pair< long long, long long >, int >::iterator it;
long long ans;
char x[250005];

pair< long long, long long > operator*(const pair< long long, long long > &a, const pair< long long, long long > &b) {
	return {a.first * b.first % M1, a.second * b.second % M2};
}

pair< long long, long long > operator+(const pair< long long, long long > &a, const pair< long long, long long > &b) {
	pair< long long, long long > re = {a.first + b.first, a.second + b.second};
	if (re.first >= M1)
		re.first -= M1;
	if (re.second >= M2)
		re.second -= M2;
	return re;
}

pair< long long, long long > operator-(const pair< long long, long long > &a, const pair< long long, long long > &b) {
	pair< long long, long long > re = {a.first + M1 - b.first, a.second + M2 - b.second};
	if (re.first >= M1)
		re.first -= M1;
	if (re.second >= M2)
		re.second -= M2;
	return re;
}

long long po(long long b, int p, long long m) {
	long long re = 1;
	while (p) {
		if (p & 1)
			re = re * b % m;
		b = b * b % m;
		p >>= 1;
	}
	return re;
}

int main() {
	at[0] = 300000;
	scanf("%d%s", &n, x);
	pp[0] = inv[0] = {1, 1};
	pp[1] = {600000, 600000};
	inv[1] = {po(600000, M1 - 2, M1), po(600000, M2 - 2, M2)};
	for (int i = 2; i < 600005; i++) {
		pp[i] = pp[i - 1] * pp[1];
		inv[i] = inv[i - 1] * inv[1];
	}
	for (int i = 0; i < n; i++) {
		at[i + 1] = at[i];
		cur[i + 1] = cur[i];
		if (x[i] == '>')
			at[i + 1]++;
		else if (x[i] == '<')
			at[i + 1]--;
		else if (x[i] == '+')
			cur[i + 1] = cur[i + 1] + pp[at[i + 1]];
		else
			cur[i + 1] = cur[i + 1] - pp[at[i + 1]];
	}
	// for (int i = 0; i <= n; i++) printf("%d  %d  %lld %lld\n", i, at[i], cur[i].first, cur[i].second);
	for (int i = n; i >= 0; i--) {
		if (at[i] > at[0])
			tmp = cur[n] * pp[at[i] - at[0]] + cur[i];
		else
			tmp = cur[n] * inv[at[0] - at[i]] + cur[i];
		// printf("%d  %lld %lld\n", i, tmp.first, tmp.second);
		it = mm.find(tmp);
		if (it != mm.end())
			ans += it->second;
		it = mm.insert({cur[i], 0}).first;
		it->second++;
	}
	printf("%lld\n", ans);
	return 0;
}


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

using namespace std;

int main(){
	int s;
	cin >> s;
	const long long mod = 1e9 + 7;
	vector<long long> dp(s + 1 , 0);
	dp[0] = 1;
	for(int i = 3; i <= s; i++){
		for(int j = i - 3; j >= 3; j--){
			dp[i] += dp[j];
			dp[i] %= mod;
		}
		dp[i] += dp[0];
	} 
	cout << dp[s] << endl;
	return 0;
}
 

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define F(i,L,R) for(int i=L;i<R;i++)
#define FE(i,L,R) for(int i=L;i<=R;i++)
#define RF(i,l,r) for(int i=r;i>l;i--)
#define RFE(i,l,r) for(int i=r;i>=l;i--)
#define getI(i) scanf("%d",&i)
#define getII(i,j) scanf("%d%d",&i,&j)
#define getIII(i,j,k) scanf("%d%d%d",&i,&j,&k)
#define VgetI(i) int (i);scanf("%d",&(i));
#define VgetII(i,j) int (i),(j);scanf("%d%d",&(i),&(j));
#define VgetIII(i,j,k) int (i),(j),(k);scanf("%d",&(i),&(j),&(k));
#define EoF(n) int(n);while(~getI(n))
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define abs(n) (n>0?n:(-n))
#define INF 2147483647
#define nINF -2147483648
int main(){
	int n;
	while(~getI(n)){
		int arr[n+1],head=0,ans=0;
		F(i,0,n) getI(arr[i]);
		if(n==1){
			if(arr[0]==1) puts("0");
			else puts("1");
			continue;
		}
		sort(arr,arr+n);
		arr[n]=0;
		F(i,1,n+1){
			if(arr[i]!=arr[i-1]){
				if(arr[i-1]>i-head) ans+=i-head;
				else if(arr[i-1]<i-head) ans+=i-head-arr[i-1];
				head=i;
			}
		}
		bool flag=0;
		F(i,1,n){
			if(arr[i]!=arr[i-1]){
				flag=1;
				break;
			}
		}
		printf("%d\n",flag==1?ans:(n>=arr[0]?n-arr[0]:n));
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=2000005;
int n,m,cnt,p[12]={1},ans[N];
char s[N];
struct tree
{
	int ch[3],id,tag;
}a[N];
void build(int d,int x,int v)
{
	a[x].tag=0;
	if(d==n)
	{
		a[x].id=v;
		return;
	}
	for(int i=0;i<3;i++)
	{
		a[x].ch[i]=++cnt;
		build(d+1,a[x].ch[i],v+p[d]*i);
	}
}
void pushdown(int x)
{
	if(a[x].tag)
	{
		for(int i=0;i<3;i++)
		{
			swap(a[a[x].ch[i]].ch[1],a[a[x].ch[i]].ch[2]);
			a[a[x].ch[i]].tag^=1;
		}
		a[x].tag=0;
	}
}
void add(int d,int x)
{
	if(d==n)
		return;
	pushdown(x);
	int b[3];
	for(int i=0;i<3;i++)
		b[i]=a[x].ch[i];
	for(int i=0;i<3;i++)
		a[x].ch[i]=b[(i+2)%3];
	add(d+1,a[x].ch[0]);
}
void out(int d,int x,int v)
{
	if(d==n)
	{
		ans[a[x].id]=v;
		return;
	}
	pushdown(x);
	for(int i=0;i<3;i++)
		out(d+1,a[x].ch[i],v+p[d]*i);
}
int main()
{
	scanf("%d%s",&n,s+1);
	m=strlen(s+1);
	for(int i=1;i<=n;i++)
		p[i]=p[i-1]*3;
	build(0,0,0);
	for(int i=1;i<=m;i++)
	{
		if(s[i]=='S')
		{
			swap(a[0].ch[1],a[0].ch[2]);
			a[0].tag^=1;
		}
		if(s[i]=='R')
			add(0,0);
	}
	out(0,0,0);
	for(int i=0;i<p[n];i++)
		printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 21884
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, l; cin >> n >> l;
    vector<string> vec(n);
    rep(i,n) cin >> vec[i];
    sort(ALL(vec));
    string ans = "";
    rep(i,n) ans += vec[i];
    cout << ans << endl;
}

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

int main() {
    string S;
    cin >> S;
    int length = S.size();
    vector<char> T(length);

    if (S.at(0) == '0') {
        for (int i = 0; i < length; i += 2) {
            int j = i + 1;
            T.at(i) = '0';
            if (i == length - 1) {
                break;
            }

            T.at(j) = '1';

            if (j == length - 1) {
                break;
            }
        }
    }

    if (S.at(0) == '1') {
        for (int i = 0; i < length; i += 2) {
            int j = i + 1;
            T.at(i) = '1';
            if (i == length - 1) {
                break;
            }

            T.at(j) = '0';

            if (j == length - 1) {
                break;
            }
        }
    }

    int sum = 0;

    for (int i = 0; i < length; i++) {
        if (S.at(i) != T.at(i)) {
            sum++;
        }
    }

    cout << sum << endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<queue>
#define ll long long
typedef unsigned long long ULL;
const int N=1010;
using namespace std;

int main(){
    int n,t,a;
    double tmp,min_=7000;
    int aa[N];double bb[N];
    int ans=0;
    cin>>n>>t>>a;
    for(int i=0;i<n;i++){
        cin>>aa[i];
        bb[i]=double(t)-double(aa[i]*0.006);
        tmp=fabs(a-bb[i]);

        min_=min(min_,tmp);
        if(tmp<=min_)ans=i+1;

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long
template<class T> void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }
using namespace std;

const long long LLINF = 1LL << 60;

int main(void) {
	LL N, W;
	cin >> N >> W;
	vector<LL> weight(110), value(110);
	for (int i = 1; i <= N; ++i) cin >> weight[i] >> value[i];

	// DPテーブル
	vector<vector<LL> > dp(110, vector<LL>(100100, LLINF));
	//最小化していくDPなのでデカい値で初期化

	// 初期条件
	dp[0][0] = 0;

	// DPループ
	for (int i = 1; i <= N; ++i) {
		for (int sum_v = 0; sum_v < 100100; ++sum_v) {
			if (sum_v >= value[i]) {
				dp[i][sum_v] = min(dp[i - 1][sum_v], dp[i - 1][sum_v - value[i]] + weight[i]);
			}
			else {
				dp[i][sum_v] = dp[i - 1][sum_v];
			}
		}
	}

	// 最適値の出力
	LL res = 0;
	for (int sum_v = 0; sum_v < 100100; ++sum_v) {
		if (dp[N][sum_v] <= W) {
			res = sum_v;
		}
	}
	cout << res << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	string s; cin>>s;
	cout<<(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]?"Bad":"Good")<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define ll long long
#define pb push_back
#define Never
#define To

using namespace std;

bool calc(ll l){

	std::vector<int> v;
	while(l > 0){
		v.pb(l % 10);
		l /= 10;
	}

	bool ok = true;
	for(int i = 0; i < (v.size() -1 )/2; i++){
		if(v[i] != v[v.size() -1 -i]) ok = false;
	}
	return ok;
}

using namespace std;

int main(){

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

	ll A, B;
	ll ans = 0;

	cin >> A >> B;

	for(ll i = A; i <= B; i++){
		bool ok = calc(i);
		if(ok) ans++;

	}

	cout << ans << endl;

	Never To return 0;
}


Measured memory_bytes: 256
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var processData = function processData(lines) {
  var t;

  var _lines$0$split = lines[0].split(' '),
      _lines$0$split2 = _slicedToArray(_lines$0$split, 3),
      a = _lines$0$split2[0],
      b = _lines$0$split2[1],
      c = _lines$0$split2[2];

  t = b;
  b = a;
  a = t;
  t = c;
  c = a;
  a = t;
  console.log(a, b, c);
};

var i = '';
process.stdin.on('data', function (c) {
  return i += c;
});
process.stdin.on('end', function () {
  var _require = require('os'),
      EOL = _require.EOL;

  var lines = i.split(EOL);
  /*your input text, split by lines*/

  processData(lines);
});


Measured memory_bytes: 21192
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
bool judge(int x){
    string y = to_string(x);
    if(y.find("3") != std::string::npos){
        if(y.find("5") != std::string::npos){
            if(y.find("7") != std::string::npos){
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }else{
        return false;
    }
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    vector<long long> list(10000000);
    vector<int> num(3);
    num[0]=3;
    num[1]=5;
    num[2]=7;
    int cnt=0;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                list[cnt]=100*num[i]+10*num[j]+num[k];
                cnt++;
            }
        }
    }
    int def = 27;
    int start = 0;
    int temp;
    while(cnt<=29511){
        for(int j=start;j<def;j++){
            for(int k=0;k<3;k++){
                temp = list[j]*10+num[k];
                list[cnt]=temp;
                cnt++;
            }
        }
        start = def;
        def = def*3;
    }
    for(int i=0;i<29511;i++){
        if(list[i]<=n){
            bool p = judge(list[i]);
            if(p==true){
                ans++;
            }
        }else{
            break;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 78336
#include<stdio.h>

int main(){

	int A,B;
	int K;
	int f;
	
	//入力
	scanf("%d %d",&A,&B);
	f=(A+B)%2;
	
	//AとBを足して偶数だったらKを出力
	if(f == 0){
		K=(A+B)/2;
		//出力
		printf("%d",K);
	}else{
		printf("IMPOSSIBLE");
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
    int x1, x2, x3, x4, x5;

    scanf("%d %d %d %d %d", &x1, &x2, &x3, &x4, &x5);

    if(x1==0){
        printf("1\n");
    }
    else if(x2==0){
        printf("2\n");
    }
    else if(x3==0){
        printf("3\n");
    }
    else if(x4==0){
        printf("4\n");
    }
    else if(x5==0){
        printf("5\n");
    }
    return 0;
}


Measured memory_bytes: 1588
N = int(input())
li = [[_ for _ in input().rstrip().split()] for _ in range(N)]

ans = 0
for i in range(N):
    if li[i][1] == "JPY":
        ans += float(li[i][0])
    elif li[i][1] == "BTC":
        ans += float(li[i][0]) * 380000.0

print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n,k;
  cin >> n >> k;
  vector<ll> e;
  ll a;
  rep(i,n){
    cin >> a;
    e.pb(a);
  }
  sort(all(e));
  reverse(all(e));
  ll ans = 0;
  for(ll i = k;i<n;i++){
    ans+=e[i];
  }
  pri(ans);
  return 0;
}


Measured memory_bytes: 2420
#include <iostream>

using namespace std;

int main(){
	char* num = (char*)calloc(4, sizeof(char));
	cin >> num;
	
	char last;
	while(*num != 0){
		last = *num;
		num++;
	}
	
	switch(last){
	case '2':
	case '4':
	case '5':
	case '7':
	case '9':
		cout << "hon" << endl;
		break;
	case '0':
	case '1':
	case '6':
	case '8':
		cout << "pon" << endl;
		break;
	case '3':
		cout << "bon" << endl;
		break;
	}
	return 0;
}

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

int fact(int n) {
	if (n <= 1) return 1;
	else return n*fact(n - 1);
}

int order(bool used[],int k) {
	int a = 0;
	for (int i = 1; i <=k; i++) {
		if (used[i]) continue;
		a++;
	}
	used[k] = true;
	return a;
}

int main() {
	int n, a[10], b[10],oa=1,ob=1;
	bool aused[10],bused[10];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		aused[i] = false;
	}
	for (int i = 1; i <=n; i++) {
		cin >> b[i];
		bused[i] = false;
	}
	for (int i = 1; i <n; i++) {
		oa += (order(aused, a[i])-1) * fact(n-i);
		ob += (order(bused, b[i]) - 1) * fact(n-i);
	}
	if(oa>ob)
	    cout <<oa-ob<<endl;
	else
		cout << ob - oa << endl;
	return 0;
}

Measured memory_bytes: 256
main :: IO ()
sti str = read str :: Int
sum2 = foldr (+) 0
double x = x * x
main = do
    n <- getLine
    line <- getLine
    let l = map sti $ words line
        double_sum = double $ sum2 l
        sum_double = sum2 $ map double l
    print $ round $ fromIntegral (double_sum - sum_double) / 2


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>
 
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)
 
int main() {
  ll K, N;
  cin >> K >> N;
  
  ll A[200010];
  vector<ll> d;
  
  rep(i, N) cin >> A[i];
  
  rep(i, N-1){
    d.push_back(A[i+1] - A[i]);
  }
  d.push_back(K + A[0] - A[N-1]);
  
  sort(d.begin(), d.end());
  
  ll sum = 0;

  for (int i = 0; i < d.size()-1; i++){
    sum += d[i];
  }
  
  cout << sum << endl;
  
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if((A.at(i)%2)==0){
      if((A.at(i)%3)!=0&&(A.at(i)%5)!=0){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}

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

char grid[110][110];

int main() {
  int H, W;
  cin >> H >> W;
  vector<int> hs(H + 1);
  vector<int> ws(W + 1);
  for(int h = 1; h <= H; ++h) {
    string s;
    cin >> s;
    for(int w = 1; w <= W; ++w) {
      auto c = s[w - 1];
      auto n = c == '.' ? 0 : 1;
      grid[h][w] = c;
      hs[h] += n;
      ws[w] += n;
    }
  }
  for(int h = 1; h <= H; ++h) {
    if(hs[h] == 0) {
      continue;
    }
    for(int w = 1; w <= W; ++w) {
      if(ws[w] == 0) {
        continue;
      }
      cout << grid[h][w];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n, m;
  cin >> n >> m;
  set<pii> st;
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    st.insert(pii(a,b));
  }
  bool can = false;
  for (int i = 1; i <= n-2; ++i) {
    if (st.count(pii(0,i)) && st.count(pii(i,n-1))) can = true;
  }
  cout << (can ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }


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

    ll A, B; cin >> A >> B;
    ll ans = A-B*2;
    if (ans<0) {
        ans = 0;
    }
    cout << ans << '\n';
}



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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int const N = 2e5 + 7;
int ar[N];
int main()
{
	fastio;

	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; ++i)
		cin >> ar[i];

	for (int i = 0; i < n-k; ++i)
		cout << (ar[i] < ar[i+k] ? "Yes\n" : "No\n");

	return 0;
}


Measured memory_bytes: 4368
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N, t;
    cin >> N;
    vector<int> A(N);
    for (int& i : A) cin >> i;
    vector<int> B(A);
    partial_sort(B.begin(), B.begin() + 2, B.end(), greater<int>());
    for (int i : A) cout << (i == B[0] ? B[1] : B[0]) << endl;
}

Measured memory_bytes: 3200
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int w = sc.nextInt();
    String ans = "";
    for(int i = 0; i < S.length(); i++) {
      String s = String.valueOf(S.charAt(i));
      if((i % w) == 0) ans += s;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
//
// Created by tac on 2016/10/27.
//

#include <cstdlib>
#include <iostream>

int main() {
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            std::cout << i << "x" << j << "=" << i * j << std::endl;
        }
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3000
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int  W = scanner.nextInt();
	  	int  H = scanner.nextInt();
	  	int  x = scanner.nextInt();
	  	int  y = scanner.nextInt();
	  	int  r = scanner.nextInt();
        
        if(x + r <= W){
	  		if(y + r <= H){
	  			if( x - r >= 0 ) {
	  				if( y - r >= 0 ) 
				  		System.out.println("Yes");
				  	else
				  		System.out.println("No");
	  			}
	  			else
	  				System.out.println("No");
	  		}
	  		else
	  			System.out.println("No");
	  	}
	  	else
        	System.out.println("No");
        	
        scanner.close();
  }
}


Measured memory_bytes: 26336
#include <cstdio>

int main()
{
    int n;
    scanf("%d", &n);

    int a[100005] = {};
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
    }

    int cnt = 1;
    int i = 1;
    while (n--) {
        if (a[i] == 2) {
            printf("%d\n", cnt);
            return 0;
        } else if (i == a[a[i]]) {
            break;
        }
        i = a[i];
        ++cnt;
    }
    printf("-1\n");
}

Measured memory_bytes: 512
#include<stdio.h>
int main()
{
  int H,W,i,j;
  while(1)
       {
  scanf("%d%d",&H,&W);
  if(H==0&&W==0){break;}
 
  for(i=1;i<=H;i++)
    {
      for(j=1;j<=W;j++)
    {
      if(i>1&&i<H&&j<W&&j>1)printf(".");
      else printf("#");
    }
      printf("\n");
    }
  printf("\n");
     
       }
  return 0;
}



Measured memory_bytes: 2044
import sys 
MOD = 10 ** 9 + 7
INF = 10**11
from heapq import heapify,heappush,heappop

dy = [-1,-1,-1,0,1,1,1,0]
dx = [-1,0,1,1,1,0,-1,-1]

def main():
    h,w = map(int,input().split())
    grid = [list(input()) for _ in range(h)]

    for i in range(h):
        for j in range(w):
            if grid[i][j] == '#':
                continue
            cnt = 0
            for k in range(8):
                y = i + dy[k]
                x = j + dx[k]
                if 0 <= y < h  and 0 <= x < w and grid[y][x] == '#':
                    cnt += 1
            grid[i][j] = str(cnt)
    
    for i in range(h):
        print(''.join(grid[i]))

if __name__=='__main__':
    main()

Measured memory_bytes: 3188
#!/usr/bin/php
<?php
$a=array(1,1,2);
for($i=3;$i<31;$i++)array_push($a,$a[$i-1]+$a[$i-2]+$a[$i-3]);
for(;$n=intval(fgets(STDIN));)echo intval(($a[$n]+3649)/3650).PHP_EOL;
?>

Measured memory_bytes: 6576
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int flag=0;
  int n; cin>>n;
  string str = to_string(n);
  for(int i=0; i<3; i++){if(str[i]=='7'){flag=1; break;}}
  if(flag)cout<<"Yes";
  else cout<<"No";
  return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int n = sc.nextInt();
	      String hina = "Three";
	      String check;
	      for(int i=0; i<n; i++) {
	    	  check = sc.next();
	    	  if(check.equals("Y")) {
	    		  hina = "Four";
	    	  }
	      }
	      System.out.println(hina);
	}

}


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

int main() {
  int H,N;
  int count = 0;
  cin >> H >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    count = count + A.at(i);
  }
  if (H > count) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

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

     }
     else{
        cout<<"Draw";
     }




    return 0;
}


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

#define ll long long

int main() {
	ll n, d, ans=0;
	cin >> n >> d;
	for(int i=0; i<n; ++i) {
		ll x, y;
		cin >> x >> y;
		if(x*x+y*y<=d*d)
			++ans;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
  int N; cin >> N;
  vector<pair<int, int>> r(N),b(N);
  rep(i,N) cin >> r[i].second >> r[i].first; //(y,x)
  rep(i,N) cin >> b[i].first >> b[i].second; //(x,y)

  sort(all(r)); reverse(all(r)); sort(all(b)); // rのyについて降順,bのxについて昇順
  
  int count = 0;
  vector<bool> usedr(N,true);
  rep(i,N) {
    rep(j,N) {
      if (usedr[j] && b[i].first > r[j].second && b[i].second > r[j].first) {
        usedr[j] = false;
        count++;
        break;
      }
    }
  }

  cout << count << endl;
}

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

char s[100010];
struct edge{
	int x,y;
}p[100010];
int len=0;
int tot=1;
int n;

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	if(s[1]!='1'){
		printf("-1");
		return 0;
	}
	if(s[n]=='1'){
		printf("-1");
		return 0;
	}
	for(int i=1;i<=n-1;i++) if(s[i]!=s[n-i]){
		printf("-1");
		return 0;
	}
	printf("%d %d\n",1,2);
	int now=2;
	for(int i=2;i<=n-1;i++){
		printf("%d %d\n",now,i+1);
		if(s[i]=='1') now=i+1;
	}
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

vector<int> c[200000];	// child
int ans[200000];
int x[200000];

void addValue(int p, int v){
	ans[p] = v + x[p];
	vector<int>::iterator itr = c[p].begin();
	while(itr != c[p].end()){
		addValue(*itr, ans[p]);
		itr++;
	}
}

int main()
{
	int N = inputValue();
	int Q = inputValue();
	REP(i, N){
		x[i] = 0;
	}
	REP(i, N-1){
		int a = inputValue();
		int b = inputValue();
		c[a-1].push_back(b-1);
	}
	REP(i, Q){
		int p = inputValue();
		int rx = inputValue();
		x[p-1] += rx;
	}
	addValue(0, 0);
	REP(i, N){
		cout << ans[i] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 21120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		
		InputStreamReader isr= new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		String strNum = br.readLine();
		String[] strNumList = strNum.split(" ");
		
		int intNumA = Integer.parseInt(strNumList[0]);
		int intNumB = Integer.parseInt(strNumList[1]);
		String strResult = "";
		
		if(intNumA != intNumB) {
			if(intNumA < intNumB) {
				strResult = "a < b";
			}else {
				strResult = "a > b";
			}
		}else {
			strResult = "a == b";
		}
		System.out.println(strResult);
	}
}


Measured memory_bytes: 24460