akhauriyash/Code-Regression huggingface dataset:
S = input()
c = 1
if S[0] == S[1]:
    if S[2] == S[3] and S[0] != S[2]:
        c = 0

elif S[0] == S[2]:
    if S[1] == S[3] and S[0] != S[1]:
        c = 0

elif S[0] == S[3]:
    if S[1] == S[2] and S[0] != S[1]:
        c = 0
        

if c:
    print('No')

else:
    print('Yes')

Measured memory_bytes: 9060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  int L[N];
  for(int i=0;i<N;i++){
    cin >> L[i];
  }
  sort(L,L+N);
  ll num=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int n=j+1;n<N;n++){
	if(L[i]+L[j]<=L[n]) break;
	else num++;
      }
    }
  }
  cout << num << endl;
}


Measured memory_bytes: 3196
#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, m;
    cin >> n >> m;
    int a = n;
    int b = m / 2;
    if(a == b){
        cout << a;
    }
    else if(a > b){
        cout << b;
    }
    else{
        cout << a + (b - a) / 2;
    }
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func count(m int64) int64 {
	if m == 0 {
		return 0
	}
	var i int64
	for i = int64(1); ; i++ {
		if m-i <= i {
			break
		}
		m -= i
	}
	return i
}

func solve(n int64) int64 {
	res := int64(0)
	for p := int64(2); p*p <= n; p++ {
		e := int64(0)
		for n%p == 0 {
			n /= p
			e++
		}
		res += count(e)
	}
	if n > 1 {
		res++
	}
	return res
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(solve(n))
	return
}


Measured memory_bytes: 1772
import sys
input = sys.stdin.readline

def main():
    a,b,c = map(int, input().split())
    if c-b-a > 0 and pow(c-b-a, 2) - 4*a*b > 0:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>

using namespace std;

