akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define L "\n"
#define S " "
#define ll long long
#define pb push_back
#define mp make_pair
#define vi std::vector<int>
#define si std::set<int>
#define vl std::vector<long long>
#define qi std::queue<int>
#define de(a) cout << #a << "  ------>  " << a << "\n"
#define SIZE 100002
#define INF INT_MAX
#define FOR(i, n) for (i = 0; i < n; i++)
#define FASTIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

int a[SIZE];
int n;
bool dp[SIZE][2];
bool flag[SIZE][2];

bool f(int k, int p)
{
    int choose, ch;
    if (k < a[0] && p == 0)
        return true;
    else if (k < a[0] && p == 1)
        return false;
    flag[k][p] = 1;
    bool res;

    if (p == 1)
        res = false;
    else if (p == 0)
        res = true;

    if (p == 1)
        ch = 0;
    else
        ch = 1;

    for (int i = 0; i < n; i++)
    {
        choose = a[i];
        if(k - choose < 0) continue;

        if (p == 1){
            if(flag[k - choose][ch]) res = res || dp[k - choose][ch];
            else res = res || f(k - choose, ch);
        }
        else if (p == 0){
            if(flag[k - choose][ch]) res = res && dp[k - choose][ch];
            else res = res && f(k - choose, ch);
        }
    }
    return dp[k][p] = res;
}

void solve()
{
    int k, i;
    cin >> n >> k;
    FOR(i, n)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    bool res = f(k, 1);
    if(res) cout << "First" << L;
    else cout << "Second" << L;
}
int main()
{
    FASTIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("in.txt", "r", stdin);
    // #endif
    int t;
    // cin >> t;
    // while (t--)
    solve();
    return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);

int main() {
    int N,K; cin >> N >> K;
    string S; cin >> S;
    int cnt = 0;
    REP(i,N-1) if(S[i] != S[i+1]) cnt++;
    cout << N-1-max(cnt-2*K,0) << endl;
}

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

int main(){
  int N;cin>>N;
  vector<int> A(N);
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if((i+1)*A.at(i)%2){
      ans++;
    }
  }
  cout<<ans<<endl;
}


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

int main() {
  int N, A[100];
  float s=0;
  
  cin >> N;
  for(int i=0; i<N; ++i) cin >> A[i];
  
  for(int i=0; i<N; ++i) s += 1./A[i];
  
  cout << (1./s) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,a,A,B,M;
vector<ll> v;
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(void){
    cin>>n>>m>>a;
    A=a/2;
    v.push_back(A);
    for(int i=1;i<n;i++){
        cin>>a;
        a/=2;
        v.push_back(a);
        M=gcd(A,a);
        //if(M%2==0){cout<<0<<endl;return 0;}
        A=(A*a)/M;
        if(A>m){cout<<0<<endl;return 0;}
    }
    //cout<<A<<endl;
    for(auto x:v){
        if(x*2!=M&&(A/x)%2==0){cout<<0<<endl;return 0;}
    }
    B=2*A;
    cout<<(m-A)/B+1<<endl;
}


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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	string s;
	cin>>s;
	if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
		cout<<"Bad";
	else
		cout<<"Good";
	return 0;
}

Measured memory_bytes: 3604
def main():
    N, K  = map(int, input().split())
    if K == 10:
        print(len(str(N)))
    else:
        mod = list()
        count = 0
        for i in range(10**9):
            a, b = divmod(N, K)
            N = a
            count += 1
            if N == 0:
                break
        print(count)
main()

Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		int[] b = new int[n];
		int k = Integer.MIN_VALUE;
		StringTokenizer st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
			k = Math.max(k, a[i]);
		}
		countingSort(a, b, k);
		StringBuilder sb = new StringBuilder();
		sb.append(b[0]);
		for (int i = 1; i < n; i++) {
			sb.append(" ").append(b[i]);
		}
		System.out.println(sb.toString());
	}

	private static void countingSort(int[] a, int[] b, int k) {
		int[] c = new int[k + 1];
		for (int i = 0; i < a.length; i++) {
			c[a[i]]++;
		}
		for (int i = 1; i <= k; i++) {
			c[i] += c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}
	}
}



