akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
    int N,i,cnt=0;
    int a[100000] = {0};
    
    scanf("%d",&N);
    for(i=0; i<N; i++){
        scanf("%d",&a[i]);
        if(a[i] % 2 != 0)
            cnt++;
    }
    if(cnt % 2 == 0)
        printf("YES\n");
    else
        printf("NO\n");
    
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>

typedef long double Double;

const Double EPS = 1E-10;

int sgn(Double x) {
	return x < -EPS ? -1 : x > EPS;
}

int step, lower, upper;
Double p, e, t;

Double solve(Double a, Double b, Double x, int depth) {
	if (sgn(b - x) <= 0) {
		return 1;
	}
	if (sgn(a - x) > 0) {
		return 0;
	}
	if (depth == 0) {
		Double h = (a + b) / 2;
		return sgn(h - x) <= 0 ? 1 : 0;
	}
	
	Double result = 1;
	Double m = (a + b) / 2;
	if (sgn(m - t) > 0) {
		result = p * solve(a, m, x, depth - 1) + (1 - p) * solve(m, b, x, depth - 1);
	} else {
		result = p * solve(m, b, x, depth - 1) + (1 - p) * solve(a, m, x, depth - 1);
	}
	return result;
}

int main() {
	std::cin >> step >> lower >> upper >> p >> e >> t;
	p = 1 - p;
	std::cout << std::setprecision(8) << std::fixed << solve(lower, upper, t + e, step) - solve(lower, upper, t - e, step) << std::endl;
	return 0;
}

Measured memory_bytes: 1300
public class Main {
	public static void main(String[] args){
		String input = new java.util.Scanner ( System.in ).nextLine();
		String[] inputArray = input.split(" ");
		int x = Integer.parseInt(inputArray[0]);
		int y = Integer.parseInt(inputArray[1]);
		int z = x+x+y+y;
		System.out.println(x*y + " " + z);
	}
}

Measured memory_bytes: 25736
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = scan!(usize);

    let mut m = HashMap::new();

    for mut i in 1..n + 1 {
        for j in 2.. {
            while i % j == 0 {
                *m.entry(j).or_insert(0) += 1;
                i /= j;
            }
            if i == 1 {
                break;
            }
        }
    }

    let mut ans = 1i64;
    for (_, val) in m {
        ans *= val + 1;
        ans %= 1_000_000_007;
    }

    println!("{}", ans);
}


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

int main(void)
{
    long n,x;
    long f[100000];
    cin >> n;
    for(int i=0;i<n;i++)
    {
        f[i]=0;
    }
    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
            for(int k=1;x<=n;k++)
            {
                x = i*i + j*j + k*k + i*j + j*k + k*i;
                //if(i==k && i==j && k==j)
                f[x]++;
//                else
//                {
//                    f[x]++,f[x]++,f[x]++;
//                }
                //cout << x << endl;
            }
            x=1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        cout << f[i] << endl;
    }
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
#include <iomanip>      // std::setprecision
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1] 
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FENWICK(k) (k&-k)
#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end()) 
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end()) 
#define LL long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const int rogi[4][2] = { {1,1}, {1,-1}, {-1,1}, {-1,-1} };
int a,b;

void dane() {
	cin>>a>>b;
	if(a>12) cout<<b<<endl;
	else if (a>=6) cout<<b/2<<endl;
	else cout<<"0\n";
}   


int main() {
	IOS
	// int t;
	// cin>>t;
	// F(i,0,t)
	    dane();
    return 0;
}

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

const int N=105;

int n,ans,now;
int a[N],b[N],c[N],d[N],vis[N],lk[N];
vector<int> lev[N];

int dfs(int k){
	int j,u;
	for (j=0;j<lev[k].size();j++){
		u=lev[k][j];
		if (vis[u]!=now){
			vis[u]=now;
			if (!lk[u]||dfs(lk[u])){
				lk[u]=k;
				return 1;
			}
		}
	}
	return 0;
}