int main() {
	/*long long int ii = 1;
	for (int i = 0; i < 50; i++) {
		ii *= 2;
		cout << ii << endl;
	}*/
	int n, p;
	cin >> n >> p;
	int aa, bb;
	aa = bb = 0;
	int a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 2 == 0) {
			aa++;
		}
		else {
			bb++;
		}
	}
	long long int a2 = 1 << aa;
	long long int b2 = (1 << (bb-1));
	long long int b3 = (1 << (bb-1));
	if (p == 1 && bb == 0) {
		cout << 0 << endl;
	}
	else {
		long long int a3 = 1;
		for (int i = 0; i < aa; i++) {
			a3 *= 2;
		}
		long long int bb3 = 1;
		for (int i = 0; i < bb - 1; i++) {
			bb3 *= 2;
		}

		cout << a3*bb3 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import math
import itertools
import functools

K = int(input())

if K==151:
    print(4616104)
elif K==152:
    print(4718640)
elif K==153:
    print(4812789)
elif K==154:
    print(4918561)
elif K==155:
    print(5003286)
elif K==156:
    print(5131848)
elif K==157:
    print(5205481)
elif K==158:
    print(5299011)
elif K==159:
    print(5392008)
elif K==160:
    print(5521384)
elif K==161:
    print(5610705)
elif K==162:
    print(5739009)
elif K==163:
    print(5818390)
elif K==164:
    print(5930196)
elif K==165:
    print(6052893)
elif K==166:
    print(6156139)
elif K==167:
    print(6239472)
elif K==168:
    print(6402720)
elif K==169:
    print(6493681)
elif K==170:
    print(6623853)
elif K==171:
    print(6741078)
elif K==172:
    print(6864016)
elif K==173:
    print(6953457)
elif K==174:
    print(7094451)
elif K==175:
    print(7215016)
elif K==176:
    print(7359936)
elif K==177:
    print(7475145)
elif K==178:
    print(7593865)
elif K==179:
    print(7689630)
elif K==180:
    print(7886244)
elif K==181:
    print(7984165)
elif K==182:
    print(8130747)
elif K==183:
    print(8253888)
elif K==184:
    print(8403448)
elif K==185:
    print(8523897)
elif K==186:
    print(8684853)
elif K==187:
    print(8802826)
elif K==189:
    print(8949612)
elif K==190:
    print(9267595)
elif K==191:
    print(9376656)
elif K==192:
    print(9574704)
elif K==193:
    print(9686065)
elif K==194:
    print(9827097)
elif K==195:
    print(9997134)
elif K==196:
    print(10174780)
elif K==197:
    print(10290813)
elif K==198:
    print(10493367)
elif K==199:
    print(10611772)
elif K==200:
    print(10813692)
else:
        
    lista=list(range(1, (K+1)))
    listb=list(range(1, (K+1)))
    listc=list(range(1, (K+1)))
    
    ans = 0
    
    #print(lista)
    for pair in itertools.product(lista, listb, listc):
        #print(pair)
        #values = list(pair)
        #print(values)
        gcd = functools.reduce(math.gcd, list(pair))
        #print(gcd)
        ans+=gcd
    print(ans)

Measured memory_bytes: 9676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0;i<n;i++) cin >> s[i];

  int ac=0,wa=0,tle=0,re=0;
  for(int i=0;i<n;i++){
    if(s[i] == "AC") ac++;
    else if(s[i] == "WA") wa++;
    else if(s[i] == "TLE") tle++;
    else re++;
  }

  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(a*n,b)<<endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTwinBookReport solver = new CTwinBookReport();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTwinBookReport {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            while (n != 0) {
                CTwinBookReport.Book[] books = new CTwinBookReport.Book[n];
                int totalRead = 0, totalWrite = 0;
                for (int i = 0; i < n; i++) {
                    books[i] = new CTwinBookReport.Book(in.nextInt(), in.nextInt());
                    totalRead += books[i].r;
                    totalWrite += books[i].w;
                }
                Arrays.sort(books, Comparator.comparing(book -> -book.r));

                int voidTime = Math.max(0, books[0].r - (totalRead - books[0].r));
                //System.out.println("(READ, WRITE) = (" + totalRead + ", " + totalWrite + ")");
                //System.out.println("VOID TIME IS " + voidTime);
                int finishTime = totalRead + voidTime; // 読み終わり

                boolean[][] dp = new boolean[n][];
                dp[0] = new boolean[voidTime + 1];
                dp[0][0] = true;
                for (int i = 1; i < n; i++) {
                    dp[i] = dp[i - 1].clone();
                    //System.out.print(books[i].w + " ");
                    for (int j = 0; j <= voidTime - books[i].w; j++) {
                        dp[i][j + books[i].w] |= dp[i - 1][j];
                    }
                }
                //System.out.println(Arrays.toString(dp));
                for (int i = voidTime; ; i--) {
                    if (dp[n - 1][i]) {
                        //System.out.println("REDUCED TIME IS "+ i);
                        out.println(finishTime + totalWrite - i);
                        break;
                    }
                }

                n = in.nextInt();
            }
        }

        private static class Book {
            int r;
            int w;

            Book(int r, int w) {
                this.r = r;
                this.w = w;
            }

        }

    }
}




Measured memory_bytes: 71808
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int N; cin >> N;
    int i;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans = 0;
    for(i=1;i<=(N-1)/2;i++) ans+=a[i];
    for(i=0;i<=(N-2)/2;i++) ans+=a[i];
    AA(ans);
    return 0;
}

Measured memory_bytes: 4048
import java.util.*;

public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.nextInt();
        if((a * b) % 2 == 0){
            System.out.print("No");
        }else{
            System.out.print("Yes");
        }
    }
}