Measured memory_bytes: 168348
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define rt return
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int n;
int a[maxn];
int cnt[maxn];
const ll mod=1e9+7ll;
map<int,int> b;
int main()
{
    //freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
	//freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
	gbtb;
	cin>>n;
	repd(i,1,n)
	{
		b[(n-i)-(i-1)]=i;
	}
	repd(i,1,n)
	{
		cin>>a[i];
		cnt[b[a[i]]]++;
	}
	ll ans=1ll;
	if(n&1)
	{
		if(cnt[n/2+1]==1)
		{
			repd(i,1,n/2)
			{
				// db(cnt[b[a[i]]]);
				if(cnt[b[a[i]]]==2)
				{
					ans*=2ll;
					ans=(ans+mod)%mod;
				}else
				{
					cout<<"0"<<endl;
					return 0;
				}
			}
			cout<<ans<<endl;
		}else
		{
			cout<<"0"<<endl;
		}
	}else
	{
			repd(i,1,n/2)
			{

				if(cnt[b[a[i]]]==2)
				{
					ans*=2ll;
					ans=(ans+mod)%mod;
				}else
				{
					cout<<"0"<<endl;
					return 0;
				}
			}
			cout<<ans<<endl;
	}
	
	
	
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}



Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+100;


int n,m;
int a[N],b[N];
int fa[N];
int bar[N];

int find(int x)
{
	return fa[x]  = (fa[x] == x ? x : find(fa[x]));
}


int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		fa[i] = i;
	//memset(vis,false,sizeof(vis));
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		int fx = find(a[i]);
		int fy = find(b[i]);
		if(fx==fy) continue;
		fa[fx] = fy;
	}
	int ans = 0;
	for(int i=1;i<=n;i++)
	{
		int nowfa = find(i);
		bar[nowfa]++;
		ans = max(ans,bar[nowfa]);
	}
	//for(int i=1;i<=m;i++)
		//scanf("%d",&b[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12132
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;


int main() {
  ll n; cin >> n;
  Vl a(n);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, n) a[i] -= i+1;
  sort(ALL(a));
  ll m = a[n/2];
  rep(i, 0, n) a[i] -= m;
  ll ans = 0;
  rep(i, 0, n) ans += abs(a[i]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    INT(x,y);
    out(abs(x-y));
}



Measured memory_bytes: 3192
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int N;
int A, B, C, D;

