akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return (ans.x+m)%m;
}
int fact[N];
void calfac(int n ){
fact[0] = 1;
for(int i = 1 ; i <= n+2; i++){
 fact[i] = (((fact[i-1]%mod)*(i%mod))%mod + mod)%mod;
}
 }
int calc(int n , int r){
 if(r > n)return 0;
 if(r == n)return 1;
 int ans = 1;
 ans = ((ans%mod)*(fact[n])%mod + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[n-r] , mod)%mod) + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[r] , mod)%mod) + mod)%mod;
 return (ans+mod)%mod;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
vector<pi> v;
for(int i =0  ;i  < n ; i++){
	 int x ,y;
	 cin>>x>>y;
	 v.pb({x , y});
}
for(int i = 0 ; i <= n-3 ; i++){
	bool ok = true;
	if(v[i].f != v[i].s){
     continue;
	}
	  for(int j = i+1 ; j < i+3 ; j++){
                if(v[j].f != v[j].s){
                  ok = false;
                  break;
                }
	  }
	  if(ok){
	  	cout<<"Yes"<<endl;
	  	return 0;
	  }
}
cout<<"No"<<endl;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

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




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

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

    ll n, h;
    cin >> n >> h;

    ll strong_a=0;
    vll b(n);
    rep(i, n){
        ll a;
        cin >> a >> b[i];
        strong_a = max(strong_a, a);
    }

    sort(ALL(b), greater<ll>());
    ll attack = 0;
    rep(i, n){
        if(b[i] >= strong_a && h > 0){
            h -= b[i];
            attack++;
        }
    }

    if(h > 0) attack += ceil((double)h / strong_a);
    ppp(attack);


    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<pair<string,pair<int,int> > > v;
    string s;
    int a;
    for(int i=0;i<n;i++){
        cin>>s>>a;
        v.pb(make_pair(s,make_pair(-a,i)));
    }
    sort(be(v));
    for(int i=0;i<n;i++){
        cout << v[i].second.second+1<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> v;
int a[maxn];
int main(){
   // freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    int t;
    for(int i = 0; i < n; i++){
        cin >> t;
        a[i] = t;
        v.push_back(t);
    }
    sort(v.begin(), v.end());
    int f,s;
    f = n/2-1;
    s = f+1;
    for(int i = 0; i < n; i++){
        if(a[i] <= v[f]) cout << v[s] << "\n";
        else cout << v[f] << "\n";
    }
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>

using namespace std;

int main(void) {
    int N, K, X, Y, cost;
    cin >> N >> K >> X >> Y;
    if (N <= K) {
        cost = N*X;
    } else {
        cost = K*X + (N - K)*Y;
    }

    cout << cost << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int t1,t2,a1,a2,b1,b2;
  cin>>t1>>t2>>a1>>a2>>b1>>b2;
  
  int s1=t1*(a1-b1);
  int s2=t2*(a2-b2);
  if(s1>0){
    s1*=-1;
    s2*=-1;
  }

  if(s1+s2<0){
    cout<<0<<endl;
  }else if(s1+s2==0){
    cout<<"infinity"<<endl;
  }else{
    int s=(-s1)/(s1+s2);
    int t=(-s1)%(s1+s2);
    cout<<2*s+!!t<<endl;
  }


}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;




int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> A(3, vector<int>(3)); cin >> A;
    int N; cin >> N;
    vector<int> B(N); cin >> B;
    for(int b : B) {
        rep(i, 3) rep(j, 3) if(A[i][j] == b) A[i][j] = -1;
    }
    bool ans = false;
    rep(i, 3) {
        bool ok1 = true;
        bool ok2 = true;
        rep(j, 3) ok1 &= A[i][j] == -1;
        rep(j, 3) ok2 &= A[j][i] == -1;
        ans = ans || ok1 || ok2;
    }
    ans |= (A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1);
    ans |= (A[2][0] == -1 and A[1][1] == -1 and A[0][2] == -1);
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    string s;
    cin >> s;
    int ans = INT_MAX;
    rep(i,s.size()-2){
        int hoge = stoi(s.substr(i,3));
        ans = min(ans,abs(hoge-753));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    string s;
    cin >> s;

    if(((int)s.size())%2!=0){
        cout << "No" << endl;
        return 0;
    }

    string answer = "Yes";
    rep(i, (int)s.size())
    {
        if (i % 2 == 0)
        {
            if (s.at(i) == 'h')
            {
                continue;
            }
            else
            {
                answer = "No";
                break;
            }
        }
        else
        {
            if (s.at(i) == 'i')
            {
                continue;
            }
            else
            {
                answer = "No";
                break;
            }
        }
    }

    cout << answer << endl;
}

Measured memory_bytes: 256
N = int(input())
list0 = {}
for i in range(N):
  x = input()
  if x in list0:
    list0[x] = list0[x] + 1
  else:
    list0[x] = 1
m = max(list0.values())
k_m = [key for key in list0 if list0[key] == m]
k_m.sort()
for i in range(len(k_m)):
  print(k_m[i])

Measured memory_bytes: 32096
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
 
int N, K;
int ans = 1;
 
int main()
{
	in >> N >> K;
 
	rep(i, N)
	{
		if (ans * 2 < ans + K) { ans *= 2; }
		else { ans += K; }
	}
 
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int x;
	cin>>x;
	long long int a,b;
	a = 0;
	int tf = 0;
	while(tf==0)
	{
		long long int aa = a*a*a*a*a;
		b = 0;
		while(a>=b&&tf==0)
		{
			if(aa-(b*b*b*b*b)==x)
			{
				cout<<a<<" "<<b<<endl;
				tf++;
			}
			else
			{
				if(aa+(b*b*b*b*b)==x)
				{
					cout<<a<<" "<<0-b<<endl;
					tf++;
				}
			}
			b++;
		}
		a++;
	}
	return 0;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5

int main(){
	string s;
	cin>>s;
	bool flag=true;
	for(int i=0;i<sz(s)-1;i++){
		if(s[i]==s[i+1]) flag=false;
	}
	if(flag) cout<<"Good"<<endl;
	else cout<<"Bad"<<endl;
	}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num;
        var ar = Input.ar;
        var max = ar[0];
        var maxj = 1;
        var min = ar[0];
        var minj = 1;
        for(var i=1; i<num;i++)
        {
            if (max < ar[i]) { max = ar[i];maxj = i + 1; }
            if (min > ar[i]) { min = ar[i];minj = i + 1; }
        }WriteLine(2 * num - 2);

        WriteLine(string.Join("\n", Enumerable.Range(1, num).Where(v => v != (max > Abs(min) ? maxj : minj)).Select(v => $"{(max > Abs(min) ? maxj : minj)} {v}")));
        if (max > Abs(min))
            WriteLine(string.Join("\n", Enumerable.Range(1, num - 1).Select(v => $"{v} {v + 1}")));
        else
            WriteLine(string.Join("\n", Enumerable.Range(1, num - 1).Reverse().Select(v => $"{v + 1} {v}")));
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13524
package main

import (
	"fmt"
    "sort"
    "strings"
)

func main() {
	var n, l int
	fmt.Scanf("%d %d", &n, &l)
    strs := make([]string, n)
    for i:= 0; i < n; i++ {
      fmt.Scan(&strs[i])
    }
    sort.Strings(strs)
    fmt.Print(strings.Join(strs, ""))
}


Measured memory_bytes: 1856
import numpy as np
N, K = map(int, input().split())

A = np.array(list(map(int, input().split())))
A.sort()

pos = A[A > 0]
neg = A[A < 0]
zero = A[A == 0]

l = -10**18
r = 10**18

while l + 1 < r:
    x = (l+r) // 2
    cnt = 0
    if x >= 0:
        cnt += N * len(zero)

    cnt += A.searchsorted(x//pos, side="right").sum()
    cnt += (N - A.searchsorted(-(-x//neg), side="left")).sum()
    cnt -= np.count_nonzero(A * A <= x)
    cnt //= 2

    if cnt >= K:
        r = x
    else:
        l = x

print(r)




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

#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N;
string s;
int dp[3030][3030];//i番目まででj番目に大きい数

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>N>>s;
    rep(i,0,N)dp[0][i]=1;
    rep(i,0,N-1){
        rep(j,0,N-i){
            if(s[i]=='<'){
                (dp[i+1][0]+=dp[i][j])%=MOD;
                (dp[i+1][j]-=dp[i][j])%=MOD;
            }else{
                (dp[i+1][j]+=dp[i][j])%=MOD;
                (dp[i+1][N-i]-=dp[i][j])%=MOD;
            }
        }
        rep(j,0,N+1)dp[i+1][j+1]=(dp[i+1][j+1]+dp[i+1][j]+MOD)%MOD;
    }
    cout<<dp[N-1][0]<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0)
			break;
			
		int gap=-1;
		int n=-1;
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin;i<nmax+1;i++){
			if(P[i-1]-P[i]>=gap){
				gap=P[i-1]-P[i];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

struct UnionFind {
    // 親の番号を入れる配列。根のときはpar[i] = i
    vector<int> par;

    // 初めは空グラフとして初期化
    UnionFind(int N) : par(N){
        for(int i = 0; i < N; i++) par[i] = i;
    }

    // その点を含む成分の根を取り出す
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    // xとyを同じ成分に入れる
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    // xとyが同じ成分に入っているか判定
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    int a, b;
    UnionFind UF(N);
    for (int i = 0; i < M; i++) {
        cin >> a >> b; a--; b--;
        UF.unite(a, b);
    }

    int ans = 1;
    vector<int> cnt(N, 0);

    for (int i = 0; i < N; i++) {
        cnt[UF.root(i)]++;
    }

    for (int i = 0; i < N; i++) {
        ans = max(ans, cnt[i]);
    }

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

}

Measured memory_bytes: 11148
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

int main() {
	fast;
	int n;
	cin>>n;
	int dp[n][3],energy[n][3];
	memset(dp,0,sizeof(dp));
	for(int i=0;i<n;i++) cin>>energy[i][0]>>energy[i][1]>>energy[i][2];
	dp[n-1][0]=energy[n-1][0],dp[n-1][1]=energy[n-1][1],dp[n-1][2]=energy[n-1][2];
	for(int i=n-2;i>=0;i--){
		dp[i][0]=energy[i][0]+max(dp[i+1][1],dp[i+1][2]);
		dp[i][1]=energy[i][1]+max(dp[i+1][0],dp[i+1][2]);
		dp[i][2]=energy[i][2]+max(dp[i+1][0],dp[i+1][1]);
	}
	cout<<max(dp[0][0],max(dp[0][1],dp[0][2]))<<"\n";
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string a, b;
    cin >> a >> b;
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    if(s.compare(a) == 0)
    {
        cout << n-1 << " " << m << endl;
    }
    else
    {
        cout << n << " " << m-1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int m,n,i,c,a,t;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d %d %d",&c,&a,&n);
    if(c>a){
      if(a>n)t=n;
      else   t=a;
    }
    else{
      if(c>n)t=n;
      else   t=c;
    }
    c-=t;
    a-=t;
    if(a*2<=c){
      t+=a;
      c-=a*2;
      t+=c/3;
    }
    else t+=c/2;
    printf("%d\n",t);
  }
  return 0;
}
    

Measured memory_bytes: 600
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int s_num = 0; s_num < n - 1; ++s_num){
        int buka;
        cin >> buka;
        ++a[buka-1]; 
    }
    for(int i = 0; i < n; ++i){
        cout << a[i]<< endl;
    }
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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 countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) os << v[i] << " ";  
    return os; 
}

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}

int main()
{
    ll N, x;
    cin >> N >> x;
    if (x == 2*N-1 || x == 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        if (N == 2) {
            rep(i, 2*N-1) print(i+1);
        } else {
            vector<ll> ans(2*N-1);
            if (x < 2*N-2) {
                ans[N-1] = x;
                ans[N-2] = x+1;
                ans[N] = x-1;
                ans[N+1] = x+2;
                ll cnt = 1;
                rep(i, 2*N-1) {
                    if (i < N-2 || N+1 < i) {
                        if (cnt == x-1) cnt += 4;
                        ans[i] = cnt;
                        cnt++;
                    }
                }
            } else {
                ans[N-1] = x;
                ans[N-2] = x-1;
                ans[N] = x+1;
                ans[N+1] = x-2;
                ll cnt = 1;
                rep(i, 2*N-1) {
                    if (i < N-2 || N+1 < i) {
                        if (cnt == x-2) cnt += 4;
                        ans[i] = cnt;
                        cnt++;
                    }
                }
            }
            
            rep(i, 2*N-1) print(ans[i]);
        }
    }
    return 0;
} 

Measured memory_bytes: 3072
from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(string):
    n, m, *a = map(int, string.split())
    c = 2**len(bin(a[0]).split("1")[-1])
    l = a[0]
    for _a in a:
        if _a % c or not _a // c % 2:
            return "0"
        l = lcm(l, _a)
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 17132
#define _USE_MATH_DEFINES

#include <iostream>
#include <math.h> 
#include <vector>
#include <algorithm>
#include <iomanip>      // std::setprecision
#include <map>
#include <unordered_map>
#include <string>
#include <set>

using namespace std;

int main()
{

	double a,b,x,sol;
	std::vector<int> nums;
	cin >> a >> b >> x;
	double empty_area = (a*a*b) - x;
	double adj = empty_area / ((a/2)*a);
	if (adj <= b)
	{
		double opposite = a;
		double angle = atan(opposite / adj) * 180 / M_PI;
		std::cout << setprecision(10) << 90 - angle;
	}
	else
	{
		double s = (2 * x) / (a*b);
		double opposite = s;
		double adj = b;
		double angle = atan(opposite / adj) * 180 / M_PI;
		std::cout << setprecision(10) << 90 - angle;
	}
	
}


Measured memory_bytes: 512
n = int(input())
s = list(input())
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
count = 0
for a in genkai_list:
    try:
        s_ = s[s.index(a[0])+1:]
        s__ = s_[s_.index(a[1])+1:]
        if a[2] in s__:
            count += 1
    except:
        continue
print(count)

Measured memory_bytes: 132440
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readString() -> String {
    return readLine()!
}

func readLines(times: Int) -> [String] {
    var array = [String]()
    for _ in 0..<times {
        array.append(readLine()!)
    }
    return array
}

func readSeparatedStrings() -> [String] {
    return readLine()!.split(separator: " ").map {String($0)}
}

func readStringToStrings() -> [String] {
    return readLine()!.map{String($0)}
}

func readSeparatedInts() -> [Int] {
    return readLine()!.split(separator: " ").map {Int($0)!}
}
func readSeparatedDouble() -> [Double] {
    return readLine()!.split(separator: " ").map {Double($0)!}
}

// 二進数に変換
func convertIntToRadix2(n: Int, radix: Int = 2) -> String {
    return String(n, radix: radix)
}

//配列を逆順にする reverced ソートする　sorted
//最初数文字取得 prefix


let NXT = readSeparatedInts()
let n = NXT[0]
let x = NXT[1]
let t = NXT[2]

if n.isMultiple(of: x) {
    print(Int(n / x) * t)
} else {
    print((Int(n / x) + 1) * t)
}


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

int main(){
  vector<int> A(10);

  for(int i=0; i<10; i++) cin >> A[i];

  sort(A.begin(), A.end());

  cout << A[9] << endl;
  cout << A[8] << endl;
  cout << A[7] << endl;
}


Measured memory_bytes: 3148
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = S()
    t = S()
    cnt = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            cnt += 1
    print(cnt)

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

int main(){
  int N;
  cin >> N;
  
  int i;
  vector<int> a(100000);
  
  for(i = 0;i < N;i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  
  
  int k;
  int kekka = 0;
  for(k = 0;k < N;k++){
    if(a.at(k) > a.at(k+1)){
      kekka++;
    }
  }
  
  cout << kekka << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;


//頂点fromから頂点toへのcost
struct edge{
  ll from,to,cost;
  edge (ll from,ll to,ll cost):from(from),to(to),cost(cost){}
};

vector<ll>d;//最短距離
vector<int>to[2505],rto[2505];
vector<bool> reach1,reachN;
vector<int>ok;
bool ans=true;

void dfs(int v){
    if(reach1[v])return;
    reach1[v]=true;
    for(auto x:to[v]){
      dfs(x);
    }
}
void dfs2(int v){
    if(reachN[v])return;
    reachN[v]=true;
    for(auto x:rto[v]){
      dfs2(x);
    }
}

void bellman_ford(vector<edge> &es,int V,int s){//es:頂点,costという要素からなる、辺についての配列、V:頂点数,s:スタート地点
    d.resize(V+1,INF);
    ll cnt=0;
    d[s]=0;
    bool upgrade=true;
    while(upgrade){
      ++cnt;
      if(cnt>V){
        ans=false;
        return;
      }
      upgrade=false;//フラグ
    //それぞれの頂点につき1回ずつしか通らないため、V-1回しかループは実行されない(V回目があるときは負の辺を含む)
        for(auto &e:es){//esの変更が反映される
            if(d[e.from]==INF)continue;
            if(!ok[e.from])continue;
            if(!ok[e.to])continue;
            if(d[e.to]>d[e.from]+e.cost){
            d[e.to]=d[e.from]+e.cost;
            upgrade=true;
            }
        }
    }
}

int main(){
    ll n,m,p;
    cin>>n>>m>>p;
    vector<edge>es;
    reach1.resize(n,false);reachN.resize(n,false);
    ok.resize(n,0);
    rep(i,m){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        es.emplace_back(a,b,-(c-p));
        to[a].pb(b);rto[b].pb(a);
    }
    dfs(0);
    dfs2(n-1);
    rep(i,n)if(reach1[i]&&reachN[i])ok[i]=1;
    bellman_ford(es,n,0);
    if(!ans)cout<<-1<<endl;
    else cout<<max((ll)0,-d[n-1])<<endl;
    return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		if(t.indexOf(s) == 0){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35772
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define N 1000005
typedef long long int ll;
//const int mx=1e5+7;
//int n,m;
//vector<int> a(mx),b(mx);
// vector<int> g[mx];
// int deg[mx];
//vector<int> adj[mx];
//vector<int> ans;
//---dfs--
// bool visited[mx];
// vector<ll> val(mx,0);

// void dfs(int s,int e,int c1,int c2){
// 	if(a[s]^c1!=b[s]) {ans.push_back(s), c1^=1;}
// 	for(auto u:adj[s]){
// 		if(u!=e){
// 			dfs(u,s,c2,c1);
// 		}
// 	}
// }
//---dfs---

//---primes---
// const int N = 1e7 + 10;

// bool prime[N];
 
// int spf[N];
 
// void calc(){
// 	for(int i = 2; i<1e4; i++){
// 		if(prime[i])
// 			continue;
// 		spf[i] = i;
// 		for(int j = i * i; j < N; j += i){
// 			prime[j] = 1;
// 			spf[j] = i;
// 		}
// 	}
// 	for(int i = 2; i < N; i++)
// 		if(!spf[i])
// 			spf[i] = i;
// }

// vector<pair<int,int>> getp(int x){
// 	int curr=x;
// 	vector<pair<int,int>> ans;
// 	while(curr>1){
// 		int a=spf[curr];
// 		int count=0;
// 		while(curr%a==0){ curr/=a; count++;}
// 		ans.push_back(make_pair(a,count));
// 	}
// 	return ans;
// }

// bool ispr(int n) {
// 	if(n==1) return false;
//     for (int i=2;i*i<=n;++i){
//         if(n%i==0){
//             return false;
//         }
//     }
//     return true;
// }
//---primes---

//---segment_tree---
// int upd(int t,int val,int l,int r,int y, int z){
// 	if(y<l||y>r) return tr[val];
// 	if(l==r) return tr[val]=z;
// 	int s=(l+r)/2;
// 	upd(t^1,2*val+1,l,s,y,z);
// 	upd(t^1,2*val+2,s+1,r,y,z);
// 	if(t) tr[val]=tr[2*val+1]|tr[2*val+2];
// 	else tr[val]=tr[2*val+1]^tr[2*val+2];
// 	return tr[val];
// }
//int query(){}
//---segment_tree---

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		double d;
		cin>>n>>d;
		vector<pair<ll,ll>> v;
		for(int i=0;i<n;i++){
			double x,y;
			cin>>x>>y;
			v.push_back({x,y});
		}
		int cnt=0;
		for(int i=0;i<n;i++){
			ll x=v[i].first,y=v[i].second;
			double dd=sqrt(x*x+y*y);
			//cout<<dd<<"\n";
			if(dd<=d) cnt++;
		}
		cout<<cnt<<"\n";
 	}
}

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

int main() {
	int n;
	scanf("%d", &n);
	n %= 10;
	if(n==3)
		printf("bon\n");
	else if(n==0 || n==1 || n==6 || n==8)
		printf("pon\n");
	else
		printf("hon\n");
	return 0;
}

Measured memory_bytes: 3760
module ABC132

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public  :: task_C

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_C

    ! variables for this <subroutine>
    integer(INT32) :: answer
    integer(INT32) :: len_sequence
    integer(INT32) :: max_sequence
    integer(INT32) :: min_sequence
    integer(INT32) :: num_questions_ABC
    integer(INT32) :: num_questions_ARC
    logical        :: stat

    ! arrays for this <subroutine>
    integer(INT32), dimension(:), allocatable :: val_sequence
    integer(INT32), dimension(:), allocatable :: num_value

    ! support variables for this <subroutine>
    integer(INT32) :: index

    ! STEP.01
    ! read out the given data
    read(unit=INPUT_UNIT, fmt=*) len_sequence
    allocate( val_sequence(1:len_sequence) )
    read(unit=INPUT_UNIT, fmt=*) val_sequence(1:len_sequence)

    ! STEP.02
    ! calculate the answer of this task
    max_sequence = maxval(val_sequence(:), dim=1)
    min_sequence = minval(val_sequence(:), dim=1)

    allocate( num_value(min_sequence:max_sequence) )

    num_value(:) = 0_INT32

    do index = 1, len_sequence, 1
      num_value( val_sequence(index) ) = num_value( val_sequence(index) ) + 1_INT32
    end do

    num_questions_ABC = 0_INT32
    num_questions_ARC = len_sequence
    answer            = 0_INT32
    stat              = .false.

    do index = min_sequence, max_sequence, 1
      if ( num_value(index) .eq. 0_INT32 ) then
        if (stat) answer = answer + 1_INT32
        continue
      else

        num_questions_ABC = num_questions_ABC + num_value(index)
        num_questions_ARC = num_questions_ARC - num_value(index)

        ! print *, index, num_questions_ABC, num_questions_ARC

        if ( num_questions_ABC .eq. num_questions_ARC ) then
          answer = answer + 1_INT32
          stat   = .true.
        else
          stat = .false.
          continue
        end if

      end if
    end do

    ! STEP.03
    ! deallocate the allocatable arrays
    deallocate( val_sequence )
    deallocate( num_value    )

    ! STEP.04
    ! output the answer of this task
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') answer

    ! STEP.END
    return

  end subroutine task_C

end module ABC132


program main

  ! <module>s to import
  use, non_intrinsic :: ABC132

  ! require all variables to be explicitly declared
  implicit none

  call task_C

end program main

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

int main(){
    double a,b,x ,rad;
    cin >> a >> b >> x;
    if(x > 0.5* a*a*b) rad = atan(a*a*a/(2*a*a*b-2*x));
    else rad = atan(2*x/(a*b*b));
    cout << std::fixed<<std::setprecision(10) << 90- rad/M_PI * 180;
 }



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int keirosu = sc.nextInt();
    int limit = sc.nextInt();
    int[] cost = new int[keirosu];
    int[] time = new int[keirosu];
    for (int i = 0; i < keirosu; i++) {
      cost[i] = sc.nextInt();
      time[i] = sc.nextInt();
    }
    int min = 1001;
    boolean tle = false;
    for (int i = 0; i < keirosu; i++) {
      if (time[i] <= limit && cost[i] < min) {
        min = cost[i];
        tle = true;
      }
    }
    System.out.println(tle ? min : "TLE");
  }

}


Measured memory_bytes: 21584
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long N;
	cin >> N;

	long long A[200000];
	for (long long i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	string s;
	//cin >> s;

	//int A[5]
	//sort(A, A + 5);

	long long count = 0;

	for (long long i = 0; i < N - 1; i++)
	{
		if (A[i] > A[i + 1])
		{
			count += A[i] - A[i + 1];
			A[i + 1] = A[i];
		}
	}

	if (true)
	{
		cout << count << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}

Measured memory_bytes: 5176
#!/usr/bin/env PyPy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    N=I()
    a=0
    NN=N
    for i in range(len(str(N))):
       a+=N%10
       N=N//10
       
    if  NN%a==0:
        print("Yes")
    else:
        print("No")
        


main()


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

using namespace std;

inline int ctoi(char c)
{
  if (c < '0' || '9' < c)
    throw invalid_argument("ctoi error");
  return c - '0';
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y)
{
  if (x <= 0 || y <= 0)
    throw invalid_argument("gcd error: x <= 0 or y <= 0");

  if (x < y)
    swap(x, y);
  T r = x % y;

  while (r != 0)
  {
    x = y;
    y = r;
    r = x % y;
  }

  return y;
}
template <typename T>
inline T lcm(T x, T y)
{
  if (x <= 0 || y <= 0)
    throw invalid_argument("lcm error: x <= 0 or y <= 0");

  return x * y / gcd(x, y);
}

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

  vector<int> input;
  vector<pair<long long int, long long int>> tree(n + 1);

  rep(i, n + 1)
  {
    int a;
    cin >> a;
    input.push_back(a);
  }

  tree[n] = make_pair(input[n], input[n]);

  for (int i = n - 1; 0 <= i; i--)
  {
    if (input[i] == 0)
    {
      tree[i] = make_pair((tree[i + 1].first + 1) / 2, tree[i + 1].second);
    }
    else
    {
      tree[i] = make_pair((tree[i + 1].first + 1) / 2 + input[i], tree[i + 1].second + input[i]);
    }
  }
  /*
	rep(i, n + 1){
		cout << i << " : " << tree[i].first << " , " << tree[i].second << endl;
	}
	*/

  if (1 < tree[0].first || tree[0].second < 1)
  {
    cout << -1;
    return 0;
  }

  if (tree[0].second != 1)
  {
    tree[0].second = 1;

    REP(i, 1, n)
    {
      long long int t = tree[i - 1].second - input[i - 1];

      if (t * 2 < tree[i].second)
      {
        tree[i].second = t * 2;
      }
    }
  }
  /*	cout << endl;
	rep(i, n + 1){
		cout << i << " : " << tree[i].first << " , " << tree[i].second << endl;
	}
	*/

  long long int ans = 0;
  rep(i, n + 1)
  {
    ans += tree[i].second;
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 5492
n,m = map(int,input().split())
acs = [0] * n 
was = [0] * n
for i in range(m):
    question , result = map(str,input().split())
    question_int= int(question) -1 
    if acs[question_int] == 0:
        if result == "AC":
            acs[question_int] = 1
        else:
            was[question_int] += 1

cnt_ac = sum(acs)
cnt_wa = 0

for i in range(n):
    if acs[i] == 1:
        cnt_wa += was[i]

print(cnt_ac,cnt_wa)

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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = input[0];
        var M = input[1];
        var K = input[2];

        if (N <= M)
        {
            if (N <= K && K <= M)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else
        {
            if (N >= K && K >= M)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }


    }
}

Measured memory_bytes: 13268
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

print(0 if A <= B*2 else A - B*2)

Measured memory_bytes: 60268
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

signed main(){
  ll N;
  cin >> N;
  vector<ll> A(N);
  deque<ll> B,C,D,E,F,G;
  FOR(i,0,N)cin >> A[i];
  sort(ALL(A));
  ll ans1=0,ans2=0,ans3=0,ans4=0,ans5=0,ans6=0;
  if(N%2){
    FOR(i,0,N){
      D.pb(A[i]);
      E.pb(A[N-i-1]);
      F.pb(A[i]);
      G.pb(A[N-i-1]);
      if(i+1 == N-i-2)break;
      D.pb(A[N-i-1]);
      E.pb(A[i]);
      F.pb(A[N-i-1]);
      G.pb(A[i]);
    }
    D.push_front(A[N/2-1]);
    D.pb(A[N/2]);
    E.push_front(A[N/2-1]);
    E.pb(A[N/2]);
    F.push_front(A[N/2+1]);
    F.pb(A[N/2]);
    G.push_front(A[N/2+1]);
    G.pb(A[N/2]);
    FOR(i,0,N-1){
      ans3 += abs(D[i]-D[i+1]);
      ans4 += abs(E[i]-E[i+1]);
      ans5 += abs(F[i]-F[i+1]);
      ans6 += abs(G[i]-G[i+1]);
    }
  }
  else{
    FOR(i,0,N/2-1){
      B.pb(A[i]);
      C.pb(A[N-i-1]);
      B.pb(A[N-i-1]);
      C.pb(A[i]);
    }
    B.push_front(A[N/2-1]);
    B.pb(A[N/2]);
    C.push_front(A[N/2-1]);
    C.pb(A[N/2]);
    FOR(i,0,N-1){
      ans1 += abs(B[i]-B[i+1]);
      ans2 += abs(C[i]-C[i+1]);
    }
  }
  cout << max({ans1,ans2,ans3,ans4,ans5,ans6}) << endl;
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
string s[55];
int n,m;
bool vis[4][55][55];
int dx[4]={0,-1,0,1},dy[4]={1,0,-1,0};
main()
{
	cin>>n>>m;
	int x,y,r;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		for(int j=0;j<m;j++)
		{
			if(s[i][j]=='^')
			{
				x=i,y=j,r=1;
			}
			else if(s[i][j]=='<')
			{
				x=i,y=j,r=2;
			}
			else if(s[i][j]=='v')
			{
				x=i,y=j,r=3;
			}
			else if(s[i][j]=='>')
			{
				x=i,y=j,r=0;
			}
		}
	}
	do{
		vis[r][x][y]=1;
		for(int dr=3;dr<7;dr++)
		{
			int nr=(r+dr)%4;
			int tx=x+dx[nr],ty=y+dy[nr];
			if(tx<0||ty<0||tx>=n||ty>=m||s[tx][ty]=='#')continue;
			r=nr;
			x=tx;
			y=ty;
			break;
		}
	}while(s[x][y]!='G'&&!vis[r][x][y]);
	if(s[x][y]!='G')
	{
		cout<<-1<<endl;
	}
	else
	{
		int cnt=0;
		for(int i=0;i<n;i++)for(int j=0;j<m;j++)
		{
			bool flag=0;
			for(int r=0;r<4;r++)flag|=vis[r][i][j];
			cnt+=flag;
		}
		cout<<cnt+1<<endl;
	}
}


Measured memory_bytes: 3224
L,R = map(int, input().split())
ans = 2018

s = list(map(int, range(L, min(L+2019, R+1))))
if 2019 in s:
    print(0)
    exit()

for i in s:
    for j in s[s.index(i)+1:]:
        ans = min(ans, i*j%2019)

print(ans)


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

Measured memory_bytes: 572
N = int(input())

A = 0
W = 0
T = 0
R = 0
for i in range(N):
    word = input()
    if ("AC" == word):
        A += 1
    elif ("WA" == word):
        W += 1
    elif ("TLE" == word):
        T += 1
    else:
        R += 1

print("AC x " + str(A))
print("WA x " + str(W))
print("TLE x " + str(T))
print("RE x " + str(R))

Measured memory_bytes: 9208
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int h, w, a, b; cin>>h>>w;
  cin>>a>>b;
  cout<<(h-a)*(w-b)<<endl;
	return 0;
}

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  ll power = 1;
  for (int i = 1; i <= n; ++i) {
    power *= i;
    // MODの性質/乗法においては途中でMODをとっても良い。
    power %= MOD;
  }
  p(power);
}

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

namespace ABC145B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Cin.Int();
            var S = Cin.String();
            var solver = new Solver(N, S);

            Console.WriteLine(solver.Solve());
        }
    }

    class Solver
    {
        private int N;
        private string S;
        public Solver(int n, String s)
        {
            N = n;
            S = s;
        }

        public IConvertible Solve()
        {
            if (N % 2 == 1)
            {
                return "No";
            }

            for (int i = 0; i < N / 2; i++)
            {
                if (S[i] != S[i + N / 2])
                {
                    return "No";
                }
            }
            return "Yes";
        }
    }

    internal static class Cin
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(String());
        }

        public static int[] IArr()
        {
            return Split().Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(String());
        }

        public static long[] LArr()
        {
            return Split().Select(long.Parse).ToArray();
        }

        public static double Double()
        {
            return double.Parse(String());
        }

        public static double[] DArr()
        {
            return Split().Select(double.Parse).ToArray();
        }

        private static IEnumerable<String> Split()
        {
            return String().Split(' ');
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

// 深さ優先探索
vector<bool> seen;
vector<vector<int>> G;
int a[2001][2001];
vector<int> ans(3000, 0);



void bfs(int top) {
    queue<int> q;
    q.push(top);
    seen[top]=true;

    while(!q.empty()){
	int v = q.front();
	q.pop();
	for(auto next_v: G[v]){
	    if(seen[next_v])
		continue;
	    q.push(next_v);
	    seen[next_v]=true;
	    a[top][next_v]=a[top][v]+1;
	    if(top<next_v)
		ans[a[top][next_v]]++;
	}

    }
}


int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    X--;
    Y--;

    G.resize(N);

    for(int i=0; i<N-1; i++){
        G[i].push_back(i+1);
	G[i+1].push_back(i);
    }
    G[X].push_back(Y);
    G[Y].push_back(X);
    for(int i=0; i<N; i++){
	for(int j=0; j<N; j++){
	    a[i][j]=0;
	}	
    }

    for(int i=0; i<N; i++){
	seen.assign(N, false); // 全頂点を「未訪問」に初期化
	bfs(i);
    }

    for(int i=1; i<N; i++){
	cout << ans[i] << endl;
    }

} 




Measured memory_bytes: 16000