Measured memory_bytes: 23124
#include <iostream>
using namespace std;
int main(void){
	int n;
	while( cin >> n, n){
		int ap=0,bp=0,at,bt;
		for(int i=0;i<n;i++){
			cin >> at  >> bt;
			if(at>bt)
				ap+=at+bt;
			else if(bt>at)
				bp+=at+bt;
			else{
				ap+=at;
				bp+=bt;
			}
		}
	cout << ap << ' ' << bp << endl;
	}
	
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define erep(i, n) for(ll i = 1; i <= (n); i++)
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main(void) {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c[i];
  int ans = 0;
  rep(i, 1<<h)rep(j,1<<w){
    int cnt = 0;
    rep(k, h)rep(l, w){
      if(i>>k&1) continue;
      if(j>>l&1) continue;
      if(c[k][l] == '#')cnt++;
    }
    if(cnt == k)ans++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    // ゼロ判定
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long res = 1;
  for (int i = 0; i < n; i++) {
    if (1000000000000000000 / res < a[i]) {
      cout << -1 << endl;
      return 0;
    }
    res *= a[i];
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3972
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	String S;
	int[] s;
	int[] mods;
	long count = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		S = in.readLine();
		s = new int[S.length()];
		for (int i = 0; i < S.length(); ++i) {
			s[i] = Integer.parseInt(S.substring(i, i + 1));
		}
		mods = new int[S.length()];
		int baseMod = 1;
		mods[mods.length - 1] = (s[mods.length - 1] * baseMod) % 2019;
		for (int i = mods.length - 2; i >= 0; --i) {
			baseMod = baseMod * 10 % 2019;
			mods[i] = (baseMod * s[i] + mods[i + 1]) % 2019;
		}
	}

	void calc() {
		long[] counts = new long[2019];
		Arrays.fill(counts, 0);
		for (int i = 0; i < mods.length; ++i) {
			counts[mods[i]]++;
		}
		count = counts[0];
		for (int i = 0; i < counts.length; ++i) {
			if (counts[i] > 1) {
				count += counts[i] * (counts[i] - 1) / 2;
			}
		}

	}

	void showResult() {
		System.out.println(count);
	}

}


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

int main() {
  int N;
  cin >> N;
  
  set<string> gacha;
  for (int i=0; i<N; i++) {
    string s;
    cin >> s;
    gacha.insert(s);
  }
  
  cout << gacha.size() << endl;
}


Measured memory_bytes: 19256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int[] stones = new int[N];
        for(int i = 0; i < N; i++){
            stones[i] = s.nextInt();
        }

        int[] memo = new int[N];
        memo[0] = 0;
        memo[1] = Math.abs(stones[1] - stones[0]);
        for(int i = 2; i < N; i++){
            memo[i] = Math.min(memo[i-2] + Math.abs(stones[i] - stones[i-2]), memo[i-1] + Math.abs(stones[i] - stones[i-1]));
        }
        System.out.println(memo[N-1]);
    }
}


Measured memory_bytes: 52460
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
void XorSum2() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	long long res = N;
	int ni = 1;
	int xo = A[0];
	int sum = A[0];
	int bef;
	for (size_t i = 0; i < N; i++)
	{
		if (i == ni) {
			xo = A[i];
			sum = A[i];
			ni = i + 1;
		}
		for (size_t j= ni; j < N; j++)
		{
			bef = xo;
			xo ^= A[j];
			sum += A[j];
			if (xo == sum) {
				res += (j - i);
				ni++;
			}
			else {
				xo = bef ^ A[i];
				sum -= (A[j] + A[i]);
				break;
			}
		}
	}
	cout << res;
}
int main() {
	XorSum2();
	return 0;
}

Measured memory_bytes: 1152
#encoding:utf-8

N,M,X,Y=map(int, input().split())

x = list(int(i) for i in input().split())
y = list(int(i) for i in input().split())

x.sort()
y.sort()

war_flag = 0

if X >= Y:
    war_flag = 1

if x[-1] >= y[0]:
    war_flag = 1

if y[0] <= X:
    war_flag = 1

if x[-1] >= Y:
    war_flag = 1

#print
if war_flag == 1:
    print("War")
else:
    print("No War")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;

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

    int lmax = 0;
    int rmin = 1000000;

    rep(i,m) {
        int l, r;
        cin >> l >> r;
        lmax = max(l, lmax);
        rmin = min(r, rmin);
    }

    int ans = max(rmin - lmax + 1, 0);
    cout << ans << endl;

    return 0;
}


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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B) {
        cout << C << endl;
    } else if (A == C) {
        cout << B << endl;
    } else {
        cout << A << endl;
    }
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,W; cin>>n>>W;
	vector<int>w(n),v(n);
	for(int i=0;i<n;++i){
		cin>>w.at(i)>>v.at(i);
	}
	vector<int64_t>dp(W+1,0);
	dp.front()=0;
	for(int i=0;i<n;++i){
		for(int j=W;j>=w.at(i);--j){
			dp.at(j)=max(dp.at(j),dp.at(j-w.at(i))+v.at(i));
		}
	}
	cout<<dp.back()<<"\n"s;
}


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

using namespace std;

int n,d,x[13][13];
char book[(int)2e4+10];