int main()
{
	scanf("%d", &N);
	D = N % 10;
	// cout << D;
	N = N / 10;
	C = N % 10;
	N = N / 10;
	B = N % 10;
	N = N / 10;
	A = N;


	if(A + B + C + D == 7)
	{
		cout << A << "+" << B << "+" << C << "+" << D << "=" << "7" << "\n"; 
	}
	else if(A + B - C - D == 7)
	{
		cout << A << "+" << B << "-" << C << "-" << D << "=" << "7"  << "\n"; 
	}
	else if(A + B - C + D == 7)
	{
		cout << A << "+" << B << "-" << C << "+" << D << "=" << "7"  << "\n"; 
	}
	else if(A + B + C - D == 7)
	{
		cout << A << "+" << B << "+" << C << "-" << D << "=" << "7"  << "\n"; 
	}
	else if(A - B + C + D == 7)
	{
		cout << A << "-" << B << "+" << C << "+" << D << "=" << "7"  << "\n"; 
	}
	else if(A - B - C + D == 7)
	{
		cout << A << "-" << B << "-" << C << "+" << D << "=" << "7"  << "\n"; 
	}
	else if(A - B + C - D == 7)
	{
		cout << A << "-" << B << "+" << C << "-" << D << "=" << "7"  << "\n"; 
	}
	else if(A - B - C - D == 7)
	{
		cout << A << "-" << B << "-" << C << "-" << D << "=" << "7"  << "\n"; 
	}

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using ll = long long;

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

struct P{
  ll x, y;
};

void dfs(int u, int p, std::vector<ll>& dp, std::vector<char>& visited, const std::vector<std::vector<int>>& Path) {
  visited[u] = 1;
  for (const auto v : Path[u]) {
    if (!visited[v]) dfs(v, u, dp, visited, Path);
    dp[u] = std::max(dp[u], 1 + dp[v]);
  }
}

int main(int argc, char** argv) {
  ll N, M;
  std::cin >> N >> M;
  std::vector<std::vector<int>> Path(N+1, std::vector<int>());
  rep(i, M) {
    ll x, y;
    std::cin >> x >> y;
    Path[x].push_back(y);
  }
  std::vector<ll> dp(N+1, 0);
  std::vector<char> visited(N+1, 0);
  for (auto i = 1;i <= N;++i) {
    if (!visited[i]) dfs(i, 0, dp, visited, Path);
  }
  ll answer {};
  for (auto i = 1;i <= N;++i) {
    answer = std::max(answer, dp[i]);
  }
  std::cout << answer << '\n';
}


Measured memory_bytes: 9344
/* This code is written by 7_shadows/civil_coder */

#include<bits/stdc++.h>
#define int             long long
#define mod             1000000007
#define size(x)          (int)((x).size())
#define fill(x, y) memset(x, y, sizeof(x))
using namespace std;

const int N = 100001;
int dp[N];
int minsteps(int a[], int k, int n) {
	//base case
	if (n == 1)
		return 0;
	if (dp[n] != -1)
		return dp[n];
	int ans = INT_MAX;
	for (int i = 1; i <= k; i++) {
		if (n - i >= 0)
			ans = min(ans, minsteps(a, k, n - i) + abs(a[n - 1] - a[n - i - 1]));
	}
	dp[n] = ans;
	return dp[n];

}

void solve() {
	int n, k; cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	fill(dp, -1);
	cout << minsteps(a, k, n) << '\n';

}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

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

Measured memory_bytes: 12964
n = int(input())
a = [int(i) for i in input().split()]
b = [abs(i) for i in a]
minus = 0
for i in range(n):
    if a[i] < 0:
        minus += 1
if minus%2:
    print(sum(b) - 2*min(b))
else:
    print(sum(b))


Measured memory_bytes: 14260
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from heapq import heappop, heappush
#input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a=inp()
        a-=1
        g[i].append(a)
        g[a].append(i)
    return n,g
def graphm():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(m):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append((b,w))
        g[b].append((a,w))
    return n,m,g

def dijkstra(s,n,g): # sからの最短距離 頂点数n
    s -= 1
    que = []
    d = [10**15 for _ in range(n)]
    d[s] = 0
    heappush( que,(0,s) )
    while len(que)>0:
        p =  heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(g[v])):
            edge = g[v][i]
            if d[edge[0]] > d[v] + edge[1]:
                d[edge[0]] = d[v] + edge[1]
                heappush( que,(d[edge[0]] , edge[0]) )
    return d

def main():
    s=input()
    n=len(s)
    cnt_a=0
    cnt_b=0
    cnt=0
    ans=0
    for i in range(n):
        if s[i]=="A":
            cnt_a+=1
        elif i<n-1 and s[i:i+2]=="BC":
            cnt_b+=1
            cnt+=cnt_a
        elif 0<i and s[i-1:i+1]=="BC":
            continue
        else:
            ans+=cnt
            cnt=0
            cnt_a=0
            cnt_b=0
    ans+=cnt
    print(ans)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 43100
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <sstream>
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //for writing to files
    //freopen('input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int N;
    vector<int> seq;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        seq.PB(x);
    }
    int minCost = INT_MAX;
    for (int i = -100; i <= 100; i++) {
        int cost = 0;
        for (auto x : seq) {
            cost += (i-x) * (i-x);
        }
        minCost = min(minCost, cost);
    }
    cout << minCost << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			long N=scan.nextLong();
			long P=scan.nextLong();

			if(N==1) {
				System.out.println(P);
				return;
			}else{

				long kouyaku = 0;

				long i=1;
				while(true) {
					long x =(long)Math.pow((double)i, (double)N);
					if(P<x)break;
					long S =P/x;
					long E =P%x;
					if(S!=0&&E==0) {
						kouyaku =i;
					}
					i++;
				}

				System.out.println(kouyaku);



			}

		}


	}


}


Measured memory_bytes: 35692
#include <stdio.h>

