akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;


int main(void){
    vector<pair<ll,pair<int,int>>> ans; //<x, < a,b >> xの答えはa,b
    vector<ll> fifth;
    fifth.push_back(zero);
    
    
    for(ll i = 1; i < 200; i++){
        fifth.push_back(i*i*i*i*i);
    }
    for(int i = 1; i <= 199; i++){
        for(int j = 0; j < i; j++){
            ans.push_back(make_pair( fifth.at(i) - fifth.at(j) , make_pair(i, j) ));
        }
        for(int j = -1; j >= (-1)*i; j--){
            ans.push_back(make_pair( fifth.at(i) + fifth.at((-1)*j) , make_pair(i, j) ));
        }
    }
    
    ll X;
    cin >> X;
    for(pair<ll,pair<int, int>> i : ans){
        if(i.first == X){
            printf("%d %d\n", i.second.first, i.second.second);
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 4128
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
#define FIN freopen("in.txt", "r", stdin);
const int MAXN = 1e5+5;
ll a[MAXN];
int main()
{
    //FIN;
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n ,x ;
    cin >> n >> x;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll ans = 0;
    for(int i = 1; i < n; i++)
    {
        int tmp  = a[i] + a[i-1] - x;
        if(tmp > 0)
        {
            if(tmp > a[i])
            {
                a[i] = 0;
                ans += tmp;
            }
            else
            {
                a[i] -= tmp;
                ans += tmp;
            }
        }

    }
    
    cout << ans << endl;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.buffer.readline

n = int(input())
ab = [list(map(int,input().split())) for i in range(n)]
ab = sorted(ab, key=lambda x:(x[1], x[0]))

t = 0
for i in range(n):
    t += ab[i][0]
    if t > ab[i][1]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 61400
using System;
using static System.Console;
using System.Linq;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
          int[] h = ReadLine().Split(' ').Select(int.Parse).ToArray();
          int[] a = ReadLine().Split(' ').Select(int.Parse).ToArray();
          int ans = h[0];
          for(int i = 0; i < h[1]; i++){
              ans -= a[i];
              if(ans <= 0){
                  WriteLine("Yes");
                  return;
              }
          }
          WriteLine("No");
      }
   }
}

Measured memory_bytes: 20064
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,m,k,x;
vector<ll>v;
int32_t main(){
CODE_START;
cin>>n;
cin>>k;
for(ll i=0;i<k;i++){
        cin>>x;
    v.pb(x);
}
sort(v.begin(),v.end());
for(ll i=n;i<=mod;i++)
{
    m=i;
    x=-1;
    while(m){
        for(ll j=0;j<k;j++)
            if(m%10==v[j]){
                x=1;
                break;
                break;
            }
            m=m/10;
    }
    if(x==-1){
        rc(i);
    }
}
return 0;}


Measured memory_bytes: 256
n=int(1.0e+18)
x,y=map(int,input().split(' '))
X = n//x
if x%y==0:
    print('-1')
else:
    i=2
    while i < X:
        if (x*i)%y!=0:
            print(str(x*i))
            break
        i+=1
    if i >= X:
        print('-1')

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

#define _DEBUG
#define ll long long
#define ld long double
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i = (a); (s) > 0 ? i < (b) : i > (b); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
    F_ORC(__VA_ARGS__) \
    (__VA_ARGS__)
#define EACH(x, a) for (auto &x : a)

template <class A>
void read(vt<A> &v);
template <class A, size_t S>
void read(ar<A, S> &a);
template <class T>
void read(T &x)
{
    cin >> x;
}
void read(double &d)
{
    string t;
    read(t);
    d = stod(t);
}
void read(long double &d)
{
    string t;
    read(t);
    d = stold(t);
}
template <class H, class... T>
void read(H &h, T &... t)
{
    read(h);
    read(t...);
}
template <class A>
void read(vt<A> &x)
{
    EACH(a, x)
    read(a);
}
template <class A, size_t S>
void read(array<A, S> &x)
{
    EACH(a, x)
    read(a);
}

string to_string(char c)
{
    return string(1, c);
}
string to_string(bool b)
{
    return b ? "true" : "false";
}
string to_string(const char *s)
{
    return string(s);
}
string to_string(string s)
{
    return s;
}
string to_string(vt<bool> v)
{
    string res;
    FOR(sz(v))
    res += char('0' + v[i]);
    return res;
}

template <size_t S>
string to_string(bitset<S> b)
{
    string res;
    FOR(S)
    res += char('0' + b[i]);
    return res;
}
template <class T>
string to_string(T v)
{
    bool f = 1;
    string res;
    EACH(x, v)
    {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template <class A>
void write(A x)
{
    cout << to_string(x);
}
template <class H, class... T>
void write(const H &h, const T &... t)
{
    write(h);
    write(t...);
}
void print()
{
    write("\n");
}
template <class H, class... T>
void print(const H &h, const T &... t)
{
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

void DBG()
{
    cerr << "]" << endl;
}
template <class H, class... T>
void DBG(H h, T... t)
{
    cerr << to_string(h);
    if (sizeof...(t))
        cerr << ", ";
    DBG(t...);
}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

void solve()
{
    int n;
    read(n);
    vt<int> ar(n);
    read(ar);
    sort(all(ar));
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n;j++)
        {
            for (int k = j + 1; k < n;k++)
            {
                if(ar[i]==ar[j]||ar[j]==ar[k]||ar[k]==ar[i])
                    continue;
                if(ar[i]+ar[j]>ar[k])
                    cnt++;
            }
        }
    }
    cout << cnt << "\n";
}

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

    int t = 1;
    //read(t);
    FOR(t)
    {
        solve();
    }
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
using namespace std;

int n;

struct S {
	char f[5][5];
	int x, y;
};

int conv(S s) {
	int ret = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(s.f[i][j] == '#') ret |= 1 << (i * n + j);
		}
	}
	return (((ret * n) + s.y)) * n + s.x;
}