int main(){
	int i,j;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	for (i=1;i<=n;i++) scanf("%d%d",&c[i],&d[i]);
	for (i=1;i<=n;i++)
		for (j=1;j<=n;j++)
			if (a[i]<c[j]&&b[i]<d[j]) lev[i].push_back(j);
	for (i=1;i<=n;i++){
		now++;
		ans+=dfs(i);
	}
	printf("%d\n",ans);
	return 0;
} 

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

    class Program
    {
        static void Main(string[] args)
        {
            //input
            string[] input = Console.ReadLine().Split(' ');
            decimal n = decimal.Parse(input[0]);
            decimal k = decimal.Parse(input[1]);

            decimal amari = n % k;
            decimal sa = Math.Abs(k - amari);
            if (amari < sa)
            {
                Console.WriteLine(amari.ToString());
                return;
            }
            Console.WriteLine(sa.ToString());
        }
    }

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>

string s;
int c[30];
int f=-1,g=-1;

int main(){

  cin>>s;
  for(int i=0;i<s.size();i++){
    if(i>0&&s[i]==s[i-1]){
      f=i;g=i+1; break;
    }
    if(i>1&&s[i]==s[i-2]){
      f=i-1;g=i+1; break;
    }
  }

  printf("%d %d\n",f,g);

  return 0;
}


Measured memory_bytes: 512
N,K = map(int,input().split())
XY = [list(map(int,input().split())) for _ in [0]*N]

iX = sorted(x for x,y in XY)
iY = sorted(y for x,y in XY)
X = {x:i for i,x in enumerate(iX)}
Y = {y:i for i,y in enumerate(iY)}

c = [[0]*(N+1) for i in [0]*(N+1)]
for x,y in XY:
    c[Y[y]+1][X[x]+1] = 1

for i in range(N):
    for j in range(N):
        c[i+1][j+1] += c[i+1][j]
for i in range(N):
    for j in range(N):
        c[i+1][j+1] += c[i][j+1]

ans = 10**20
for l in range(N):
    for r in range(l+1,N):
        for u in range(N):
            for d in range(u+1,N):
                if c[d+1][r+1]+c[u][l]-c[u][r+1]-c[d+1][l] >=K:
                    ans = min(ans,
                             (iX[r]-iX[l])*(iY[d]-iY[u]))

print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
int a[3],t=0,i;
cin >> a[0] >> a[1] >> a[2];
for(i=0;i<3;i++)
{
    if(t<a[i])t=a[i];
}
cout << a[0]*a[1]*a[2]/t/2;

}

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


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

class BPopularVote {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n,m;
        in >> n >> m;
        vector<int> a(n);
        int su=0;
        rep(i,n) {
            in >> a[i];
            su += a[i];
        }
        double l = su/(4.*m);
        int c=0;
        rep(i,n){
            if((double)a[i]>=l)c++;
        }
        if(c>=m){
            out << "Yes" << endl;
        }else{
            out << "No" << endl;
        }
	}
};


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


Measured memory_bytes: 256
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int i = 1;
        for (; i * i <= n; i++)
        {

        }

        Console.WriteLine((i - 1) * (i - 1));
    }

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

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

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

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

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            var N = vals[0];
            var T = vals[1];

            var mincost = 10000;
            foreach(var i in Enumerable.Range(0, N))
            {
                vals = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
                if(vals[1] <= T && vals[0] < mincost)
                {
                    mincost = vals[0];
                }
            }
            if (mincost == 10000)
            {
                Console.WriteLine("TLE");
            }
            else
            {
                Console.WriteLine(mincost);
            }
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define nl '\n'
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */
#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key> >
using ostree = pbds::tree<key, val, comp, pbds::rb_tree_tag,
                          pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define allOf(x) std::begin(x), std::end(x)