int main() {

	int A,B,i,X;

	scanf("%d %d", &A,&B);

	for (i = 0; i < 2; i++) {
		if (A >= B) {
			X = X + A;
			A = A - 1;
		}
		else if (B > A) {
			X = X + B;
			B = B - 1;
		}
	}

	printf("%d", X);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int D,S,T;
int main(){
	cin>>D>>T>>S;
	if(S*T<D)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3632
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    #up_G=[0]*n#up_G[i]=頂点iの親
    for a,b,c in ab:
        G[a-1].append((b,c%2))
        G[b-1].append((a,c%2))
        #up_G[b-1]=a
    return G #,up_G
from collections import deque
def dfs(G,v,p):
    q=deque()
    q.append((v,p,0))
    ans=[0]*n
    while q:
        V,P,S=q.pop()
        if S==0:
            #下に遷移していくときの処理
            #q.append((V,1))
            for new_v,dis in G[V-1]:
                if new_v==P:continue
                ans[new_v-1]=(ans[V-1]+dis)%2
                q.append((new_v,V,0))
    return ans
n=int(input())
uvw=[list(map(int,input().split())) for i in range(n-1)]
G=Graph(uvw)
#print(G)
ans=dfs(G,1,-1)
print(*ans,sep='\n')

Measured memory_bytes: 54156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

double BTCJPY = 380000.0;
int main() {
  int n;
  cin >> n;
  double sum = 0.0;
  rep(i, n) {
    double x;
    string u;
    cin >> x >> u;
    if(u[0] == 'J')
      sum += x;
    else
      sum += BTCJPY * x;
  }
  printf("%.10f\n", sum);
  return 0;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split(" "))
B_list = [int(i) for i in input().split(" ")]
ans = 0
for i in range(N):
    y = 0
    A_list = [int(k) for k in input().split(" ")]
    for j in range(M):
        y += A_list[j] * B_list[j]
    if y + C > 0:
        ans += 1
print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(int N) {
        return String.valueOf(N).indexOf('7') >= 0;
    }
}

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

int main()
{
    int N;
    int a[200001];
    int b[200001];
    long long result = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        b[i] = a[i] - (i + 1);
    }
    sort(b, b + N);
    for (int i = 0; i < N; i++)
    {
        result += abs(a[i] - (i + 1) - b[(N + 1) / 2 - 1]);
    }
    cout << result << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N,K,ans=1;
    scanf("%d%d",&N,&K);
    for(int i=0;i<N;i++){
        ans=min(ans*2,ans+K);
    }
    printf("%d",ans);
    return 0;
}


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



int main() {
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,m;
	cin>>n>>m;
	ll a = n*m;
	cout<<a<<endl;

	


	return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

template <class T>
struct fenwick_tree {
  vector<T> x;
  fenwick_tree(int n) : x(n + 1) {}
  void add(int k, T a) {
    for (++k; k < x.size(); k += k & -k) x[k] += a;
  }
  T sum(int k) {
    T s = 0;
    for (; k > 0; k &= k - 1) s += x[k];
    return s;
  }
  int lower_bound(T a) {
    if (a <= 0) return 0;
    int k = x.size() - 1;
    for (int s : {1, 2, 4, 8, 16}) k |= (k >> s);
    for (int p = ++k; p > 0; p >>= 1, k |= p)
      if (k < x.size() && x[k] < a)
        a -= x[k];
      else
        k ^= p;
    return k + 1;
  }
};

const int S = 1e5 * 2 + 1000;

int main() {
#ifdef LOCAL
  ifstream cin("in.txt");
#endif
  int N;
  while (cin >> N) {
    vector<ll> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    ll M = 1ll * (N + 1) * N / 4 + 1;
    ll ng = 0, ok = 1e9 + 10;
    while (ok - ng > 1) {
      ll x = (ng + ok) / 2;
      fenwick_tree<int> bit(S);
      ll cnt = 0, sum = 0;
      bit.add(S / 2, 1);
      for (int i = 0; i < N; i++) {
        sum += (a[i] <= x) ? +1 : -1;
        cnt += bit.sum(S / 2 + sum);
        bit.add(S / 2 + sum, 1);
      }
      if (cnt >= M) {
        ok = x;
      } else {
        ng = x;
      }
    }
    cout << ok << endl;
  }
  return 0;
}


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

class Main{


      public static void main(String args[])throws IOException{
	  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	  while(true)
	      {
		  String line = in.readLine();
		  int n,m;
		  n = Integer.parseInt(line.substring(0,line.indexOf(" ")));
		  m = Integer.parseInt(line.substring(line.indexOf(" ")+1));
		  if(n+m == 0)break;
		  String[] elements = in.readLine().split(" ");
		  
		  HashMap<String,Integer> index = new HashMap<String,Integer>();
		  index.put(elements[0],0);
		  index.put(elements[1],1);
		  index.put(elements[2],2);
		  int pos = 3;	      
		  int[][] imap = new int[n][n];
		  for(int i=0;i<n;i++)
		      for(int j=0;j<n;j++)
			  imap[i][j] = 10000000;

		  for(int i=0;i<m;i++)
		      {
			  String[] input = in.readLine().split(" ");

			  if(!index.containsKey(input[0]))
			      {
				  index.put(input[0],pos);
				  pos++;
			      }

			  if(!index.containsKey(input[1]))
			      {
				  index.put(input[1],pos);
				  pos++;
			      }

			  int d,t;
			  d = Integer.parseInt(input[2]);
			  t = Integer.parseInt(input[3]);

			  int cost = d/40 + t;

			  imap[index.get(input[0])][index.get(input[1])] = imap[index.get(input[1])][index.get(input[0])] = cost;

		      }

		  for(int k=0;k<n;k++)
		      for(int i=0;i<n;i++)
			  for(int j=0;j<n;j++)
			      imap[i][j] = Math.min(imap[i][j],imap[i][k] + imap[k][j]);

		  System.out.println(imap[index.get(elements[0])][index.get(elements[1])] + imap[index.get(elements[1])][index.get(elements[2])]);

	      }
      }

}

Measured memory_bytes: 15000
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main()
{
	int i,j,k,l,n,m;
	cin>>n>>m;
	 char a[n][m];
	 for(i=0;i<n;i++)
	 {
	 	for(j=0;j<m;j++)
	 	{
	 		cin>>a[i][j];
		 }
	 }
     int dp[n][m];
     for(i=0;i<n;i++)
     {
     	for(j=0;j<m;j++)
     	{
     		dp[i][j]=0;
		 }
	 }
     dp[0][0]=1;
     for(i=0;i<n;i++)
     {
     	for(j=0;j<m;j++)
     	{
     		if(i|j)
     		{
     	   if(a[i][j]!='#')
     	   {
     	   	//cout<<"ok\n";
     	   	dp[i][j]=((dp[max(i-1,0)][j])%MOD+(dp[i][max(j-1,0)])%MOD)%MOD;
			}
		 }
	 }
    }
 
          cout<<dp[n-1][m-1];
          return 0;
      }








Measured memory_bytes: 5120
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[int(input())-1])