bool isFree(S s) {
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(s.f[i][j] == '#') return false;
		}
	}
	return true;
}

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

bool in(int x, int y) {
	return 0 <= x && x < n && 0 <= y && y < n;
}

S simulate(S s) {
	S ns = s;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(i == s.y && j == s.x) continue;
			int cnt = 0;
			for(int k = 0; k < 8; k++) {
				int x = j + dx[k];
				int y = i + dy[k];
				if(!in(x, y)) continue;
				if(s.f[y][x] == '#' || (x == s.x && y == s.y)) cnt++;
			}
			if(s.f[i][j] == '#' && (cnt == 2 || cnt == 3)) ns.f[i][j] = '#';
			else if(s.f[i][j] == '.' && cnt == 3) ns.f[i][j] = '#';
			else ns.f[i][j] = '.';
		}
	}
	return ns;
}

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

	while(cin >> n, n) {
		S s;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				cin >> s.f[i][j];
				if(s.f[i][j] == '@') {
					s.y = i, s.x = j;
					s.f[i][j] = '.';
				}
			}
		}

		int ans = -1;
		unordered_map<int, int> m;
		queue<S> q;
		q.push(s);
		m[conv(s)] = 0;
		while(q.size()) {
			s = q.front();
			q.pop();
			int c = m[conv(s)];
			if(isFree(s)) {
				ans = c;
				break;
			}
			for(int k = 0; k < 8; k++) {
				S ns = s;
				ns.x = s.x + dx[k];
				ns.y = s.y + dy[k];
				if(!in(ns.x, ns.y)) continue;
				if(s.f[ns.y][ns.x] == '#') continue;
				ns = simulate(ns);
				int X = conv(ns);
				if(m.count(X)) continue;
				m[X] = c + 1;
				q.push(ns);
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 4460
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static long[] a;
    static long[] b;
    static long[] diff;
    static long start;
    static long end;


    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        b = Console.ReadLine().Split().Select(long.Parse).ToArray();

        diff = new long[n];
        for (int i = 0; i < n; i++)
        {
            diff[i] = a[i] - b[i];
        }

        Array.Sort(diff);

        long[] tmp = new long[n];
        Array.Copy(diff, tmp, n);

        start = 0;
        end = n - 1;
        long ans = 0;
        if (a.Sum() < b.Sum())
        {
            ans = - 1;
        }
        else
        {
            while (true)
            {
                if (diff[start] < 0)
                {
                    //再帰関数
                    F();
                    start++;
                }
                else
                {
                    break;
                }
            }

            for (int i = 0; i < n; i++)
            {
                if (tmp[i] != diff[i]) ans++;
            }
        }
        // 出力
        Console.WriteLine(ans);
    }
    static void F()
    {
        if (diff[start] * -1 <= diff[end])
        {
            diff[end] = diff[end] + diff[start];
            diff[start] = 0;
        }
        else
        {
            diff[start] = diff[end] + diff[start];
            diff[end] = 0;
            end--;
            F();
        }
    }
}

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