int getdis(int a,int b)
{
    int i,j,sum=0;
    for(i=0;i<d;i++)
        sum+=(x[a][i]-x[b][i])*(x[a][i]-x[b][i]);
    if(book[sum])
        return 1;
    else
        return 0;
}

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

    int i,j;
    memset(book,0,sizeof(book));
    for(i=0;i*i<=2e4;i++)
        book[i*i]=1;
    cin>>n>>d;
    for(i=0;i<n;i++)
        for(j=0;j<d;j++)
            cin>>x[i][j];
    int ans=0;
    for(i=0;i<n;i++)
        for(j=i+1;j<n;j++)
            ans+=getdis(i,j);
    cout<<ans<<endl;
    return 0;
}


/*

3 2
1 2
5 5
-2 8


*/


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <string.h>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	string S;
	cin >> S;
	int zeroCnt = 0;
	int oneCnt = 0;
	for (int i = 0; i < S.size(); ++i)
	{
		if (S[i] == '0')
		{
			++zeroCnt;
		}
		if (S[i] == '1')
		{
			++oneCnt;
		}
	}
	cout << min(zeroCnt, oneCnt) * 2 << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int h,n;
	cin >> h >> n;
	int sum = 0;
	REP(i,n){
		int a;
		cin >> a;
		sum += a;
	}

	cout << (sum >= h ? "Yes" : "No") << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, 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;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, a, b; cin >> n >> a >> b;
	if ((a + b) % 2 == 0)cout << "Alice" << endl;
	else cout << "Borys" << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
n = int(input())

for i in range(1,n+1):
    x = i
    if(x % 3 == 0):
        print(" %d"%x, end ='')
    else:
        while(x):
            if(x % 10 == 3):
                print(" %d"%i, end='')
                break
            x //= 10
print('')



# 3 6 9 12 13 15 18 21 23 24 27 30 31 32 33 34 35 36 37 38 39 42 43 45 48 51 53 54 57 60



Measured memory_bytes: 5876
#include<bits/stdc++.h>
typedef long long int lli;
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    char str[4];
    char str1[4];
    cin>>str;
    cin>>str1;
    if(str[0]==str1[2] && str[1]==str1[1] && str[2]==str1[0])
    {
        cout<<"YES";
    }
    else
    cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string n;
  cin >> n;
  string ans = n;
  if (ans[ans.size() - 1] == 's') {
    ans = ans.insert(ans.size(), "es");
  } else {
    ans = ans.insert(ans.size(), "s");
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

struct line {
	double s, y;
};

int main() {
	int q; cin >> q;
	rep(i, q) {
		double x0, y0, x1, y1, x2, y2, x3, y3;
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double ax, ay;

		if (x0 == x1 || x2 == x3) {
			line l; double lx;

			if (x0 == x1) {
				lx = x0;
				l.s = (y2 - y3) / (x2 - x3);
				l.y = y2 + (l.s * x2 * -1);
			}
			else {
				lx = x2;
				l.s = (y0 - y1) / (x0 - x1);
				l.y = y0 + (l.s * x0 * -1);
			}

			ax = lx;
			ay = l.s*lx + l.y;
		}
		else {
			line l1, l2;
			l1.s = (y0 - y1) / (x0 - x1);
			l1.y = y0 + (l1.s * x0 * -1);
			l2.s = (y2 - y3) / (x2 - x3);
			l2.y = y2 + (l2.s * x2 * -1);

			ax = (l2.y - l1.y) / (l1.s - l2.s);
			ay = l1.s * ax + l1.y;
		}

		printf("%.20f %.20f\n", ax, ay);
	}
}


Measured memory_bytes: 3300
#include<stdio.h>
#include<stdlib.h>

#define N 100
#define TRUE 1
#define FALSE 0

int G[N+1][N+1];
int Adj[N+1];

int main(){
  int n,i,k,u,j;
  
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d %d",&u,&k);
    for(j = 0; j < k; j++){
      scanf("%d",&Adj[j]);
      G[u][Adj[j]] = TRUE;
    }
  }
  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      if(j == 1)printf("%d",G[i][j]);
      else printf(" %d",G[i][j]);
    }
    printf("\n");
  }
  
}


Measured memory_bytes: 2108
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