Measured memory_bytes: 3060
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int N = sc.NextInt();
        Console.WriteLine((N - 1) / 2);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

using namespace std;
#define ll long long int
int const mod=1000000007;
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll b[m];
    for(int i=0;i<m;i++)
        cin>>b[i];
    ll sum=0;
    int i=0;
    while(sum+a[i]<=k && i<n)
    {
        sum+=a[i];
        i++;
    }
    i--;
    int j=0;
    ll maxi=i+1,ans=i+1;
    while(j<m)
    {
        if(sum+b[j]<=k)
        {
            sum+=b[j];
            j++;
            ans++;
        }
        else if(i>=0)
        {
            sum-=a[i];
            i--;
            ans--;
        }
        maxi=max(maxi,ans);
        if(i<0 && sum+b[j]>k)
            break;
    }
    cout<<maxi;
}


Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
static const int N = 1000;

int  lcs(string X, string Y)
{
    int c[N + 1][N + 1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X.insert(0, " ");  // X[0]に空白を挿入
    Y.insert(0, " ");;  // Y[0]に空白を挿入

    for (int i = 1; i <= m; i++) c[i][0] = 0;
    for (int j = 1; j <= n; j++) c[0][j] = 0;

    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (X[i] == Y[j]) {
                c[i][j] = c[i - 1][j - 1] + 1;
            } else {
                c[i][j] = max(c[i - 1][j], c[i][j - 1]);
            }
            maxl = max(maxl, c[i][j]);
            // if (c[i][j] > maxl) {
            //     maxl = c[i][j];
            // }
        }
    }

    return maxl;
}

int main()
{
    string s1, s2;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 7064
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let (n, m): (usize, usize);
    input!(n, m);
    let mut v = vec![vec![]; n];
    let mut input = vec![];

    for _ in 0..m {
        let (p, y): (usize, isize);
        input!(p, y);
        input.push((p, y));
        v[p - 1].push(y);
    }

    for i in 0..n {
        v[i].sort();
    }

    for (p, y) in input {
        println!("{:>06}{:>06}", p, v[p - 1].binary_search(&y).unwrap() + 1);
    }
}