int main(){
	long long n;
	cin>>n;
	long long count = 0;
	for(long long i=1;i<=n/2;i++){
		long long j = n-i;
		if(i!=j){
			count++;
		}
	}
	cout<<count;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a, b, k, x, y;
int main() {
	int i;
	cin>>a>>b>>k;
	x = min(a+k, b);
	for(i=a; i<x; i++) cout<<i<<endl;
	y = max(x, b-k+1);
	for(i=y; i<=b; i++) cout<<i<<endl;
	return 0;
}

Measured memory_bytes: 256
coin = [500, 100, 50, 10, 5, 1]

def change( price ):
    result = 0
    for c in coin:
        result += price/c
        price -= price/c*c
    return result

while True:
    p = int(raw_input())
    if p == 0: break
    print change( 1000 - p )

Measured memory_bytes: 4200
#include <bits/stdc++.h>
// #include <atcoder/all>
// #include <atcoder/dsu>
#include <cstdio>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

namespace atcoder {
// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};
}  // namespace atcoder
// using namespace atcoder;

int main() {
	int n, m; cin >> n >> m;
	atcoder::dsu d(n + 4);
	REP(i, m) {
		int u, v; cin >> u >> v;
		d.merge(u, v);
	}

	set<int> l;
	REP(i, n)
		l.insert(d.leader(i+1));
	cout << l.size() - 1 << '\n';
	return 0;
}

Measured memory_bytes: 7436
#include<bits/stdc++.h>
#define ll long long
#define Vi vector<vector<int>>
#define Vl vector<vector<ll>>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define mod 1000000007
using namespace std;
int main(){
	int n;
	cin>>n;
	double res=0;
	while(n--){
		double money;
		string currency;
		cin>>money>>currency;
		if(currency=="JPY"){
			res+=money;
		}else{
			res+=(money*380000.0);
		}
	}
	cout<<setprecision(14)<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pi 2*acos(0.0)
#define mod 998244353

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

    ll a, b;
    cin >> a >> b;

    if(a>8 || b>8){
        cout << ":(\n";
    }
    else{
        cout << "Yay!\n";
    }

    return 0;
}

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



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

	int N; cin >> N;
	float a = N / 2;
	if (N % 2 == 1)cout << (a + 1) / (float)N;
	else cout << 1.0 / 2;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
ls = [0]*8
now = 0
for i in range(N):
  if 3200 <= A[i]:
    now += 1
  else:
    ls[A[i]//400] += 1
if 8-ls.count(0) >= 1:
  minimum = 8-ls.count(0)
else:
  minimum = 1
print(minimum,8-ls.count(0)+now)

Measured memory_bytes: 3064
#include<stack>
#include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<string>
#include<algorithm>
#define rep(i,n) for(int i=0;(int) (n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
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; }
using namespace std;
int main(){
  int n,p;
  string s;
  ll acm=0,ans=0,digit=1;
  cin >> n >> p >> s;
  reverse(s.begin(),s.end());
  if(p==2 || p==5){
    for(ll i=0;i<n;i++){
      if ((s[i]-'0')%p==0) ans+=n-i;
    }
  }
  else{
  map<int,ll> m;
  m[0]=1;
  for(auto str:s){
    acm+=(str-'0')*digit;
    acm%=p;
    m[acm]++;
    digit*=10;
    digit%=p;
  }
  for(auto i=m.begin();i!=m.end();i++){
    ans+=i->second*(i->second-1)/2;
  }
}
  cout << ans << endl;
  return 0;
}

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

int main(){
    int number;
    char str[21];
    cin >> str;
    for(int i=0;i<21;i++){
        if(str[i]=='\0')
            number=i;
    }
    char reverse[number+1];
    for(int i=0;i<number;i++){
        reverse[i]=str[number-1-i];
    }
    for(int i=0;i<number;i++){
        cout << reverse[i];
    }
    cout << endl;
}

Measured memory_bytes: 1132
import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
        int[] v = new int[n];
        int[] c = new int[n];
      
      	for(int i=0;i<n;i++){
        	v[i] = scan.nextInt();
        }
      	for(int i=0;i<n;i++){
        	c[i] = scan.nextInt();
        }
      	
      	int ans=0;
      	for(int i=0;i<n;i++){
        	if(v[i]-c[i]>0){
            	ans = ans+v[i]-c[i];
            }
        }
      	System.out.println(ans);
      
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> t(N);
  rep(i, N) cin >> t[i];

  int ans = 0;
  int x = 0, y = 0;
  rep(i, N) {
    if (x <= t[i] && t[i] <= y) {
      ans += T - (y - t[i]);
    } else {
      ans += T;
    }
    x = t[i];
    y = t[i] + T;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
s = input()
l = len(s)

black = ""

for i in range(l):
  if i%2 == 0:
    black = black + "0"
  else:
    black = black + "1"

bswap = 0
wswap = 0

for i in range(l):
  if s[i] != black[i]:
    bswap += 1
  else:
    wswap += 1
print(min(bswap,wswap))


Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#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(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y; cin >> x >> y;
	int ans(INF);
	rep(i, 0, 2)rep(j, 0, 2) {
		int X, Y;
		if (i)X = -x;
		else X = x;
		if (j)Y = -y;
		else Y = y;
		if (X <= Y)chmin(ans, Y - X+i+j);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
dic = {}
nums = []
for i in range(N):
    num = int(input())
    dic[num] = i+1
    nums.append(num)
ans = 0
l = 0
for i in range(N-1):
    if dic[i+2] < dic[i+1]:
        ans = max(ans, l)
        l = 0
    else:
        l += 1
ans = max(ans, l)
print(N-ans-1)

Measured memory_bytes: 33940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx, dy;
    dx = x2-x1;
    dy = y2-y1;

    cout << x2-dy << endl;
    cout << y2+dx << endl;
    cout << x1-dy << endl;
    cout << y1+dx << endl;
}

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

typedef long long ll;
typedef long double ld;

const int N=5e5+10;

vector<char> ans;

int main(){
    //freopen("a.txt", "r", stdin);
    //freopen("answers.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    for(int i=0;i<(1<<4);i++){
        int sum=0;
        for(int j=0;j<4;j++){
            if(ans.size()!=0){
                if(ans.back()=='+')
                    sum+=(s[j]-'0');
                else
                    sum-=(s[j]-'0');
            }
            else{
                sum+=(s[j]-'0');
            }
            ans.push_back(s[j]);
            if(i&(1<<j)){
                ans.push_back('+');
            }
            else{
                ans.push_back('-');
            }
        }
        if(sum==7){
            for(int i=0;i<7;i++)
                cout<<ans[i];
            cout<<"="; cout<<"7";
            cout<<endl;
            break;
        }
        ans.clear();
    }




    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
void solve(){
   int n;
   cin>>n;
   int r = n%10;
   if(r==2 || r ==4|| r==5||r==7||r==9){
       cout<<"hon\n";
   }else if(r==0||r==1||r==6||r==8){
       cout<<"pon\n";
   }else{
       cout<<"bon\n";
   }
}
int main(){
    int t;
    t = 1;
    while(t--) solve();
    return 0;
}

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

using namespace std;

int main() {
    double a, b, c, d;
    cin >> a >> b >> c;

    double ans;
    if (a * a * b / 2 < c) {
        d = (b - c / (a * a)) * 2;
        ans = atan(d / a) * 180.0 / M_PI;
    } else {
        d = (c / (a * b)) * 2;
        ans = 90.0 - atan(d / b) * 180.0 / M_PI;
    }

    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main() {
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	if (a == b && a != c) printf("%d\n", c);
	if (a != b && a == c) printf("%d\n", b);
	if (a != b && a != c) printf("%d\n", a);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  ll n;cin>>n;
  vector<ll> a(n);
  ll x=0;
  rep(i,n){
    cin>>a[i];
    x=x^a[i]; 
  }
  rep(i,n){
    ll y=x^a[i];
    cout<<y<<" ";
  }
  
}

Measured memory_bytes: 4836
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    int K = Integer.parseInt(sc.next());
    int X = Integer.parseInt(sc.next());
    
    int A = X - (K-1);
    int B = X + (K-1);
    for(int i = A; i <= B; i++){
      if(i == B){
        System.out.println(i);
      }else{
        System.out.print(i);
        System.out.print(" ");
      }
    }
  }
}

Measured memory_bytes: 21844
n = int(input())
grid = [[0 for i in range(10)] for j in range(10)]
for i in range(1,n+1):
    s = str(i)
    a,b = int(s[0]), i % 10
    grid[a][b] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += grid[i][j] * grid[j][i]
print(ans)

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

int main() {
  int N;
  cin >> N;
  for (int i = N; i > 0; i--) {
    double a = sqrt(i);
    if (ceil(a) == floor(a)) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

char S[12];

int main(){
	scanf("%s", S);
	if(S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I') puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
// Gracias, Rodolfo
// Gracias, MarcosK
// Gracias, Graphter
// Obrigado, Dilson
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for (Long i = a; i < b; i++)
#define roF(i,a,b) for (Long i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef long long Long;
typedef long double Double;
typedef unsigned long long ULong;
typedef pair<Long, Long> Pair;
typedef vector<Long> Vector;
typedef vector<Pair> PairVector;

const int N = 1e6;
const Long INF = 1e18;
const Double EPS = 10e-9;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
Long random(Long a, Long b) { return uniform_int_distribution<Long> (a, b) (rng); }

void solve() {
	Long a, b;
	cin >> a >> b;
	Long g = __gcd(a, b);
	vector<Long> div;
	for (Long i = 2; i * i <= g; i++) {
		if (g % i == 0) {
			div.push_back(i);
			while (g % i == 0) g /= i;
		}
	}
	if (g > 1) div.push_back(g);
	div.push_back(1);
	cout << div.size() << endl;
}

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

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		   
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			
			System.out.println(a * b - a - b + 1);
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> count(10,0);
  int a;
  rep(i,n){
    cin>>a;
    a=a/400;
    bool flg=true;
    rep(j,8){
      if(j==a){
        count[j]++;
        flg=false;
      }
    }
    if(flg){
      count[8]++;
    }
  }
  int sum=0;
  rep(i,8){
    if(count[i]>0){
      sum++;
    }
  }
  if(sum==0){
    cout<<1<<' ';
  }
  else{
    cout<<sum<<' ';
  }
  sum+=count[8];
  cout<<sum<<'\n';
  return(0);
}


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

const long long mod = 1000000007;

int main() {
    long long n, k; cin >> n >> k;
    long long ans = 0;
    for (long long i = k; i <= n+1; i++) {
        long long minimum = i*(i-1)/2; // 下からi個
        long long maximum = (n + (n-i+1)) * i / 2; // 上からi個
        ans = (ans + (maximum - minimum + 1)) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
N, K = map(int, input().split())
D = list(map(int, input().split()))

N_list = list(str(N))
flag = True
cnt = 0

while True:
    N_list = list(str(N+cnt))
    if flag:
        for j, n in enumerate(N_list):
            if int(n) in D:
                cnt += 1
                break
            elif j==len(N_list)-1:
                flag = False
    else:
        break
print(N+cnt)

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

using namespace std;

int main() {
  
  int n,i,l,j,k,p;

cin>>n>>k;
map<int,int>m;
for(i=0;i<k;i++)
{
   cin>>l;
   m[l]++;
}
while(1)
{p=n;
 while(p)
 {
     if(m[p%10])break;
     p/=10;
 }
 if(p==0)
 {
     cout<<n;return 0;
 }
  n++; 
}
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;

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

    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }

    map<int,int> mp;
    ll ans = 0;

    rep(i,n){
        ans += mp[i-a[i]];
        mp[i+a[i]]++;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 21788
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, sum, p;
  sum, p = 0;
  cin >> N;
  bool even = true;
  vector<int> a(200);
  for (int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  while(even) {
    for (int k = 0; k < N; k++){
      if (a.at(k) % 2 != 0){
        even = false;
        break;
      }
      a.at(k) /= 2;
    }
    sum++;
  }
  cout << sum -1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] A = new int[n][m];
        int[] b = new int[m];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                A[i][j] = sc.nextInt();
            }
        }
        for(int i = 0; i < m; i++){
            b[i] = sc.nextInt();
        }
        for(int i = 0; i < n; i++){
            int sum = 0;
            for(int j = 0; j < m; j++){
                sum += A[i][j] * b[j];
            }
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 40496
//
// Created by yamunaku on 2020/06/28.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int d;
vi c;
mti s;
vi sched;
vector<set<int>> last;
int score = 0;

int init_score(){
    int score = 0;
    rep(t, d){
        int x = sched[t];
        last[x].insert(t);
        score += s[t][x];
        rep(i, 26){
            score -= c[i] * (t - (*last[i].rbegin()));
        }
    }
    return score;
}

inline int sub(int d){
    return d * (d - 1) / 2;
}

int del_score(int day, int to){
    int from = sched[day];
    int del = s[day][to] - s[day][from];
    last[from].erase(day);
    int froml, fromr, tol, tor;
    auto itr = last[from].upper_bound(day);
    fromr = *itr;
    itr--;
    froml = *itr;
    del += c[from] * (sub(day - froml) + sub(fromr - day) - sub(fromr - froml));
    itr = last[to].upper_bound(day);
    tor = *itr;
    itr--;
    tol = *itr;
    del += c[to] * (-sub(day - tol) - sub(tor - day) + sub(tor - tol));
    last[to].insert(day);
    sched[day] = to;
    return del;
}

int main(){
    //CFS;
    cin >> d;
    c = vi(26);
    s = mti(d, vi(26));
    rep(i, 26) cin >> c[i];
    rep(i, d){
        rep(j, 26) cin >> s[i][j];
    }
    sched = vi(d);
    rep(i, d) cin >> sched[i], sched[i]--;
    last = vector<set<int>>(26);
    rep(i, 26) last[i].insert(-1);
    score = init_score();
    rep(i, 26) last[i].insert(d);
    int q;
    cin >> q;
    rep(t, q){
        int day, to;
        cin >> day >> to;
        day--, to--;
        score += del_score(day, to);
        cout << score << endl;
    }
    return 0;
}

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

int n;
vector<vector<vector<double>>> dp;

double getDP(int c1, int c2, int c3) {
	if(c1 < 0 || c2 < 0 || c3 < 0 || c1 + c2 + c3 > n)
		return 0;
	if(c1 == 0 && c2 == 0 && c3 == 0)
		return 0;
	if(dp[c1][c2][c3] != 0)
		return dp[c1][c2][c3];

	return dp[c1][c2][c3] = 1.0 * (
		n
	  + c1 * getDP(c1 - 1, c2, c3)
	  + c2 * getDP(c1 + 1, c2 - 1, c3)
	  + c3 * getDP(c1, c2 + 1, c3 - 1)
	) / (c1 + c2 + c3);
}

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

	cin >> n;
	vector<int> cnt(4);
	for(int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		++cnt[x];
	}

	dp.resize(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1))); // EV of state (cnt1, cnt2, cnt3)

	cout << fixed << setprecision(10);
	cout << getDP(cnt[1], cnt[2], cnt[3]) << '\n';
}



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

const int maxn = 5050;
int n, k, cnt, arr[maxn], loga[maxn][maxn];
bitset<maxn> dp[2][maxn], b;

void update(int i, int j, int v){
	for(j++; j < maxn; j += j & -j)
		loga[i][j] += v;
}

int query(int i, int j){
	if(j < 0) return 0;
	int ret = 0;
	for(j++; j > 0; j -= j & -j)
		ret += loga[i][j];
	return ret;
}

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

	dp[0][0][0] = true;
	dp[1][n + 1][0] = true;

	for(int i = 1; i <= n; i++){
		cin >> arr[i];
		dp[0][i] = dp[0][i - 1] | (dp[0][i - 1] << arr[i]);
	}

	for(int i = n; i >= 1; i--){
		dp[1][i] = dp[1][i + 1] | (dp[1][i + 1] << arr[i]);

		for(int j = 0; j <= k; j++){
			if(dp[1][i][j]){
				update(i, j, 1);
			}
		}
	}

	update(n + 1, 0, 1);

	for(int i = 1; i <= n; i++){
		if(arr[i] < k){
			cnt++;

			for(int j = 0; j <= k; j++){
				if(dp[0][i - 1][j]){
					if(query(i + 1, k - 1 - j) - query(i + 1, k - arr[i] - j - 1)){
						cnt--;
						break;
					}
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 105216
#include <stdio.h>
int main(){
	int i, x, n, ans, pp, p[102] = {};
	scanf("%d %d", &x, &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &pp);
		p[pp] = 1;
	}
	for (i = 0; i <= 100; i++) {
		if (p[x-i] == 0) {
			ans=x - i;
			break;
		} else if (p[x+i] == 0) {
			ans=x + i;
			break;
		}
    }
    printf("%d",ans);  
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

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

    //int a[n];
    std::map<int,int> a;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        std::size_t res = a.count(tmp);
        if(res > 0){
            cout << "NO" << endl;
            return 0;
        }
        a[tmp] = 0;
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 9600
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])


Measured memory_bytes: 147376
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
    char a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    cout<<a[0][0]<<a[1][1]<<a[2][2]<<endl;
}


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

template <typename T>
using lim = numeric_limits<T>;

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

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	bool tak = true;
	while(a > 0 && c > 0){
		if (tak) c -= b;
		else a -= d;
		tak = !tak;
	}

	cout << (a > 0 ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n;
    cin >> n;
    REP(i,30)REP(j,30){
        if(4*i+7*j==n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main() {
	ll h = in(), w = in();
	vector<vector<ll>>c(10, vector<ll>(10));
	REP(i, 10) {
		REP(j, 10) {
			c[i][j] = in();
		}
	}
	vector<vector<ll>>a(h, vector<ll>(w));
	REP(i, h) {
		REP(j, w) {
			a[i][j] = in();
		}
	}
	REP(k, 10) {
		REP(i, 10) {
			REP(j, 10) {
				c[i][j] = min(c[i][k] + c[k][j], c[i][j]);
			}
		}
	}
	ll ans = 0;
	REPC(i, a) {
		REPC(j, i) {
			if (j == -1) {
				continue;
			}
			ans += c[j][1];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    ll a, b, c; cin>>a>>b>>c;
    ll sum=0;
    bool poison=false;
    while(1){
        if(!poison && c>0){
            c--;
            sum++;
            poison=true;
        }

        if(poison && b>0){
            b--;
            poison=false;
            sum++;
        }

        if(poison && a>0){
            a--;
            poison=false;
        }

        if(poison && a==0 && b==0){
            break;
        }

        if(c==0){
            sum+=b;
            break;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
Option Strict On
Module Module1

    Sub Main()
        Dim l() As String = Split(Console.ReadLine())
        Dim a As Integer = Convert.ToInt32(l(0))
        Dim b As Integer = Convert.ToInt32(l(1))
        Dim c As Integer = Convert.ToInt32(l(2))
        If a < c And c < b Or a > c And c > b Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If
        Console.ReadLine()
    End Sub

End Module

Measured memory_bytes: 13536
import collections

h,w,m = map(int,input().split())

gyou = [0 for i in range(h)]
retu = [0 for i in range(w)]
l = []

for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    l.append((y-1,x-1))

ymax = max(gyou)
xmax = max(retu)
c_ymax = gyou.count(ymax)
c_xmax = retu.count(xmax)
ans = ymax + xmax

c = 0
for y,x in l:
    if gyou[y] == ymax and retu[x] == xmax:
        c += 1

if c == c_ymax*c_xmax:
    print(ans-1)
else:
    print(ans)

Measured memory_bytes: 117452
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String[] f = new String[n];
		Arrays.fill(f, "");
		int[][] p = new int[n][11];
		for(int i=0;i<n;i++) {
			for(int j=0;j<10;j++) {
				f[i] += sc.nextInt();
			}
		}
		
		for(int i=0;i<n;i++) {
			for(int j=0;j<11;j++) {
				p[i][j] = sc.nextInt();
			}
		}
		
		
		int max = Integer.MIN_VALUE;
		for(int i=1;i<1024;i++) {
			String s = Integer.toString(i, 2);
			while(s.length()<10) {
				s = "0" + s;
			}
			
			int profit = 0;
			for(int j=0;j<n;j++) {
				int c = 0;
				for(int k=0;k<10;k++) {
					if(s.charAt(k)=='1' && f[j].charAt(k)=='1')
						c++;
				}
				profit+=p[j][c];
			}
			
			if(profit>max) {
				max = profit;
			}
		}
		
		System.out.println(max);
	}
}


Measured memory_bytes: 26012
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

#define MAX_SIZE (200001)
#define debug(x) (cout << # x ": " << x << endl)
#define ll long long int
#define repeat(n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()

vector<string> ans;
int n, a, b, c;

void move(int from, int dest) {
    if (from == 0) {
        --a;
    } else if (from == 1) {
        --b;
    } else {
        --c;
    }
    if (dest == 0) {
        ++a;
        ans.push_back("A");
    } else if (dest == 1) {
        ++b;
        ans.push_back("B");
    } else {
        ++c;
        ans.push_back("C");
    }
    // debug(a); debug(b); debug(c);
}

bool solve() {
    string s;
    cin >> s;
    repeat(n - 1) {
        string next;
        cin >> next;

        if (s == "AB") {
            if (a == 0 && b == 0) {
                return false;
            } else if (next == "BC" && a != 0) {
                move(0, 1);
            } else if (next == "AC" && b != 0)  {
                move(1, 0);
            } else if (a > b) {
                move(0, 1);
            } else {
                move(1, 0);
            }
        } else if (s == "BC") {
            if (b == 0 && c == 0) {
                return false;
            } else if (next == "AB" && c != 0) {
                move(2, 1);
            } else if (next == "AC" && b != 0)  {
                move(1, 2);
            } else if (b >= c) {
                move(1, 2);
            } else {
                move(2, 1);
            }
        } else if (s == "AC") {
            if (a == 0 && c == 0) {
                return false;
            } else if (next == "BC" && a != 0) {
                move(0, 2);
            } else if (next == "AB" && c != 0)  {
                move(2, 0);
            } else if (a >= c) {
                move(0, 2);
            } else {
                move(2, 0);
            }
        }

        s = next;
    }

    if (s == "AB") {
        if (a == 0 && b == 0) {
            return false;
        } else if (a > b) {
            move(0, 1);
        } else {
            move(1, 0);
        }
    } else if (s == "BC") {
        if (b == 0 && c == 0) {
            return false;
        } else if (b >= c) {
            move(1, 2);
        } else {
            move(2, 1);
        }
    } else if (s == "AC") {
        if (a == 0 && c == 0) {
            return false;
        } else if (a >= c) {
            move(0, 2);
        } else {
            move(2, 0);
        }
    }

    return true;
}

int main() {
    cin >> n >> a >> b >> c;
    if (solve()) {
        cout << "Yes";
        for (const auto& s: ans) {
            cout << endl << s;
        }
    } else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 5928
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        double[] v = new double[n];
        for(int i = 0; i < n; i++){
            v[i] = sc.nextDouble();
        }
        
        Arrays.sort(v);
        int a = 0;
        while(a < n-1){
            for(int i = a; i < n-1; i++){
                v[i+1] = (v[i] + v[i+1]) / 2;
                a++;
            }
        }
        System.out.println(v[n-1]);
    }
}

Measured memory_bytes: 25300
#include<iostream>
using namespace std;
int main()
{
	int a,b,e,c,d,f;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	b+=a*60;d+=c*60;
	cout<<d-b-e;
	return 0;
}

Measured memory_bytes: 3256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;
import std.bigint;

void main()
{
    foreach(_;0..readln().chomp().to!int())
    {
        auto s = iota(2).map!(_=>readln().chomp().to!BigInt()).reduce!"a+b"().to!string;
        if(s.length>80)
            s = "overflow";
        writeln(s);
    }
}

Measured memory_bytes: 1108
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

bool check(string s, int S, int T){
  int cnt = 0;
  for(int i = S; i <= T; i++){
    if(s[i] == '#') cnt++;
    else cnt = 0;

    if(cnt >= 2) return false;
  }

  return true;
}

int main(){
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--; B--; C--; D--;
  string s;
  cin >> s;

  if(D < C){
    int cnt = 0;
    bool ok = false;
    for(int i = B; i <= D; i++){
      if(s[i] == '.') cnt++;
      else cnt = 0;
      //cout << cnt << endl;
      if(cnt >= 3) ok = true;
    }

    if(s[B - 1] == '.' && s[B + 1] == '.') ok = true;
    if(s[D - 1] == '.' && s[D + 1] == '.') ok = true;

    //cout << p1 << p2 << q1 << q2 << endl;

    if(ok && check(s, A, C) && check(s, B, D)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  else{
    if(check(s, A, C) && check(s, B, D)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 900
a, b = map(int, input().split())
c = (b - 2*a)/2
d = (4*a-b)/2
if c + d == a and 4*c + 2*d == b and c % 1 == 0 and d % 1 == 0 and c>= 0 and d>= 0:
 print("Yes")
else :
 print("No")

Measured memory_bytes: 9108