template <typename...Args>
ostream&operator<<(ostream&os, pair<Args...> const &p)
{return os<<'('<<p.first<<", "<<p.second<<')';}
template <typename...Args>
ostream&operator<<(ostream&os, vector<Args...> const &v)
{os<<'[';for(const auto&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args> ostream&operator<<(ostream&os, map<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args> ostream&operator<<(ostream&os, set<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args>
ostream&operator<<(ostream&os, unordered_map<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template<typename T> void trace_rec(stringstream&sst, const T&t)
{ string arg; getline(sst, arg, ','); cerr << arg << " : " << t << " }"; }
template<typename T, typename... Args>
void trace_rec(stringstream&sst, const T&t, const Args... args)
{ string arg; getline(sst, arg, ','); cerr << arg << " : " << t << ", ";
  trace_rec(sst, args...); }
template<typename... Args> void trace(const string&s, Args... args)
{stringstream sst(s); cerr << "{ "; trace_rec(sst, args...); cerr << endl;}
#define dbg(...) trace(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void dbr(const T lb, const T ub)
{cerr<<'{';for(auto it=lb; it!=ub; it++)cerr<<' '<<(*it);cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T> >
bool setMin(T &mem, const T&v, Comp comp = Comp())
{ return comp(v, mem) ? mem = v, true : false; }
template<typename T, typename Comp=less<T> >
bool setMax(T &mem, const T&v, Comp comp = Comp())
{ return comp(mem, v) ? mem = v, true : false; }
mt19937_64 rng(time(nullptr));
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  ll n, m;
  string s, t;

  cin >> n >> m >> s >> t;
  ll l = (n*m)/(__gcd(n, m));

  bool yes = true;
  for(ll i=0, j=0; i<n and j<m; i+=(l/m), j+=(l/n))
    if( s[i] != t[j] ) yes = false;

  cout << (yes ? l : -1) << endl;

  return 0;
}

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 640
from collections import defaultdict
mod = 10**9+7
n = int(input())
c = [0]
d = defaultdict(list)
r = defaultdict(int)

idx = 1
for i in range(n):
    tmp = int(input())
    if c[-1] != tmp:
        if d[tmp]:
            r[idx] = d[tmp][-1]
        d[tmp].append(idx)
        c.append(tmp)
        idx += 1

n = len(c)
dp = [0]*(n)
dp[0] = 1
for i in range(1, n):
    dp[i] = dp[i-1]
    if r[i]:
        dp[i] += dp[r[i]]
    dp[i] %= mod
print(dp[-1])


Measured memory_bytes: 84668
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	int ans = 0;
	while( n > 0 ) {
		n /= k; 
		ans++;
	}
	
	cout << ans << endl;
	return 0;
}


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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a < 0 && b < 0) {
		if ((b-a+1)&1) puts("Negative");
		else puts("Positive");
	} else if (a <= 0 && 0 <= b) puts("Zero");
	else puts("Positive");
	return 0;
}


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

typedef long long ll;
typedef std::pair <int, int> pii;
const int N = 100010;

pii p[N];
int a[N], b[N];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i){
        scanf("%d", &a[i]);
    }
    ll sum = 0;
    for (int i = 0; i < n; ++ i){
        scanf("%d", &b[i]);
        p[i] = {a[i] - b[i], i};
        sum += p[i].first;
    }
    if (sum < 0){
        puts("-1");
        return 0;
    }
    std::sort(p, p + n);
    for (int i = 0, j = n - 1; i < n; ++ i){
        while (p[i].first < 0){
            int x = std::min(-p[i].first, p[j].first);
            p[i].first += x;
            p[j].first -= x;
            if (!p[j].first){
                -- j;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i){
        if (a[p[i].second] != b[p[i].second] + p[i].first){
            ++ ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define Would
#define you
#define please
int main() {
	int N;
	cin >> N;

	int S[10] = {};
	int i = 0;
	int N0 = N;
	while (N) {
		S[i] = N % 10;
		N /= 10;
		i++;
	}
	int goukei = 0;

	rep(i, 10) goukei += S[i];
	if (N0 % goukei == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	Would you please return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

class Main {

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

		Scanner scane = new Scanner(System.in);

		int n = 0, m = 0, l = 0;

		n = scane.nextInt();
		m = scane.nextInt();
		l = scane.nextInt();

		int[][] A = new int[n][m];

		int[][] B = new int[m][l];

		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				A[i][j] = scane.nextInt();
			}
		}

		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				B[i][j] = scane.nextInt();
			}
		}

		long sum =0;
		int i;
		for (int k = 0; k < A.length; k++) {
			for ( i = 0; i < B[0].length; i++) {
				sum =0;
				for (int j = 0; j < B.length; j++) {

					sum +=A[k][j] * B[j][i];
				}
				if(i ==B[0].length-1){
					System.out.print(sum);
				}else {
					System.out.print(sum+" ");
				}

			}
			System.out.println("");
		}

	}
}

Measured memory_bytes: 53564
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<int> W(n);
	rep(i,n) cin >> W[i];
	int ans = INF;
	rep(i,n-1){
		int s = 0, t = 0;
		for (int j = 0; j <= i; j++) s += W[j];
		for (int j = i+1; j < n; j++) t += W[j];
		chmin(ans,abs(s-t));
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  vector<char> S(100);
  int RCount = 0;
  int LCount = 0;
  
  for(int i = 0; i < 100; i++){
    cin >> S.at(i);
  }
  
  for(int i = 0; i < 100; i++){
    if(i%2==0){
      if(S.at(i) == 'L'){
        LCount++;
      }
    } else{
      if(S.at(i) == 'R'){
        RCount++;
      }
    }
  }
  
  if(LCount == 0 && RCount == 0){
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }
  
}
      
  
  

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNextInt()){
            int n=sc.nextInt();
            int ans=0;
            for(int i=0;i<10;i++){
                for(int j=0;j<10;j++){
                    for(int k=0;k<10;k++){
                        if(n-i-j-k<=9&&n-i-j-k>=0)ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define MOD 1000000007

#define FOR(i, m, n) for (ll i = m; i <= n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)

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

ll A[1000010];

int main() {
    ll K, N;
    cin >> K >> N;
    FOR(i, 1, N) cin >> A[i];
    ll ans = 0;
    FOR(i, 1, N - 1) {
        if (ans < A[i + 1] - A[i]) ans = A[i + 1] - A[i];
    }
    if (ans < A[1] + K - A[N]) ans = A[1] + K - A[N];
    cout << K - ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int x;
	cin >> x;
	for(long long int i=-203; i<=203; i++)
	{
		for(long long int j=-203; j<=203; j++)
		{
			if(i*i*i*i*i - j*j*j*j*j == x)
			{
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;
static const bool DEBUG = false;

signed main() {
	string A = "CODEFESTIVAL2016";
	string B; cin >> B;
	int cnt = 0;
	rep(i, 0, A.size()) {
		if (A[i] != B[i])cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


//-----------------------------------------------------------------------------

int c(char s) {
	switch (s) {
		case 'A':return 0;
		case 'B':return 1;
		case 'C':return 2;
		case 'D':return 3;
		case 'E':return 4;
		case 'F':return 5;
	}
}

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

	char x,y;cin>>x>>y;
	int a=c(x),b=c(y);
	cout<<(a<b?'<':a==b?'=':'>')<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;

int H, W, h, w;

int main() {
	cin >> H >> W >> h >> w;
	if (H%h) {
		cout << "Yes" << endl;
		for (int i = 0; i != H; ++i) {
			for (int j = 0; j != W; ++j) {
				if (i % h == 0)
					cout << 0xe869120;
				else if (i % h == h - 1)
					cout << -0xe869121;
				else
					cout << 0;
				if (j != W - 1)
					cout << sp;
			}
			cout << endl;
		}
	}
	else if (W%w) {
		cout << "Yes" << endl;
		for (int i = 0; i != H; ++i) {
			for (int j = 0; j != W; ++j) {
				if (j%w == 0)
					cout << 0xe869120;
				else if (j%w == w - 1)
					cout << -0xe869121;
				else
					cout << 0;
				if (j != W - 1)
					cout << sp;
			}
			cout << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

#define TRUE 1
#define FALSE 0

int solve(int, int);
int n;
int *a;

int main()
{
  int q, i;
  int *m;

  scanf("%d", &n);
  a = (int *)malloc(n*sizeof(int));
  for(i=0; i<n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &q);
  m = (int *)malloc(q*sizeof(int));
  for(i=0; i<q; i++) {
    scanf("%d", &m[i]);
  }

  for(i=0; i<q; i++) {
    if(solve(0, m[i]) == TRUE)
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}

int solve(int i, int m)
{
  if(m == 0)
    return TRUE;
  else if(i >= n)
    return FALSE;

  return solve(i+1, m) || solve(i+1, m-a[i]);
}

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

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

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

    int B[ 4 ][ 3 ][ 10 ] = {};

    while( n > 0 ) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;

        B[ b - 1 ][ f - 1 ][ r - 1 ] += v;
        n--;
    }

    for( int i = 0; i < 4; i++ ) {
        for( int j = 0; j < 3; j++ ) {
            for( int k = 0; k < 10; k++ ) {

                if( B[ i ][ j ][ k ] >= 0 && B[ i ][ j ][ k ] <= 9 )
                    cout << " " << B[ i ][ j ][ k ];
                else if( B[ i ][ j ][ k ] < 0 )
                    cout << " " << 0;
                else if( B[ i ][ j ][ k ] > 9 )
                    cout << " " << 9;
            }
            cout << endl;
        }
        if( i < 3 ) cout << "####################" << endl;
    }

    return 0;
}



Measured memory_bytes: 3116
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  int n, k;
  cin >> n >> k;
  ll a[50];
  rep(i, n) cin >> a[i];
  sort(a, a + n, greater<ll>());
  ll sum = 0;
  rep(i, k) sum += a[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import deque
H,W=map(int,input().split())
a=[list(input()) for i in range(H)]
#print(a)
#黒のマスを探索する
#黒のマスの周囲四マスを黒に変更する
#探索済みのところはTrueにする
log=[[-1]*W for i in range(H)]
def bfs():
    task=deque([])
    #初め黒のマスを検索する
    for i in range(H):
        for j in range(W):
            if a[i][j]=='#':
                task.append((i,j))
                log[i][j]=0

    dh=[0,1,0,-1]
    dw=[1,0,-1,0]

    while task:
        h,w=task.popleft()
        #四マスを探索する
        for i in range(4):
            nh=h+dh[i]
            nw=w+dw[i]
            if not(0<=nh<H and 0<=nw<W):continue
            if a[nh][nw]=='#':continue
            a[nh][nw]='#'
            log[nh][nw]=log[h][w]+1
            task.append((nh,nw))

def ans_check():
    ans=0
    for i in range(H):
        for j in range(W):
            if ans<log[i][j]:ans=log[i][j]

    print(ans)

bfs()
ans_check()


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b;
  char c;
  cin >> a >> c >> b;
  if(c == '+') {
    cout << a + b << endl;
  }else {
    cout << a - b << endl;
  }
}


Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int, input().split()))

A = collections.Counter(A).most_common()
N = len(A)

ans = [0]

for i in range(N):
    if A[i][1] >= 4:
        ans.append(A[i][0]**2)

ref = []
for j in range(N):
    if A[j][1] >= 2:
        ref.append(A[j][0])
ref = sorted(ref)
if len(ref) >= 2:
    ans.append(ref[-2]*ref[-1])

print(max(ans))


Measured memory_bytes: 26448
#include<iostream>
using namespace std;
int main(){
	int n, x[64], memo[4][13] = { 0 };
	char c[64];
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> c[i] >> x[i];
	}
	for (int i = 0; i < n; i++){
		if (c[i] == 'S'){
			memo[0][x[i]-1] = 1;
		}
		else if(c[i] == 'H'){
			memo[1][x[i]-1] = 1;
		}
		else if(c[i] == 'C'){
			memo[2][x[i]-1] = 1;
		}
		else if(c[i] == 'D'){
			memo[3][x[i]-1] = 1;
		}
	}
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			if (memo[i][j] == 0){
				if (i == 0){
					cout << "S ";
				}
				else if (i == 1){
					cout << "H ";
				}
				else if (i == 2){
					cout << "C ";
				}
				else if (i == 3){
					cout << "D ";
				}
				cout << j+1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3072
k = int(input())

def runrun(n):
  if n == 1:
    return([int(x) for x in range(1, 10)])
  key = runrun(n-1)
  key_2 = []
  for value in key:
    p = value%10
    for t in range(-1, 2):
      if 0 <= p+t <= 9:
        key_2.append(value*10+p+t)
  return key_2

runrun_list = []
for i in range(1, 11):
  runrun_list = runrun_list+runrun(i)
  runrun_list.sort()
print(runrun_list[k-1])

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

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

  vector<long long> a(N);
  for (int i = 0; i < N; i++) cin >> a.at(i);

  vector<long long> s(N + 1, 0);
  for (int i = 0; i < N; ++i) s.at(i + 1) = s.at(i) + a.at(i);

  long long ans = 1001001001001;
  for (int i = 0; i < N; i++) {
    ans = min(ans, abs(s.at(i) * 2 - s.at(N)));
  }

  cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int cnt=0;
    while(a>0 && c>0)
    {
        if(cnt%2==0)
        {
            c-=b;
        }
        else
            a-=d;
        cnt++;
    }
    if(a>0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}



Measured memory_bytes: 3620
<>;map{push@$_,$_[--$|]for@_=glob}<>;sub f{my($x,$b,$w)=($_,1,1);$_-"@_"and f($x),$b=$b*$c%($==1e9+7),$w=$w*$d%$=for@$x;$c=$w;$d=$b+$w}f$_=1;print$d%$=

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;
typedef unordered_map<int,int> uoii;
typedef unordered_map<string,int> uosi;

const int MOD = 1e9+7;

const int INF = 1e10;




int32_t main()
{
    
    IOS
    int n;
    cin>>n;
    map<int,int>mp;
    vi a(n);
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        ans+=mp[a[i]];
        mp[a[i]]++;
    }
    for(int i=0;i<n;i++){
        ans-=mp[a[i]]-1;
        cout<<ans<<'\n';
        ans+=mp[a[i]]-1;
    }


    return 0;
}


Measured memory_bytes: 11136
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

n,m=map(int,input().split())
data=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    a-=1;b-=1
    data[a]+=1
    data[b]+=1
for di in data:
    print(di)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353


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

    // solution comes here

    ll N, M;
    cin >> N >> M;

    if(N==1 and M==1)     cout << 1 << nl;
    else if(N==1 or M==1) cout << max(N, M) -2 << nl;
    else                  cout << (N-2)*(M-2) << nl;
}


Measured memory_bytes: 256
s = input()

c = []
cur = s[0]
strk = 1
for i in range(1, len(s)):
    if s[i] == cur:
        strk += 1
    else:
        c.append((cur, strk))
        cur = s[i]
        strk = 1
c.append((cur, strk))

ans = [0] * len(s)
index = 0
for i in range(len(c)):
    even = c[i][1] // 2
    odd = c[i][1] - even

    if c[i][0] == "R":
        ans[index+c[i][1]-1] += odd
        ans[index+c[i][1]] += even
    else:
        ans[index-1] += even
        ans[index] += odd

    index += c[i][1]

print(" ".join(map(str, ans)))

Measured memory_bytes: 24236
n,k = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
 
x10 = n
x2 = Base_10_to_n(x10, k)
s = list(' '.join(x2).split())
print(len(s))

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

#define ll long long

int main()
{
    string s;
    cin >> s;
    int l = s.length();
    if(s[l-1] != 's')
    {
        s = s + 's';
        cout << s << endl;
    }
    else
    {
        s = s + "es";
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FORr(i, j, 0)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    int A, B;
    cin >> A >> B;
    if(6 <= A && A <= 12) {
        cout << B / 2 << endl;
    }
    else if(5 >= A) {
        cout << 0 << endl;
    }
    else cout << B << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<limits.h>
#include<math.h>
#include<map>
#include<vector>
#define pi acos(-1.0)
#define ll long long
#define INF 0x3f3f3f3f
const int maxn=1e6+10;
int main()
{
	int n;
	int sum=0;
	scanf("%d",&n);
	int x=n;
	while(x)
	{
		sum=sum+x%10;
		x/=10;
	}
	if(n%sum)
	printf("No\n");
	else
	printf("Yes\n");
	return 0;
}

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

using namespace std;

int main(void){
	int N;
	char S[100000];
	cin >> N;
	cin >> S;
	while(N > 35){
		N = N - 36;
	}
	int w;
	char k;
	int len = strlen(S);
	int i;
	for(i = 0; i < len; i++){
		w = (int)S[i];
		//cout<<endl;
		//cout<<"w = "<<w<<"  N = "<<N<<endl<<endl;
		if(w+N > 90){
			w = w - 26;
		}
		w += N;
		//cout<<"w = "<<w<<endl<<endl;
		S[i] = (char)w;
		//cout<<"S[i] = "<<S[i] <<"  i = "<<i<<endl<<endl;
	}
	printf("%s\n",S);
	
	char a[10] = "A";
	char z[2] = "Z";
	int aa = (int)a[0];
	int zz = (int)z[0];
	//cout<<"aa = "<<aa<<" zz = "<<zz<<endl;
	return 0;
}





Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            yield i

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

def cf(x1,x2):
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            yield i

def gcd(a,b):
    while b != 0:
        a,b = b,a%b
    return a

def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


def solve(A: int, B: int):
    AP = prime_factorize(A)
    BP = prime_factorize(B)
    print(len(AP & BP) + 1)

    return



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> cnt(n, 0);
    rep(i, n){
        int a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    sort(cnt.rbegin(), cnt.rend());
    int tmp = 0;
    rep(i, k){
        tmp += cnt[i];
    }
    int ans = n - tmp;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
from collections import defaultdict
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
if n == 1:
    print(0)
else:
    count = prime_factorize(n)
    count_dict = defaultdict(int)
    for c in count:
        count_dict[c] += 1
    ans = 0
    for key,value in count_dict.items():
        tmp = value
        m = 1
        while tmp >= m:
            tmp -= m
            m += 1
            ans += 1
    print(ans)

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a == b)
	{
		cout << "a == b" << endl;
	}
	else
	{
		if (a > b)
		{
			cout << "a > b" << endl;
		}
		else
		{
			cout << "a < b" << endl;
		}
	}
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int64_t abs(int64_t n) {
  if (n < 0) {
    n = -n;
  }
  return n;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if ((b-a)%2 == 0) {
    cout << "Alice" << endl;
  } else {
    cout << "Borys" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;

int main() {
    int n;
    cin >> n;
    array<int, 3> d;
    for (auto &e: d) cin >> e;
    vector<int> l(n);
    for (auto &e: l) cin >> e;

    int ans = 1e9;
    for (int i = 0; i < 1 << 2*n; ++i) {
        vector<int> sums(3, 0);
        int mp = 0;
        for (int j = 0; j < n; ++j) {
            int p = (i >> 2 * j) & 3;
            if (p < 3) {
                if (sums[p] > 0) mp += 10;
                sums[p] += l[j];
            }
        }
        if (count(sums.begin(), sums.end(), 0) > 0) continue;
        for (int j = 0; j < 3; ++j) {
            mp += abs(sums[j] - d[j]);
        }
        ans = min(mp, ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)
#define ll long long int
#define M 1046527

string H[M];

int h1(int key){
    return key%M;
}

int h2(int key){
    return 1 + key%(M-1);
}

ll getChar(char ch){
    if(ch=='A') return 1;
    else if(ch=='C') return 2;
    else if(ch=='G') return 3;
    else if(ch=='T') return 4;
    else return 0;
}

ll getKey(string str){
    ll sum=0,p=1;
    F(i,0,str.size()){
        sum+=p*getChar(str[i]);
        p*=5;
    }
    return sum;
}

bool Find(string str){
    ll h,key;
    key=getKey(str);
    for(int i=0; ;++i){
        h=(h1(key) + i*h2(key))%M;
        if(H[h]==str) return true;
        else if(H[h].empty()) return false;
    }
    return false;
}

void Insert(string str){
    ll h,key;
    key=getKey(str);
    for(int i=0; ;++i){
        h=(h1(key) + i*h2(key))%M;
        if(H[h]==str) return;
        else if(H[h].empty()){
            H[h]=str;
            return;
        }
    }
}

int main()
{
    ll n;
    string com,str;
    cin >> n;
    F(i,0,n){
        cin >> com >> str;
        if(com[0]=='i'){
            Insert(str);
        }
        else{
            if(Find(str)) cout << "yes" << endl;
            else cout << "no" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 27824
#include <cstdio>
#include <algorithm>

using namespace std;

int search(int n, int m, int passed[], int path[][3], int start, int end) {
    int cost = -1, s, c;
    if (start == end) {
        return 0;
    }
    passed[start - 1] = 1;
    for (int i = 0; i < m * 2; i++) {
        if (path[i][0] == start && passed[path[i][1] - 1] == 0) {
            s = search(n, m, passed, path, path[i][1], end);
            c = path[i][2] + s;
            if (s == -1) continue;
            if (cost == -1) cost = c;
            else cost = min(cost, c);
        }
    }
    passed[start - 1] = 0;
    return cost;
}

int main(void) {
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);
    int path[m * 2][3];
    for (int i = 0; i < m; i++) {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        path[i * 2][0] = a;
        path[i * 2][1] = b;
        path[i * 2][2] = c;
        path[i * 2 + 1][0] = b;
        path[i * 2 + 1][1] = a;
        path[i * 2 + 1][2] = d;
    }
    int start, end, y1, y2;
    scanf("%d,%d,%d,%d", &start, &end, &y1, &y2);
    int passed[n];
    for (int i = 0; i < n; i++) passed[i] = 0;
    int p1 = search(n, m, passed, path, start, end);
    for (int i = 0; i < n; i++) passed[i] = 0;
    int p2 = search(n, m, passed, path, end, start);
    int cost = y1 - y2 - p1 - p2;
    printf("%d\n", cost);
    return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const ll maxn=1e6+10;
char s[maxn];
ll n,ans;
void dfs(ll num)
{
	if(num==n)
	{
		for(int i=0;i<n;i++)
			cout<<s[i];
		cout<<endl;
		return;
	}
	for(int i=0;i<=ans;i++)
	{
		s[num]='a'+i;
		ll tmp=ans;
		if(i==ans) ans++;
		dfs(num+1);
		ans=tmp;
	}
}

int main()
{
	cin>>n;
	dfs(0);
	return 0;
}

Measured memory_bytes: 1536
n = int(input())
s = input()
tmp = set()
si = set()
for i in range(n-2):
  if s[i] in si:
    continue
  else:
    si.add(s[i])
    sj = set()
    for j in range(i+1,n-1):
      if s[j] in sj:
        continue
      else:
        sj.add(s[j])
        sk = set()
        for k in range(j+1, n):
          if k in sk:
            continue
          else:
            sk.add(s[k])
       	    tmp.add(s[i] + s[j] + s[k])
print(len(tmp))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
     
int main(){
	ios::sync_with_stdio(false);

	char n[6];

	for(int i = 0; i <= 6; i++){
		cin >> n[i];
        //std::cerr << n[i] << std::endl;
	}

	if(n[0] == n[5] && n[1] == n[4] && n[2] == n[3]){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def solve(n, a, b):
    l = (n+1)//2 - 1
    r = l + 1 + (n%2==0)
    lb = sum(sorted(a)[l:r])
    ub = sum(sorted(b)[l:r])
    return (ub - lb) + 1

n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
print(solve(n, a, b))

Measured memory_bytes: 26900
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(ord('a') + i)
        if c in S: continue
        print(S + c)
        exit()

cset = set()
for i,(a,b) in enumerate(reversed(list(zip(S,S[1:])))):
    cset.add(b)
    if a < b:
        last = 'z'
        for c in cset:
            if c < a: continue
            last = min(last, c)
        print(S[:-i-2] + last)
        exit()
print(-1)

Measured memory_bytes: 3064
import Control.Applicative ((<$>))
import Data.List (sort,group)

main = do
  _ <- read <$> getLine :: IO Int
  as <- group.sort.map read.words <$> getLine :: IO [[Int]]
  let evenCnt = length $ filter even $ map length as
  print $ if even evenCnt then length as else length as - 1


Measured memory_bytes: 32124
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string S;
    while(true){
    cin>>S;
    if(S=="-"){
        break;
    }
    int m;
    int len=S.size();
    cin>>m;
    int h[m];
    for(int i=0;i<m;i++){
        cin>>h[i];
    }
    string ans="";
    for(int i=0;i<m;i++){
        ans="";
        for(int k=h[i];k<len;k++){
            ans=ans+S[k];
        }
        for(int k=0;k<h[i];k++){
            ans=ans+S[k];
        }
        S=ans;
    }
    cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3128