Measured memory_bytes: 13820
s=input()
n=len(s)
def dfs(i,x):
    if i==n-1:
        return sum(list(map(int,x.split('+'))))
    return dfs(i+1,x+s[i+1])+dfs(i+1,x+'+'+s[i+1])
print(dfs(0,s[0]))

Measured memory_bytes: 3060
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val d = Array.fill(n, 2)(sc.nextInt)

  val three = countZ(0, 0, d.map(z => z(0) == z(1)))
  if(three >= 3) {
    println("Yes")
  } else {
    println("No")
  }

  def countZ(z: Int, max: Int, dd: Array[Boolean]): Int ={
    val nz = if (dd.head) z + 1 else 0
    val nmax = Math.max(max, nz)
    return if(dd.length == 1) {
      nmax
    } else {
      countZ(nz, nmax, dd.tail)
    }
  }

}


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

int main(){
  int W,H,x,y,r,left,right,up,down;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  left=x-r;right=x+r;
  up=y+r;down=y-r;
  if(0<=left && right<=W && 0<=down && up <=H){
    printf("Yes\n");
  }
  else printf("No\n");
}



Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1111];
signed main(){
  int n,w,cnt=0;
  while(cin>>n>>w,n||w){
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int INF=1LL<<55LL;
    fill_n(dp,n+1,INF);
    dp[0]=0;
    int ans=INF;
    for(int i=0;i<n;i++){
      int tmp=0;
      for(int j=i;j<n;j++){
	tmp+=a[j];
	dp[j+1]=min(dp[j+1],dp[i]+abs(tmp-w));
	if(j+1==n) ans=min(ans,dp[i]+max(0LL,tmp-w));
      }
    }
    cout<<"Case "<<++cnt<<": "<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2988
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


a, b = inl()
print(a+b if a + b < 10 else 'error')


Measured memory_bytes: 3572
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
ll i,j,k;
ll n,m;
ll p;
ll a;

ll rui(ll x){
	ll ans = 1;
	for(j=0;j<x;j++){
		ans *= 2;
	}
	return ans;
}


int main(){
	cin>>n>>p;
	bool flag=false;
	for(i=0;i<n;i++){
		cin>>a;
		if(a%2==1)flag=true;
	}
	if(flag){
		cout<<rui(n-1)<<endl;
	}else if(p%2==0){
		cout<<rui(n)<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;


}

Measured memory_bytes: 4992
package main
import (
  ."fmt"
  "bufio"
  "os"
  "strings"
)

var str = bufio.NewScanner(os.Stdin)


func main()  {
  str.Split(bufio.ScanLines)
  word := read()
  if strings.Contains(word, "AC") {
    Println("Yes")
  } else {
    Println("No")
  }
}


func read() string {
  str.Scan()
  return str.Text()
}


Measured memory_bytes: 640
using System;

public static class C
{
    public static void Main()
    {
        int a = 0;
        int b = 0;
        
        string input = Console.ReadLine();
        string[] sp = input.Split(' ');
        a = int.Parse(sp[0]);
        b = int.Parse(sp[1]);
        
        Console.WriteLine($"{a / b} {a % b} {((double)a / (double)b).ToString("0.00000")}");
    }
}


Measured memory_bytes: 18024
#include <iostream>
using namespace std;
int main(){
	char a[100001];
	int b[100001];
	int k,i,count=0,n;

	for(i=0;i<=100000;i++){
		a[i]='\0';
	}
	cin>>a;
	cin>>k;
	for(i=0;i<=100000;i++){
		if(a[i]=='\0'){
			n=i;
			break;
		}else{
			b[i]=a[i];
			b[i]=b[i]-97;//a=0,z=25
		}
	}
	for(i=0;i<n;i++){
		if(k==0){
			break;
		}else if(b[i]==0){
		}else if(26-b[i]<=k){
			k=k+b[i]-26;
			b[i]=0;
		}
	}
	for(;k>=26;)k=k-26;

	b[n-1]=b[n-1]+k;
	if(b[n-1]>=26)b[n-1]=b[n-1]-26;
		for(i=0;i<n;i++){
		b[i]=b[i]+97;
		a[i]=b[i];
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int field[20][20]={0};
  int x,y,s;
  while(scanf("%d,%d,%d",&x,&y,&s)!=EOF){
    x+=5;
    y+=5;
    if(s>2){
      field[x+2][y]++;
      field[x-2][y]++;
      field[x][y+2]++;
      field[x][y-2]++;
    }
    if(s>1){
      field[x+1][y+1]++;
      field[x+1][y-1]++;
      field[x-1][y+1]++;
      field[x-1][y-1]++;
    }
    field[x][y]++;
    field[x+1][y]++;
    field[x][y+1]++;
    field[x-1][y]++;
    field[x][y-1]++;
  }
  int aans=0,bans=0;
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      if(field[i+5][j+5] == 0) aans++;
      if(bans<field[i+5][j+5]) bans = field[i+5][j+5];	
    }
  }
  cout <<aans<<endl<<bans<<endl;
  return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
int s[200];
int main()
{
     int n,a,b,c;
     scanf("%d%d%d",&a,&b,&c);
     scanf("%d",&n);
     int sum=0;
     for(int i=0;i<=a;i++)
          for(int j=0;j<=b;j++)
          for(int k=0;k<=c;k++)
     {
          int ans=500*i+j*100+k*50;
          if(ans==n)sum++;
     }
     printf("%d\n",sum);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int A,B;
    cin >> A >> B;
    if(A <= 2*B)
        cout << 0 << endl;
    else
        cout << A - 2 * B << endl;

    
}

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

int merge(vector<int> &s, int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	int i, j, k;
	vector<int> l(n1 + 1);
	vector<int> r(n2 + 1);

	for (i = 0; i < n1; i++)
	{
		l[i] = s[left + i];
	}
	for (i = 0; i < n2; i++)
	{
		r[i] = s[mid + i];
	}
	l[n1] = 9999999999;
	r[n2] = 9999999999;

	i = 0;
	j = 0;
	for (k = left; k<right; k++) {
		if (l[i] <= r[j]) {
			s[k] = l[i];
			i++;
			
		}
		else {
			s[k] = r[j];
			j++;
		}
	}
	return right - left;
}

int merge_sort(vector<int> &s, int left, int right) {
	int mid, count = 0;
	if (left + 1<right) {
		mid = (left + right) / 2;
		count += merge_sort(s, left, mid);
		count += merge_sort(s, mid, right);
		count += merge(s, left, mid, right);

	}
	return count;
}

int main() {
	int i, x, n;
	vector<int> s(500000);
	cin >> n;
	for (i = 0; i<n; i++)cin >> s[i];

	x = merge_sort(s, 0, n);

	for (i = 0; i<n; i++) {
		if (i)cout << " ";
		cout << s[i];
	}
	cout << '\n';
	cout << x << '\n';
	return 0;
}


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

const int MaxN=2e5;
const int MaxM=2e5;

int cnt[MaxN+1];
int who[MaxN+1];

inline int FindRoot(int x){
	if(who[x]!=x)
		who[x]=FindRoot(who[x]);
	return who[x];
}
int main(){
	int N, M;
	int A, B, who_A, who_B;
	
	scanf("%d %d\n",&N,&M);
	for(int i=1;i<=N;i++)
		who[i]=i, cnt[i]=1;
	int ans=1;
	while(M-->0){
		scanf("%d %d\n",&A,&B);
		who_A=FindRoot(A);
		who_B=FindRoot(B);
		if(who_A==who_B) continue;
		if(cnt[who_A]<cnt[who_B])
			swap(who_A,who_B);
		who[who_B]=who_A;
		cnt[who_A]+=cnt[who_B];
		ans=max(ans,cnt[who_A]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 5244
/*
  C - 白昼夢 / Daydream
  <http://abc049.contest.atcoder.jp/tasks/arc065_a>
  ・ヌル文字('\0')とヌルポインタ(NULL)は違う。<http://www.kis-lab.com/serikashiki/C/C01.html>
*/

#include <stdio.h>
#include <string.h>

int main(int argc, char const *argv[]) {

  char S[100001];
  char str[4][8] = {"dream", "dreamer", "erase", "eraser"};
  char tmp;
  int len;
  int i, j;
  int pt;

  scanf("%s", S);

  len = strlen( S );
  for( j=0; j<len/2; j++){
    tmp = S[j];
    S[j] = S[len-1-j];
    S[len-1-j] = tmp;
  }

  for( i=0; i<4; i++ ){
    len = strlen( str[i] );
    for( j=0; j<len/2; j++ ){
      tmp = str[i][j];
      str[i][j] = str[i][len-1-j];
      str[i][len-1-j] = tmp;
    }
  }

  pt = 0;
  while( S[pt] != '\0'){
    i = 0;
    while( i<4 ){
      len = strlen(str[i]);
      j = 0;
      while( j<len ){
          if( S[pt+j] == str[i][j] ){
            j++;
          }else{
            break;
          }
      }
      if( j==len ){
        pt += len;
        break;
      }
      if( i==3 ){
        printf("NO");
        return 0;
      }else{
        i++;
      }
    }
  }
  printf("YES");
  return 0;

}


Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val S = next()
    val T = next()
    for (i in S.length - T.length downTo 0) {
        val sub = S.substring(i, i + T.length)
        if (match(sub, T)) {
            val ans = S.replaceRange(i, i + T.length, T).replace("?", "a")
            println(ans)
            return
        }
    }
    println("UNRESTORABLE")
}

fun match(S: String, T: String): Boolean {
    for (i in S.indices) {
        if (S[i] != '?' && S[i] != T[i]) return false
    }
    return true
}

Measured memory_bytes: 37952
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){
    int n,m,a,b;
    int buf[300];
    cin >> n >> m;
    memset(buf, -1, sizeof(buf));

    for(int i=0;i<m;i++){
        cin >> a >> b;
        for(int j=a;j<=b;j++){
            buf[j] = max(buf[j], b);
        }
    }
    int ret = 0,pos = 1;
    while(pos <= n){
        if(buf[pos] == -1){
            ret = -1;
            break;
        }else{
            pos = buf[pos] + 1;
            ret++;
        }
    }
    if(ret == -1){
        cout << "Impossible" << endl;
    }else{
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
import java.util.*;

class Main {
    class Node {
        int id;
        Node left;
        Node right;
        Node parent;

        public Node(int id) {
            this.id = id;
        }

        public void setLeft(Node left) {
            this.left = left;
            left.parent = this;
        }

        public void setRight(Node right) {
            this.right = right;
            right.parent = this;
        }

        public Node root() {
            if (this.parent == null) {
                return this;
            } else {
                return this.parent.root();
            }
        }
    }

    boolean printing;

    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        Node[] nodes = new Node[n];
        for (int i = 0; i < n; i++) {
            nodes[i] = new Node(i);
        }

        for (int i = 0; i < n; i++) {
            String[] line = scanner.nextLine().split(" ", -1);
            int id = Integer.parseInt(line[0]);
            int left = Integer.parseInt(line[1]);
            int right = Integer.parseInt(line[2]);

            Node node = nodes[id];
            if (left != -1) {
                node.setLeft(nodes[left]);
            }
            if (right != -1) {
                node.setRight(nodes[right]);
            }
        }

        Node root = nodes[0].root();

        System.out.println("Preorder");
        this.printing = false;
        this.preorder(root);
        System.out.print("\n");

        System.out.println("Inorder");
        this.printing = false;
        this.inorder(root);
        System.out.print("\n");

        System.out.println("Postorder");
        this.printing = false;
        this.postorder(root);
        System.out.print("\n");
    }

    private void preorder(Node node) {
        this.countNode(node);
        if (node.left != null) {
            this.preorder(node.left);
        }
        if (node.right != null) {
            this.preorder(node.right);
        }
    }

    private void inorder(Node node) {
        if (node.left != null) {
            this.inorder(node.left);
        }
        this.countNode(node);
        if (node.right != null) {
            this.inorder(node.right);
        }
    }

    private void postorder(Node node) {
        if (node.left != null) {
            this.postorder(node.left);
        }
        if (node.right != null) {
            this.postorder(node.right);
        }
        this.countNode(node);
    }

    private void countNode(Node node) {
        System.out.printf(" %d", node.id);
        this.printing = true;
    }
}



Measured memory_bytes: 26432
//136 Uneven Numbers 2019/08/04
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

bool is_uneven(int x){
    int counter=0;
    while(x>0){
        x/=10;
        ++counter;
    }
    return (counter%2!=0 ? true : false);
}

int main(){
    int64 n; cin >> n;
    int64 counter=0;
    for(int i=1;i<=n;++i) {
        if(is_uneven(i)) ++counter;
    }
    cout << counter << endl;
}

Measured memory_bytes: 256