akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct node { 
    int key;
    node *left, *right, *parent;
};
node *root, *NIL;

void insert(int k) {
    node *y = NIL;
    node *x = root;
    node *z;

    z = (node *)malloc(sizeof(node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while( x != NIL ) {
        y = x;
        if( z->key < x->key ) x = x->left;
        else x = x->right;
    }
    z->parent = y;
    if( y == NIL ) root = z;
    else {
        if( z->key < y->key ) y->left = z;
        else y ->right = z;
    }
}

node* find(node *x, int key) {
    while( x != NIL && key != x->key) {
        if( key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    return x;
}

void preParse(node* u) {
    if(u == NIL) return;
    printf(" %d", u->key);
    preParse(u->left);
    preParse(u->right);
}

void inParse(node* u) {
    if(u == NIL) return;
    inParse(u->left);
    printf(" %d", u->key);
    inParse(u->right);
}

signed main() {
    ll n; scanf("%lld", &n); 
    string com;
    for( ll i = 0; i < n; i++ ) {
        cin >> com;
        if( com.at(0) == 'i') {
            int x;
            scanf("%d", &x);
            insert(x);
        } else if( com.at(0) == 'f' ) {
            int x;
            scanf("%d", &x);
            node* t = find(root, x);
            if( t != NIL ) printf("yes\n");
            else printf("no\n");
        } else  {
            inParse(root);
            putchar('\n');
            preParse(root);
            putchar('\n');
        }
    }

    return 0;
}




Measured memory_bytes: 22000
#include<stdio.h>
#include<math.h>
int main()
{
  long i,j,k,n,a[100000];
  long long sum=0;
  scanf("%ld", &n);
  for (i=0; i<n; i++) scanf("%ld", &a[i]);
  for (i=0; i<n; i++)
    {
      if (i%2==1) sum -= a[i];
      //printf("%ld\n", a[k]);
       else sum += a[i]; 
    }
  printf("%lld ", sum);
  for (i=1; i<n; i++) 
    {
      //printf("%lld ", 2*a[i-1]-sum);
      sum = 2*a[i-1]-sum;
      printf("%lld ", sum);
    }
  //printf("%lld", 2*a[n-1]-a[0]);
  return 0;
}


Measured memory_bytes: 2048
h, w = map(int,input().split())
grid_t = [['.'] + [i for i in input()] + ['.'] for j in range(h)]

grid = []

grid.append(['.']*(w+2))
for row in grid_t:
	grid.append(row)
grid.append(['.']*(w+2))

ok = 1
for i in range(h+2):
    for j in range(w+2):
        if grid[i][j] == '#':
            if grid[i+1][j] != '#' and grid[i-1][j] != '#' and grid[i][j+1] != '#' and grid[i][j-1] != '#':
                ok = 0

print("Yes" if ok == 1 else "No")

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long

int inf = (1LL <<  62);

using namespace std;

signed main(){
    int n;
    cin >> n;
    vector<int> v(n);
    int l = 0;
    int r = 0;
    int start;
    int start2;
    if(n % 2 == 0){
        start = n / 2 - 1;
    }else{
        start = n / 2;
    }
    start2 = start + 1;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(i % 2 == 0){
            v[start - l] = x;
            l++;
        }else{
            v[start2 + r] = x;
            r++;
        }
    }
    if(n % 2 == 0){
        reverse(v.begin(), v.end());
        for(int i = 0; i < n; i++){
            if(i == n - 1){
                cout << v[i];
            }else{
                cout << v[i] << " ";
            }
        }
    }else{
        for(int i = 0; i < n; i++){
            if(i == n - 1){
                cout << v[i];
            }else{
                cout << v[i] << " ";
            }
        }
    }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
using ull=unsigned long long;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ull a;cin>>a;
    string s;cin>>s;
    ull b=0;
    rep(i,s.size()){
        if(s[i]=='.') continue;
        b=10*b+s[i]-'0';
    }
    ull ans=a*b/100;
    cout<<ans<<endl;
    return 0;
}


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

#define ff first
#define ss second
#define ll long long
#define pq priority_queue
#define mii map<int,int>

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef set<int> si;
typedef vector<vi> vii;
typedef vector<ii> vpi;
typedef vector<ll> vll;
int oo = (1e9) + 7;

int n;
ll w;
ll tb[105][100005];
vi peso(105), v(105);

ll dp(int i, int val) {
    if(i == n) return val > 0 ? oo : 0;
    if(tb[i][val] != -1) return tb[i][val];

    ll ans = dp(i+1, val);
    if(val-v[i] >= 0) ans = min(ans, dp(i+1, val-v[i])+peso[i]);

    tb[i][val] = ans;
    return ans;
}

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

    
    for(int i = 0; i < n; i++)
    {
        scanf("%d %d", &peso[i], &v[i]);
    }
    dp(0, 100000);
    memset(tb, -1, sizeof tb);
    ll maxi = -1;
    for(int i = 0; i < n; i++)
    {
        
        for(ll j = 0; j <= 100000; j++)
        {
            if(dp(i, j) <= w) maxi = max(maxi, j);
        }
    }
    cout << maxi;

    
    return 0;
}

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

int main(){
    string s;cin>>s;
    int i=0;
    int flag = 0;
    while(true){
        if(s[i] == 'C' && flag == 0){
            flag = 1;
        }else if(s[i] == 'F' && flag == 1){
            flag = 2;
            break;
        }else if(i >= s.size()){
            break;
        }
        i++;
    }
    if(flag == 2)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int ,int> P;
const int    INF = (int)1e9;
const int    MOD = (int)1e9+7;
const double EPS = (double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout << fixed << setprecision(20);
    };
};



signed main(){
  int a,b,h;cin>>a>>b>>h;
  int ans=(a+b)*h/2;

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int solve(int A, int B){
    for(int i=1;i<=20*B;i++){
        int a = int(0.08*i);
        int b = int(0.1*i);
        if(a == A && b == B) return i;
    }
    return -1;
}

int main(){
    int A, B;
    while(cin >> A >> B){
        cout << solve(A, B) << endl;
    }
}

Measured memory_bytes: 256
fun main(arr: Array<String>) {
    val s = readLine()!!
    val k = readLine()!!.toInt()
    var list = mutableSetOf<String>()
    for(i in s.indices) {
        for(j in (i+1..Math.min(i+5, s.length))) {
            list.add(s.substring(i,j))
        }
    }
    list = list.sorted().toMutableSet()
    println(list.sorted()[k-1])
}


Measured memory_bytes: 43748
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
   string s,s1;
   cin >> s >> s1;
   int x, y;
   cin >> x >> y;
   string u;
   cin >> u;
   if(u == s)
    x--;
    else
    y--;
    
    cout << x << " " << y << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                  \
  ifstream in("atcoder-problems/sumitb2019_d.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int N;
string S;
int M = 3;
vector<int> buf(M, 0);
int ans = 0;

void dfs(const int i, const int range_s, const int range_e) {
  if (i == M) {
    int j = 0;
    rep(i, N) {
      if (S[i] - '0' == buf[j]) {
        j++;
      }
    }
    if (j >= M) {
      // print_vec(buf);
      ans++;
    }
    return;
  }
  repi(j, range_s, range_e + 1) {
    buf[i] = j;
    dfs(i + 1, range_s, range_e);
  }
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  cin >> N >> S;

  dfs(0, 0, 9);
  cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n)cin >> a.at(i);
  vector<ll> l(n),r(n);
  l.at(0) = a.at(0);
  r.at(n-1) = a.at(n-1);
  for(int i = 1; i <= n-1; i++){
    l.at(i) = gcd(l.at(i-1),a.at(i));
    r.at(n-i-1) = gcd(r.at(n-i),a.at(n-i-1));
  }
  
  // rep1(i,n-1)cout<<a.at(i)<<"is eliminated. i is "<<i<<" "<<gcdf.at(i)<<" "<<gcdr.at(n-1-i)<<endl;
  
  ll res = max(l.at(n-2),r.at(1));
  //cout<<res<<endl;
  for(int i = 0; i < n-2; i++){
    res = max(res,gcd(l.at(i),r.at(i+2)));
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pii             pair<int , int >
#define in(a)           scanf("%d", &a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define piil            pair<ll , ll >
#define inl(a)          scanf("%lld", &a)
#define inl2(a, b)      scanf("%lld%lld", &a, &b)
#define inl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define ins(s)          scanf("%s",s)
#define prst(s)         printf("%s\n",s)
#define pn              printf("\n")
#define pr(a)           printf("%d\n", a)
#define prl(a)          printf("%lld\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)         printf("%lld ", a)
#define prl2(a, b)      printf("%lld %lld\n", a, b)
#define prl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define pcs(a)          printf("Case %d: ", a)
#define pf              printf
#define sc              scanf
#define m_p             make_pair
#define vi              vector<int >
#define vil             vector<ll >
#define pb              push_back
#define fi              first
#define sc              second
#define mem(a, b)       memset((a), (b), sizeof(a))
#define lg2(n)         (31-__builtin_clz(n))
#define PI		        acos(-1.0)
#define N 2000010
#define unq(v)       v.erase(unique(all(v)),v.end())
#define inf 2e18
#define ll long long
#define ull unsigned long long
#define fbo find_by_order
#define ook order_of_key
#define fi first
#define sc second
#define __  std::ios_base::sync_with_stdio (false); cin.tie(0); cout.tie(0);
#define Check(n, pos) (n & (1<<pos))
#define Set(n, pos) (n | (1<<pos))
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename F, typename S>
using ordered_map = tree<F, S, less<F>, rb_tree_tag, tree_order_statistics_node_update>;
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//______________________________________________________________________________________________________________________________________________________
ll dp[N],arr[N];
char str[N];
int main()
{
    __;
   ll n,m,k,a,b,t;
   ll sum=0;
   string s;
  cin>>n>>k;
  if(n*500*1LL>=k)
  {
      cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;


    return 0;
}



Measured memory_bytes: 256
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
    const int MAX =200005;
const int MOD =1000000007;

signed main(){
 int n;
 cin>>n;
 int x,y,p[n],q[n];
 for(int i=0;i<n;i++){
   cin>>x>>y;
   p[i]=x+y;
   q[i]=x-y;
 }
 for(int i=1;i<n;i++)if(abs(p[i])%2!=abs(p[0])%2){
   cout<<-1<<endl;
   return 0;
 }
 if(p[0]%2==0){
   cout<<32<<endl;
   for(int i=30;i>=0;i--)cout<<(1ll<<i)<<' ';
   cout<<1<<endl;
   for(int j=0;j<n;j++){
   for(int i=30;i>=0;i--){
     if(p[j]>=0){
       p[j]-=(1ll<<i);
       if(q[j]>=0){
         cout<<'R';
         q[j]-=(1ll<<i);
       }else{
         cout<<'U';
         q[j]+=(1ll<<i);
       }
     }else{
       p[j]+=(1ll<<i);
       if(q[j]>=0){
         cout<<'D';
         q[j]-=(1ll<<i);
       }else{
         cout<<'L';
         q[j]+=(1ll<<i);
       }
     }
    
   }
    if(p[j]>=0){
       p[j]-=(1ll<<0);
       if(q[j]>=0){
         cout<<'R';
         q[j]-=(1ll<<0);
       }else{
         cout<<'U';
         q[j]+=(1ll<<0);
       }
     }else{
       p[j]+=(1ll<<0);
       if(q[j]>=0){
         cout<<'D';
         q[j]-=(1ll<<0);
       }else{
         cout<<'L';
         q[j]+=(1ll<<0);
       }
     }
     cout<<endl;
   }

 }else{
   cout<<31<<endl;
   for(int i=30;i>=0;i--)cout<<(1ll<<i)<<' ';
  cout<<endl;
   for(int j=0;j<n;j++){
   for(int i=30;i>=0;i--){
     if(p[j]>=0){
       p[j]-=(1ll<<i);
       if(q[j]>=0){
         cout<<'R';
         q[j]-=(1ll<<i);
       }else{
         cout<<'U';
         q[j]+=(1ll<<i);
       }
     }else{
       p[j]+=(1ll<<i);
       if(q[j]>=0){
         cout<<'D';
         q[j]-=(1ll<<i);
       }else{
         cout<<'L';
         q[j]+=(1ll<<i);
       }
     }
    
   }
  cout<<endl;
   }
 }
}

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

using namespace std;
int main()
{
    // 文字列の入力
    int N;
	cin >> N;
	
	if(N >= 30) {
		printf("Yes\n");
	}else {
		printf("No\n");
	}
		
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;

int main(){

  int a,b;
  cin>>a>>b;
  int x;
  int i;

  if(b==100)x=a*1000+b;
  else if(b/10==0)x=a*10+b;
  else x=a*100+b;

  for(i=0;i<1001;i++){
    if(x==i*i){
      //cout<<i<<" ";
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
    int x,i,j,t;
    x = A[r];
    i = p-1;
    for(j = p; j < r; j++){
        if(A[j] <= x){
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    t = A[i+1];
    A[i+1] = A[r];
    A[r] = t;
    return i+1;
}

int main(){
    int i,q;

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

    q = partition(0,n-1);

    for(i = 0; i < n; i++){
        if(i) printf(" ");
        if(i == q) printf("[");
        printf("%d",A[i]);
        if(i == q) printf("]");
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 2124
#include <iostream>
#include <queue>
#include <map>
#include <utility>
#include <cstring>

#define BLACK 1
#define RED 0

using namespace std;

int main() {
  while(true) {
    int h, w, ans = 0;
    cin >> w >> h;
    if(w == 0) break;
    map<pair<int, int>, bool> visits;
    map<pair<int, int>, int> table;
    queue<pair<int, int> > q;
    char t;
    pair<int, int> now;
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
	cin >> t;
	pair<int, int> index = make_pair(i, j);
	if(t == '.') {
	  visits[index] = false;
	  table[index] = BLACK;
	}
	else if(t == '#') {
	  visits[index] = false;
	  table[index] = RED;
	}
	else {
	  visits[index] = true;
	  table[index] = BLACK;
	  now = index;
	}
      }
    }
    q.push(now);
    ans++;
    while(!q.empty()){
      now = q.front();
      q.pop();
      pair<int, int> s = now;
      if(s.first > 0) {
	s.first--;
	if(table[s] == BLACK && visits[s] == false) {
	  ans++;
	  q.push(s);
	  visits[s] = true;
	}
	s = now;
      }
      if(s.first < h-1) {
	s.first++;
	if(table[s] == BLACK && visits[s] == false) {
	  ans++;
	  q.push(s);
	  visits[s] = true;
	}
	s = now;
      }
      if(s.second > 0) {
	s.second--;
	if(table[s] == BLACK && visits[s] == false) {
	  ans++;
	  q.push(s);
	  visits[s] = true;
	}
	s = now;
      }
      if(s.second < w-1) {
	s.second++;
	if(table[s] == BLACK && visits[s] == false) {
	  ans++;
	  q.push(s);
	  visits[s] = true;
	}
	s = now;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
  

Measured memory_bytes: 3204
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long H = scan.nextLong();
        long W = scan.nextLong();
        if (H % 3 == 0 || W % 3 == 0) {
            System.out.println(0);
            return;
        }
        long answer = divide3(H,W);
        answer = Math.min(answer,divide3(W,H));
        answer = Math.min(answer,divide_mix(H,W));
        answer = Math.min(answer,divide_mix(W,H));
        System.out.println(answer);
    }
    public static long divide3(long H, long W) {
        if (H < 3) {
            return Long.MAX_VALUE;
        }
        if (H % 3 == 0) {
            return 0;
        }
        return W;
    }
    public static long divide_mix(long H, long W) {
        long answer = Long.MAX_VALUE;
        for (long i = 1; i < H; i++) {
            long s1 = i * W;
            long w = (long)Math.floor(W / 2);
            long s2 = (H - i) * w;
            long s3 = (H - i) * (W - w);
            long s_max = Math.max(s1, Math.max(s2, s3));
            long s_min = Math.min(s1, Math.min(s2, s3));
            answer = Math.min(answer, s_max - s_min);
        }
        return answer;
    }
}


Measured memory_bytes: 21956
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	for(int i=0;i<s.length();i++)
		if(s[i]>='a'&&s[i]<='z')s[i]=(char)(s[i]-'a'+'A');
		else if(s[i]>='A'&&s[i]<='Z')s[i]=(char)(s[i]-'A'+'a');
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3132
#ifndef DEBUG
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;

#ifdef DEBUG
#define IO
#else
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define Ft first
#define Sd second
#define All(v) v.begin(),v.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
// template<typename T> using rkt = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main() {
    IO;

    string s;
    cin >> s;
    sort(All(s));
    cout << ((unique(All(s))-s.begin())==2 ? "Yes" : "No") << endl;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3fLL
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
vector<int>v[100005];
int color[100005];
bool vis[100005];
bool gg = 0;
void judge(int now){
    if (gg || vis[now]) return;
    vis[now] = 1;
    for (int i = 0; i < v[now].size(); i++){
        if (color[v[now][i]] == color[now]) {gg = 1; return;}
        color[v[now][i]] = 3 - color[now];
        judge(v[now][i]);
    }
}
int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++){
        int a, b; scanf("%d%d", &a, &b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    color[1] = 1;
    judge(1);
    if (gg){
        cout << 1LL * n * (n - 1) / 2 - m << endl;
    }
    else{
        ll cnt1 = 0, cnt2 = 0;
        for (int i = 1; i <= n; i++){
            if (color[i] == 1) cnt1++;
            else cnt2++;
        }
        cout << cnt1 * cnt2 - m << endl;
    }
    return 0;
}
//11 20
//10 16
// 9 12
// 8 9
// 7 6
// 6 4


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

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

  vector<long long> luka_number = {2, 1};  
  for (int i = 0; i < N; i++) {
    luka_number.push_back(luka_number.at(i+1)+luka_number.at(i));
  }

  cout << luka_number.at(N) << endl;
  
}

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

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input;
        try {
            while((input = reader.readLine()) != null) {
                int n = Integer.parseInt(input);
                int count = 0;
                for(int a=0; a<10; a++){
                    for(int b=0; b<10; b++){
                        for(int c=0; c<10; c++){
                            for(int d=0; d<10; d++){
                                if(n == a+b+c+d){
                                    count++;
                                }
                            }
                        }
                    }
                }
                System.out.println(count);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 18656
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#define inf pow(10, 9)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int N, M;

int dfs(int x, ve<bool> &B, ve<ve<bool>> &A){
  bool f = 1;
  rep(i, N){
    if(B.at(i) != 1){
      f = 0;
    }
  }
  if(f){
    rt 1;
  }
  int a = 0;
  rep(i, N){
    if(A.at(x).at(i) == 0){
      con;
    }
    if(B.at(i)){
      con;
    }
    B.at(i) = 1;
    a += dfs(i, B, A);
    B.at(i) = 0;
  }
  rt a;
}

int main() {
  ci(N, M);
  ve<ve<bool>> A(N, ve<bool>(N, 0));
  rep(i, M){
    int a, b;
    ci(a, b);
    a--, b--;
    A.at(a).at(b) = 1;
    A.at(b).at(a) = 1;
  }
  ve<bool> B(N, 0);
  B.at(0) = 1;
  co(dfs(0, B, A));
  rt 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
 
#define REP(i, n) for(LL i = 0; i < (LL)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const LL IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 2019;
 
LL power(LL x, LL y) {
    if (y == 1) return x;
    else if (y % 2 == 0) return power((x*x)%MOD, y/2);
    else return (x * power((x*x)%MOD, y/2)) % MOD; 
}
 
int main() {
    string s;
    cin >> s;
    reverse(ALL(s));
    LL N;
    N = s.size();
    vector<LL> v(N, 0);
    vector<LL> c(MOD, 0);
    v[0] = s[0] - '0';
    c[v[0]] += 1;
    FOR(i, 1, N) {
        LL p = s[i] - '0';
        v[i] = power(10, i)*p + v[i - 1];
        v[i] %= MOD;
        c[v[i]]++;
    }
    LL res = 0;
    res += c[0];
    REP(i, MOD) {
        res += c[i]*(c[i] - 1)/2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5172
import math
import itertools
import statistics
import collections

n = int(input())
a = list(map(int, input().split()))

l = collections.Counter(a)
#print(l)

total = 0
for i in l.values():
    total += (i*(i-1)//2)

#print(total)
s = ""
for i in range(n):
    s = l[a[i]]
    ans = total-s+1
    print(ans)

Measured memory_bytes: 27164
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
int flag = 0;
using ll = long long;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);

}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int main() {
	double a, b, C;
	std::cin >> a >> b >> C;
	double pi = 2.0 * asin(1.0);            /* πの値 */
	double unit = pi / 180.0;                 /* 度 → ラジアン */
	double unit_r = 180.0 / pi;                 /* ラジアン → 度 */
	double deg_r = C * unit;
	double c = sqrt(a*a + b*b - 2 * a*b*cos(deg_r));
	double S = a*b* sin(deg_r) / 2;
	double L = a + b + c;
	double h = S / a * 2;
	std::cout << std::setprecision(10) << S << ' ' << L << ' ' << h << std::endl;
	return 0;
}


Measured memory_bytes: 3628
n = int(input())
costs = list(map(int, input().split()))

if n == 2:
    print(abs(costs[-1] - costs[-2]))
else:
    best = [float("inf") for i in range(n)]
    best[n - 1] = 0
    best[n - 2] =  abs(costs[n - 2] - costs[n - 1])

    for i in range(n - 3, -1, -1):
        best[i] = min(abs(costs[i] - costs[i + 1]) + best[i + 1], abs(costs[i] - costs[i + 2]) + best[i + 2]) 

    print(best[0])



Measured memory_bytes: 20544
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	sc.Split(bufio.ScanWords)

	count := 0
	for i := 0; i < n; i++ {
		t := nextInt()

		if t >= k {
			count++
		}
	}
	fmt.Println(count)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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


def main():
    N = int(input()) # 5
    A = list(map(int, input().split())) # 12 15 18 24 12

    index = list(range(N))
    L = index.copy()
    # L(0) = 0
    L[0] = 0
    for i in index[:-1]:
        L[i+1] = gcd(L[i], A[i])

    R = index.copy()
    # R(N + 1) = 0
    R.append(0)
    for i in reversed(index):
        R[i] = gcd(R[i+1], A[i])
    
    # print(L) [0, 12, 3, 3, 3]
    # print(R) [3, 3, 6, 12, 12, 0]
    
    # Mi = gcd(L(i), R(i+1))
    M = [gcd(f, b) for f, b in zip(L, R[1:])] # Rはi+1になるように1つずらしている
    # print(M) [3, 6, 3, 3, 3]
    
    print(max(M))


if __name__ == "__main__":
    main()

Measured memory_bytes: 14436
while 1:
    try:
        x1, y1, x2, y2, x3, y3, px, py = map(float, input().split())
        a = (x2-x1) * (py-y1) - (y2-y1) * (px-x1)
        b = (x3-x2) * (py-y2) - (y3-y2) * (px-x2)
        c = (x1-x3) * (py-y3) - (y1-y3) * (px-x3)
        if (a < 0 and b < 0 and c < 0) or (a > 0 and b > 0 and c > 0):
            print("YES")
        else:
            print("NO")
    except:
        break;
        

Measured memory_bytes: 7400
n,m = map(int, input().split())
if n%2:
    a=1
    b=n
    for i in range(m):
        print(a,b)
        a+=1
        b-=1
else:
    a=1
    b=n
    m2=(m+1)//2
    for i in range(m2):
        print(a,b)
        a+=1
        b-=1
    m3=m-m2
    a=1+m2
    b=n-m2-1
    for i in range(m3):
        print(a,b)
        a+=1
        b-=1

    

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

int main()
{
    /* ------- 宣言と入力 ------- */

    int N;

    cin >> N;

    int A[N];

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

    /* ------- 計算 ------- */

    string ans = "APPROVED";

    for (int i = 0; i < N; i++)
    {
        if (A[i] % 2 == 0)
        {
            if (!(A[i] % 3 == 0 || A[i] % 5 == 0))
            {
                ans = "DENIED";
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int K = sc.nextInt();
            String S = sc.next();
            System.out.println(S.length() <= K ? S : (S.substring(0, K) + "..."));
        }
    }
}


Measured memory_bytes: 27092
N = int(input())
S = input()
color = [[0 for _ in range(3)] for _ in range(N+1)]
for i, c in enumerate(S):
    for j in range(3):
        color[i+1][j] = color[i][j]
    if c == "R":
        color[i+1][0] += 1
    elif c == "G":
        color[i+1][1] += 1
    elif c == "B":
        color[i+1][2] += 1

rn = color[N][0]
gn = color[N][1]
bn = color[N][2]

ans = 0
for i, c in enumerate(S):
    if i == 0 or i == N-1:
        continue
    j = 1
    while i-j >=0 and i+j <=N-1:
        if S[i-j] != S[i] and S[i] != S[i+j] and S[i-j] != S[i+j]:
            ans -= 1
        j += 1
    if c == "R":
        ans += color[i][1] * (bn - color[i+1][2])
        ans += color[i][2] * (gn - color[i+1][1])
    elif c == "G":
        ans += color[i][0] * (bn - color[i+1][2])
        ans += color[i][2] * (rn - color[i+1][0])
    elif c == "B":
        ans += color[i][0] * (gn - color[i+1][1])
        ans += color[i][1] * (rn - color[i+1][0])
print(ans)


Measured memory_bytes: 9524
#include<iostream>
#include<string.h>
using namespace std;
int main() {
    int n, j;
    cin >> n;
    for (int i=1; i <= n; i++) {
        j = i;
        if (i%3==0) {
            cout << " " << i;
        } else {
            while (1) {
                if (j==0) break;
                if(j % 10 == 3) {
                    cout << " " << i;
                    break;
                }
            j = j / 10;
        }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3080
n,m = map(int,input().split())
s = list(input())
s.reverse()

ans = []

i = 0
j = m
while i+j>i:
    if i+j >= n:
        ans.append(n-i)
        i = n
        break
    elif i == n:
        break
    elif s[i+j] == '1':
        j -= 1
    else:
        ans.append(j)
        i += j
        j = m

if i != n:
    print(-1)
else:
    ans.reverse()
    print(*ans)




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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i < n - 2; i++) {
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 1e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

vector<int> adj[N];
ll dp[N];
int n, m;

ll mul(ll a, ll b) {
  return (a * b) % MOD;
}

ll add(ll a, ll b) {
  a += b;
  while(a >= MOD)
    a -= MOD;
  while(a < 0)
    a += MOD;
  return a;
}

void dfs(int node, int par, int depth, int rem) {
  int cnt = 0;
  for(int it: adj[node]) {
    if(it == par) continue;
    if(depth >= 1) {
      dfs(it, node, depth + 1, m - 2 - cnt);
    } else
      dfs(it, node, depth + 1, rem - cnt - 1);
    ++cnt;
  }
  ll ret = rem;
  for(int it: adj[node]) {
    if(it == par) continue;
    ret = mul(ret, dp[it]);
  }
  dp[node] = ret;
}

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int u, v;
  cin >> n >> m;
  for (int i = 1; i < n; ++i) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, -1, 0, m);
  cout << dp[1];
  return 0;
}


Measured memory_bytes: 13568
# def main():
#     n, m = map(int, input().split())
#     ans = [0] * n
#     count = [0] * n
#     for i in range(m):
#         s, c = map(int, input().split())
#         if s == 1 and c == 0 and n != 1:
#             print(-1)
#             exit()
#         if count[s - 1] == 0 or ans[s - 1] == c:
#             ans[s - 1] = c
#             count[s - 1] += 1
#         else:
#             print(-1)
#             exit()
#     if ans[0] == 0 and n != 1:
#         ans[0] = 1
#     print(''.join(map(str, ans)))


# if __name__ == '__main__':
#     main()

def main():
    n, m = map(int, input().split())
    C = [-1] * n
    flag = 0
    for i in range(m):
        s, c = map(int, input().split())
        if C[s - 1] == -1 or C[s - 1] == c:
            C[s - 1] = c
        else:
            flag = 1

    if flag or (C[0] == 0 and n != 1):
        print(-1)
        return

    else:
        C = [0 if i == -1 else i for i in C]
        if C[0] == 0 and n != 1:
            C[0] = 1
    print(''.join(list(map(str, C))))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9216
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass #sortされていない


def main():
    S = int(input())
    X1, Y1 = 0, 0
    Y2 = 1
    X2 = 10 ** 9
    Y3 = S // X2 if S % X2 == 0 else S // X2 + 1
    X3 = (10 ** 9) * Y3 - S


    print(X1,Y1,X2,Y2,X3,Y3)




if __name__ == "__main__":
    main()

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

typedef long long ll;
const int maxn=1e5+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

vector<int> G[maxn];

int p[maxn],siz[maxn];
int ans[maxn];

int Find (int x)
{
    return p[x]==x ? x : p[x]=Find(p[x]);
}

void Union(int x,int y)
{
    x=Find(x),y=Find(y);
    if (x==y) return;
    if (siz[x]<siz[y])
    {
        siz[y]+=siz[x];
        p[x]=y;
    }
    else
    {
        siz[x]+=siz[y];
        p[y]=x;
    }
}

int32_t main()
{
    IOS
    int n,m,k;
    cin>>n>>m>>k;
    for (int i=1;i<=n;i++) p[i]=i,siz[i]=1;

    for (int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        Union(x,y);
        G[x].pb(y);
        G[y].pb(x);
    }
    for (int i=1;i<=k;i++)
    {
        int x,y;
        cin>>x>>y;
        G[x].pb(y);
        G[y].pb(x);
    }
    for (int i=1;i<=n;i++)
    {
        ans[i]=siz[Find(i)]-1;
        for (int j:G[i])
            if (Find(j)==Find(i)) ans[i]--;
    }
    for (int i=1;i<=n;i++) cout<<ans[i]<<" \n"[i==n];
}



Measured memory_bytes: 8704
#include <stdio.h>
int main(void){
	int a[4],b[4],min,i;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	
	b[0] = a[0] + a[1];
	b[1] = a[1] + a[2];
	b[2] = a[2] + a[0];
	
	min = b[0];
	
	for(i=0;i<3;i++){
		if(b[i] <= min) min = b[i];
	}
	printf("%d\n",min);
}
	

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(long long A, long long B, long long C, long long X, long long Y){
    long long ret = 0;
    long long minxy = min(X, Y);
    ret += min(A+B, 2*C) * minxy;
    if (X > Y) {
        ret += (X - minxy) * min(A, 2*C);
    } else {
        ret += (Y - minxy) * min(B, 2*C);
    }
    std::cout <<  ret << std::endl;
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long A;
    long long B;
    long long C;
    long long X;
    long long Y;
    scanf("%lld",&A);
    scanf("%lld",&B);
    scanf("%lld",&C);
    scanf("%lld",&X);
    scanf("%lld",&Y);
    solve(A, B, C, X, Y);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 888
use std::cmp::max;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn main() {
    input! {
    a: usize,
    b: usize,
    }
    let ans = max(a + (a - 1), max(a + b, b + (b - 1)));
    println!("{}", ans);
}


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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long ll;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a == b){
    printf("%d\n", c);
  }
  else if(a == c){
    printf("%d\n", b);
  }
  else{
    printf("%d\n", a);    
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll a,b;
    cin >> a >> b;
    ll i;
    string s;
    cin >>s;
    for(i=0;i<a;i++){
      if(s[i]<47 |s[i]>57){
        cout << "No";
        return 0;
      }
    }
    if(s[a]!='-'){
      cout << "No";
      return 0;
    }
    for(i=a+1;i<a+b+1;i++){
      if(s[i]<47 |s[i]>57){
        cout << "No";
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define ll long long

using namespace std;

int n;
int m;

int s1[105]={};
int s2[105]={};


int main(){
    while(1){
        int sum1=0;
        int sum2=0;
        scanf("%d %d",&n,&m);
        if(n == 0 && m == 0) break;
        for(int i=0;i<n;i++){
            scanf("%d",&s1[i]);
            sum1 += s1[i];
        }
        for(int i=0;i<m;i++){
            scanf("%d",&s2[i]);
            sum2 += s2[i];
        }
        int d = sum2-sum1;
        if(abs(d%2) == 1){
            cout << "-1" << endl;
        }else{
            sort(s1,s1+n);
            sort(s2,s2+m);

            int judge = 0;
            int a,b;

            for(int i=0;i<n;i++){
                a = s1[i];
                b = a + d/2;
                if(b < 0 || 100 < b) continue;
                for(int j=0;j<m;j++){
                    if(b == s2[j]){
                        judge = 1;
                        break;
                    }
                    if(b < s2[j]) break;
                }
                if(judge) break;
            }
            if(judge) cout << a << " " << b << endl;
            else cout << "-1" << endl;
        }
        
    }
}


Measured memory_bytes: 3208
def show_lost_card(cards,mark):
    i = 1
    for num in range(13):
        if i in cards:
            i += 1
        else:
            print(mark,i)
            i += 1
    
N = int(input())
S = []
H = []
C = []
D = []

for n in range(N):
    card = input().split()
    if card[0] == 'S':
        S.append(int(card[1]))
    elif card[0] == 'H':
        H.append(int(card[1]))
    elif card[0] == 'C':
        C.append(int(card[1]))
    else:
        D.append(int(card[1]))

show_lost_card(S,'S')
show_lost_card(H,'H')
show_lost_card(C,'C')
show_lost_card(D,'D')




Measured memory_bytes: 5612
import java.io.*;
import java.util.*;
/**
 * Main
 */
public class Main {
        static Stack<Integer> subset = new Stack<>();
        static String input = "";
        static int stop = 0;
        static int mod  = 1000000007;
        static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        static HashMap<Integer,Integer> map = new HashMap<>();
        static ArrayList<String> list = new ArrayList<>();
        
       
    public static void main(String[] args) {
       MyScanner ms  = new MyScanner();
       int N = ms.nextInt();
    
       N%=10;
       pw.println(N==3?"bon":(N==0||N==1||N==6||N==8)?"pon":"hon");
        pw.flush();
    }


   

    static class IP {
        int r,c;
        IP(int r, int c){
            this.r =r ;
            this.c =c ;
        }
    }

    /**
     * 1.What is the unknown: the maxium number of nodes he can buy 2.What are the
     * data: the size of the array and element int he array 3.What is the condition:
     * the longest increasing usbsequece 4.What is the restriction: the 100,000 *100
     * = 100,000,000 = thus made N^2 for 3 second
     */

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
    
}

Measured memory_bytes: 32660
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
#define N 1000012
int n,Z,a[N],s[N];char sc[N];
inline int calc(int m)
{
	int i,sum=0,mi=0;
	for(i=1;i<=n;i++){if(sc[i]=='?'){if(max(sum+1,sum+1+s[i+1])<=m)++sum;else --sum;}else sum+=a[i];mi=min(mi,sum);}return mi;
}
int main(){
	scanf("%s",sc+1);n=strlen(sc+1);Z=0;int i,sum=0;
	for(i=1;i<=n;i++){a[i]=(sc[i]=='1')?1:(-1);sum+=a[i];Z=max(Z,sum);}
	s[n+1]=0;for(i=n;i>=1;i--)s[i]=max(s[i+1]+a[i],a[i]);printf("%d",min(Z-calc(Z),Z+1-calc(Z+1)));return 0;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int a,b;
    cin >> a >> b;
    cout << max(0,(a-2*b));
    return 0;
}


Measured memory_bytes: 256