using namespace std;

class D {
	int a, b;
public:
	D()
	{
		cin >> a >> b;
	}
	void solve()
	{

		vector<string> ans(100);
		string whiterow(100, '.');
		string brackrow(100, '#');
		REP(i, 50)
		{
			ans[i] = whiterow;
			ans[100 - i - 1] = brackrow;
		}
		
		a--; b--;

		while (a)
		{
			for (int row{ 99 }; row >= 50 && a; row-=2)
			{
				//if (row & 1)
				//{
				for (int col{ 0 }; col < 100 && a; col += 2)
				{
					ans[row][col] = '.';
					a--;
				}
				//}
				//else
				//{
				//	for (int col{ 1 }; col < 100 && a; col += 2)
				//	{
				//		ans[row][col] = '.';
				//		a--;
				//	}
				//}
			}
		}
		while (b)
		{
			for (int row{ 0 }; row < 50 && b; row+= 2)
			{
				//if (row & 1)
				//{
				for (int col{ 0 }; col < 100 && b; col += 2)
				{
					ans[row][col] = '#';
					b--;
				}
				//}
				//else
				//{
				//	for (int col{ 1 }; col < 100 && b; col += 2)
				//	{
				//		ans[row][col] = '#';
				//		b--;
				//	}
				//}
			}
		}

		cout << "100 100" << endl;
		REP(i, 100)
			cout << ans[i] << endl;
	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    unsigned long long int n, a, b;
    unsigned long long int ans;
    cin >> n >> a >> b;
    if ((a == 0) && (b == 0))
    {
        cout << "0";
        return 0;
    }
    ans = (n / (a + b)) * a;
    n = n % (a + b);
    ans += min(n, a);
    cout << ans;
    return 0;
}

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

class C{
  int N,M;
  std::string S;
  
public:
  void solve();
};

void C::solve(){
  std::cin>>N>>M>>S;
  std::vector<int> ans;
  int cur=N;
  while(cur>0){
    if(cur-M<=0){
      ans.push_back(cur);
      break;
    }
    bool flag=1;
    for(int i=M;i>0;i--){
      if(S[cur-i]=='0'){
        ans.push_back(i);
        cur-=i;
        flag=0;
        break;
      }
    }
    if(flag){
      std::cout<<"-1\n";
      return;
    }
  }
  for(int i=ans.size()-1;i>=0;i--)
    std::cout<<ans[i]<<" ";
  std::cout<<"\n";
}

int main(){
  C c;
  c.solve();
  return 0;
}
  

Measured memory_bytes: 1144
strings = ['eraser','erase', 'dreamer','dream' ]
# strings = [s[::-1] for s in strings]

S = str(input())
# S = S[::-1]
# print(S,strings)
for s in strings:
    S = S.replace(s, "")

if S == "":
    print('YES')
else:
    print("NO")


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cassert>
#include <cstring>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int d[200000], t[200000];

int main(void) {
    int i, j, n;
    scanf("%d",&n);
    REP (i,n) scanf("%d",&d[i]);

    int m;
    scanf("%d",&m);
    REP (i,m) scanf("%d",&t[i]);

    sort(d,d+n);
    sort(t,t+m);
    for (i = 0, j = 0; i < n && j < m; i++) {
        if (d[i] == t[j]) {
            j++;
        }
    }
    if (j == m) {
        puts("YES");
    }
    else {
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui n, k; cin >> n >> k;
  cout << !!(n % k) << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

int main() {
  
  int64_t N, C, K; cin >> N >> C >> K;
  
  vector<int64_t> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  sort(vec.begin(), vec.end());
  
  int64_t timeMemo = vec[0] + K, passenger = 0, ans = 0;
  
  for (int i = 0; i < N; i++) {
    
    if (vec[i] <= timeMemo) {
      
      passenger++;
      
      if (C < passenger) {
        ans++;
        passenger = 1;
        timeMemo = vec[i] + K;
      }
      
    }
    
    else {
      ans++;
      passenger = 1;
      timeMemo = vec[i] + K;
    }
    
    if (i == N - 1) ans++;
    
  }
  
  cout << ans << endl;
  
}

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

int main() {
    int n, m; cin >> n >> m;
    int r = n;
    int l = 0;
    int R = 0;
    int L = n;
    for(int i = 0; i < m; i ++) {
        int x,y; cin >> x >> y;
        l = max(l,x);
        r = min(r,y);
        L = min(L,x);
        R = max(R,y);
    }
    cout << (R-L>=0 && r-l>=0 ? r-l+1 : 0) << endl;
}

Measured memory_bytes: 256
use itertools::{iproduct, Itertools};
use proconio::{input, marker::Bytes};
use std::cmp::Reverse;
use std::collections::{BinaryHeap, HashMap};

fn main() {
    input!(s: [(Bytes, u64)]);

    type Rest = (Vec<u8>, bool);

    let mut dist = HashMap::<Rest, u64>::new();
    let mut que = BinaryHeap::<(Reverse<u64>, Rest)>::new();

    for ((s, c), &left) in iproduct!(&s, &[true, false]) {
        let c = *c;
        dist.entry((s.clone(), left))
            .and_modify(|d| *d = c.min(*d))
            .or_insert(c);
        que.push((Reverse(c), (s.clone(), left)))
    }

    while let Some((Reverse(dv), (v, left))) = que.pop() {
        let adj = s.iter().flat_map(|(s, c)| {
            if left {
                let w = &v.iter().copied().rev().collect_vec();
                if s.ends_with(w) {
                    Some((&s[..s.len() - v.len()], false))
                } else if w.ends_with(s) {
                    Some((&v[s.len()..], true))
                } else {
                    None
                }
            } else {
                let w = &v.iter().copied().rev().collect_vec();
                if s.starts_with(w) {
                    Some((&s[v.len()..], true))
                } else if w.starts_with(s) {
                    Some((&v[..v.len() - s.len()], false))
                } else {
                    None
                }
            }
            .map(|(s, left)| ((s.into(), left), c))
        });

        for (w, &c) in adj {
            let alt = dv + c;
            if let Some(dw) = dist.get_mut(&w) {
                if *dw > alt {
                    *dw = alt;
                    que.push((Reverse(alt), w.clone()));
                }
            } else {
                dist.insert(w.clone(), alt);
                que.push((Reverse(alt), w.clone()));
            }
        }
    }

    let ans = dist
        .iter()
        .filter(|&((s, _), _)| s.iter().eq(s.iter().rev()))
        .map(|(_, d)| d)
        .min();
    if let Some(ans) = ans {
        println!("{}", ans)
    } else {
        println!("-1")
    }
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

lli trinaly_search(lli small, lli large, function<lli(lli)>fn)
{
  for (int i = 0; i < 100; ++i) {
    lli left = (large - small) / 3 + small;
    lli right = (large - small) * 2 / 3 + small;
    if (fn(right) < fn(left)) large = right;
    else small = left;
  }

  lli mx = small;
  for (lli i = small; i <= large; ++i) {
    if (fn(mx) < fn(i)) mx = i;
  }
  return mx;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  int q;
  while (cin >> q) {
    while (q--) {
      lli a, b;
      unless (cin >> a >> b) return 0;
      lli small = 0;
      lli large = 1e11 + 1;
      while (small + 1 < large) {
        lli mid = (small + large) / 2;

        auto fn = [&] (lli c) {
                    lli x = c;
                    lli y = mid + 1 - c;
                    if (a <= x) ++x;
                    if (b <= y) ++y;
                    return x * y;
                  };

        if (fn(trinaly_search(0, mid, fn)) < a * b) small = mid;
        else large = mid;
      }
      cout << small << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cfloat>
#include <climits>
int a[105];
int main() {
	int n;scanf("%d",&n);double sum=0;
	for(register int i=0;i<n;++i) {
		scanf("%d",a+i);sum+=a[i];
	}
	sum/=n;int ans=-1;double now=DBL_MAX;
	for(register int i=0;i<n;++i) {
		if(fabs(a[i]-sum)<now) {
			ans=i;
			now=fabs(a[i]-sum);
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(){
    int x, ans;
    scanf("%d",&x);
    if     ( x <=  599 ){ ans = 8; }
    else if( x <=  799 ){ ans = 7; }
    else if( x <=  999 ){ ans = 6; }
    else if( x <= 1199 ){ ans = 5; }
    else if( x <= 1399 ){ ans = 4; }
    else if( x <= 1599 ){ ans = 3; }
    else if( x <= 1799 ){ ans = 2; }
    else if( x <= 1999 ){ ans = 1; }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1736
import java.util.*;
public class Main {
	void doIt(){
		Scanner sc = new Scanner(System.in);
		Record round[] = new Record[24];
		Record qualified[] = new Record[6];
		Record finalist[] = new Record[8];
		for(int i = 0; i < 24; i++){
			round[i] =  new Record(sc.nextInt(), sc.nextDouble());
		}
		finalist_search(round, qualified, finalist);
		for(int i = 0; i < 8; i++){
			System.out.printf("%d %.2f\n", finalist[i].number, finalist[i].time);
		}
	}
	void finalist_search(Record a[], Record b[], Record c[]){
		int m = 0, n = 0;
		for(int i = 0; i < 24; i += 8){
			Arrays.sort(a, i, i + 8);
			c[m] = a[i]; m++;
			c[m] = a[i + 1]; m++;
			b[n] = a[i + 2]; n++;
			b[n] = a[i + 3]; n++;
		}
		Arrays.sort(b, 0, 6);
		c[m] = b[0]; m++;
		c[m] = b[1];
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
	class Record implements Comparable<Record>{
		int number;
		double time;
		Record(int number, double time){
			this.number = number;
			this.time = time;
		}
		@Override
		public String toString(){
			return number + " " + time;
		}
		@Override
		public int compareTo(Record r){
			return new Double(time).compareTo(r.time);
		}
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll N,M;
ll d[100][100];
ll l[100][100];

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            d[i][j] = 1e9;
        }
    }
    for(int i=0;i<M;i++){
        ll a,b,c;
        cin >> a >> b >> c;
        d[a-1][b-1] = d[b-1][a-1] = c;
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            l[i][j] = d[i][j];
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++){
                l[j][k] = min(l[j][k], l[j][i] + l[i][k]);
            }
        }
    }
    ll count = 0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(d[i][j] == 1e9) continue;
            if(d[i][j] > l[i][j]) count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

template <class Info>
struct edge {
    int from, to;
    Info info;
    edge(int to, Info info) : to(to), info(info) {}
    edge(int from, int to, Info info) : from(from), to(to), info(info) {}
};

struct normal_edge {
    normal_edge() {}
};

template <class Info>
class graph {
   protected:
    using edge_type = edge<Info>;
    ::std::size_t N;
    ::std::vector<::std::vector<edge_type>> edges;

   public:
    graph(::std::size_t N_) : N(N_), edges(N_) {}
    virtual void add_edge(int x, int y, Info info) = 0;
    const ::std::vector<edge_type> &delta(int v) const {
        assert(v < N);
        return edges[v];
    }
    const ::std::vector<edge_type> &operator[](int v) const {
        return this->delta(v);
    }
    ::std::size_t size() const { return N; }
};

template <class Info>
class undirected_graph : public graph<Info> {
   public:
    undirected_graph(::std::size_t N) : graph<Info>(N) {}
    void add_edge(int x, int y, Info info) {
        this->edges[x].push_back(edge<Info>(x, y, info));
        this->edges[y].push_back(edge<Info>(y, x, info));
    }
};

template <class Info>
class directed_graph : public graph<Info> {
   public:
    directed_graph(::std::size_t N) : graph<Info>(N) {}
    void add_edge(int x, int y, Info info) {
        this->edges[x].push_back(edge<Info>(x, y, info));
    }
};

template <class Info>
class bipartite_graph : public undirected_graph<Info> {
    ::std::size_t A;
    ::std::size_t B;

   public:
    bipartite_graph(::std::size_t A_, ::std::size_t B_)
        : A(A_), B(B_), undirected_graph<Info>(A_ + B_) {}
    void add_edge(int x, int y, Info info) {
        undirected_graph<Info>::add_edge(x, y + A, info);
    }
};

template <typename Info>
struct is_bipartite {
    vector<int> color;
    int white_cnt = 0, n;

    bool dfs(graph<Info> &g, int v, int prev, int c) {
        color[v] = c;
        if(c == 1) white_cnt++;
        for(auto nv : g[v]) {
            if(nv.to == prev) continue;

            if(color[nv.to] == -1) {
                if(!dfs(g, nv.to, v, 1 - c)) return false;
            } else if(color[nv.to] != 1 - c) {
                return false;
            }
        }
        return true;
    }

    int operator()(graph<Info> &g) {
        color.assign(g.size(), -1);
        if(!dfs(g, 0, -1, 0)) return -1;
        return white_cnt;
    }
};

int main() {
    int_fast64_t N, M;
    cin >> N >> M;
    undirected_graph<int> g(N);
    for(int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        g.add_edge(A - 1, B - 1, 1);
    }
    int_fast64_t white_cnt = is_bipartite<int>()(g);
    if(white_cnt == -1)
        cout << N * (N - 1) / 2 - M << endl;
    else
        cout << white_cnt * (N - white_cnt) - M << endl;

    return 0;
}

Measured memory_bytes: 7424
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n,ll m){
  ll ans=0;
  while(n){ans+=n%m;n/=m;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}


vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.pb(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
vec primefactorization(ll N){
  ll i=2;
  vec res;
  while(i*i<=N){
    while(!(N%i)){
      res.pb(i);
      N/=i;
    }
    i++;
  }
  if(N-1)res.pb(N);
  return res;
}
vec diviserlist(ll N){
  ll i;
  vec res;
  for(i=1;i*i<N;i++){
    if(N%i==0){
      res.pb(i);res.pb(N/i);
    }
  }
  if(i*i==N)res.pb(i);
  vsort(res);
  return res;
}

int main(){
  ll i,j,N,x,ans;
  cin>>N>>x;
  if(N==x){
    cout<<N+1<<endl;
    return 0;
  }
  vec v=diviserlist(N-x);
  vsort(v);
  for(auto p:v){
    if(sumdigits(N,p+1)==x){
      cout<<p+1<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main(){
	var S, T string
	fmt.Scan(&S)
	fmt.Scan(&T)
	matched := 0
	for i := 0; i < 3; i++ {
		if S[i] == T[i] {
			matched += 1
		}
	}
	fmt.Println(matched)
}


Measured memory_bytes: 512
#include<iostream>
using namespace std ;
int main()
	{
	int a ,b ,c ;
	int A ,B ;
	int max ;
	cin>>A>>B ;
	a=A+B ;
	b=A-B ;
	c=A*B ;
	if(a>b)
		max=a ;
	else
		max=b ;
	if(c>max)
		cout<<c<<endl ;
	else
		cout<<max<<endl ;
	}

Measured memory_bytes: 256
n = input()
li = list(map(int, input().split()))

count = 0
for i in range(1, len(li)-1):
    if (li[i] > li[i+1] and li[i] < li[i-1] )or (li[i] > li[i-1] and li[i] < li[i+1] ):
        count+= 1

print(count)



Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int H,W;
int dir[4][2] = { {1,0}, {0,1}, {-1,0}, {0,-1} };

bool isOK( int x, int y ) {
    return x >= 0 && y >= 0 && x < W && y < H;
}
 
int main() {
    cin >> H >> W;
    vector<string> V(H);
    for ( int i = 0; i < H; i++ ) {
        cin >> V[i];
    }

    bool ans = true;
    for ( int x = 0; x < W; x++ ) {
    for ( int y = 0; y < H; y++ ) {
        if ( V[y][x] == '.' ) { continue; }
        bool ok = false;
        for ( int i = 0; i < 4; i++ ) {
            int nx = x+dir[i][0];
            int ny = y+dir[i][1];
            if ( isOK(nx,ny) && V[ny][nx] == '#' ) { ok = true; }
        }
        if ( !ok ) { ans = false; }
    }
    }

    cout << ( ans ? "Yes":  "No" ) << endl;

    return 0;
}

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

int main() {
    string w;
    cin >> w;
    for(char i='a';i<='z';i++) {
        int c = 0;
        for(int j=0;j<w.size();j++) {
            if(w[j] == i) c++;
        }
        if(c%2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 500005;

int n, m, k, res;

int main() {
scanf("%d %d %d", &n, &m, &k);
if (n < m) swap(n, m);
while (res < k) res += n;
printf("%d\n", res / n);
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int a,b,c;cin>>a>>b>>c;
    cout<<max(c-(a-b),0)<<endl;
}

Measured memory_bytes: 256