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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    vi b = vi(a);
    sort(all(b));

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int idx = lower_bound(all(b), a[i]) - b.begin();
        if (idx % 2 != i % 2) ans++;
    }

    cout << ans / 2 << endl;

    return 0;
}


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

int main(){
  int N; cin >> N;
  int a[100001]={};
  for(int i=0; i<N; i++){
    cin >> a[i+1];
  }
  int res=0;
  for(int i=0; i<N; i++){
    if(a[a[i+1]]==i+1) res++;
  }
  cout << res/2 << endl;
}

Measured memory_bytes: 640
N=int(input())
A=[]
g=[[-1]*(N) for i in range(N)]#g[i][j]はi番目からのj番目に対する証言

for i in range(N):
    a=int(input())
    A.append(a)
    for j in range(a):
        x,y=map(int,input().split())
        x-=1
        g[i][x]=y
"""
num=[]
for i in range(2 **N):
  chars = list(f"{i:0{N}b}")
  chars=list(map(int,chars))
  num.append(chars)
"""
num=[]
for i in range(2**N):
    x=[]
    for j in range(N):
        if i>>j & 1:
            x.append(1)
        else:
            x.append(0)
    num.append(x)

ans=[]
for x in num:
    ok = True
    for k in range(N):#k番目の人
        if x[k]:
            for j in range(N):
                if g[k][j]==-1:
                    continue
                elif g[k][j]!=x[j]:
                    ok=False
    if ok:
        ans.append(x.count(1))
print(max(ans))

Measured memory_bytes: 12020
"use strict";

function main(input){
  const args = input.trim().split('\n');
  const n = parseInt(args[0],10);
  const mochi = args.slice(1).map(_=>parseInt(_,10));
  mochi.sort((a,b)=>a-b);
  
  const used = Array(100).fill(false);
  let cnt = 0;
  for(let i=0; i<n; i++){
	if(!used[mochi[i]-1]) cnt++;
    used[mochi[i]-1] = true;
  }
  
  console.log(cnt);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    string s; cin >> s;
    map<int, int> m; m[0] = 1;
    int a = 0; int res = 0; int p = 1;
    for(int i=s.size()-1; i>=0; i--) {
        a = (p * (s[i] - '0') + a) % 2019;
        res += m[a];
        p = p*10 % 2019;
        m[a]++;
    }
    cout << res << endl;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+10;
struct node
{
    ll b,l,r;
}a[maxn];
int n,x;
bool cmp(const node &A,const node &B)
{
    if(A.b*A.l+(x-A.b)*A.r!=B.b*B.l+(x-B.b)*B.r)
        return A.b*A.l+(x-A.b)*A.r>B.b*B.l+(x-B.b)*B.r;
    return A.r>B.r;

}
int main()
{
    ll sum=0;
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++)
        scanf("%lld%lld%lld",&a[i].b,&a[i].l,&a[i].r),sum+=a[i].b*a[i].l;
    sort(a+1,a+n+1,cmp);
    ll ans=0,score=0;
    for(int i=1;i<=n;i++)
    {
        ll cnt=a[i].b*a[i].l+(x-a[i].b)*a[i].r;
        score+=cnt;
        ll tt=ans;
        ans+=x;
        if(score>=sum)
        {
            while(i<n&&a[i].b*a[i].l+(x-a[i].b)*a[i].r==a[i+1].b*a[i+1].l+(x-a[i+1].b)*a[i+1].r)
                i++;
            ll mx=0;
            for(int j=i;j>=1;j--)
            {
                ll d=score-sum;
                ll tmp=0;
                if((x-a[j].b)*a[j].r>=d)
                    tmp=d/a[j].r,d=0;
                else
                    d-=(x-a[j].b)*a[j].r,tmp=x-a[j].b;
                tmp+=d/a[j].l;
                mx=max(mx,tmp);
            }
            ans-=mx;
            score-=cnt;
            for(int j=i+1;j<=n;j++)
            {
                ll d=sum-score;
                ll s=0;
                if(a[j].l*a[j].b>=d)
                {
                    s=(d+a[j].l-1)/a[j].l;
                }
                else
                {
                    s=a[j].b;
                    d-=a[j].l*a[j].b;
                    s+=(d+a[j].r-1)/a[j].r;
                }
                ans=min(ans,tt+s);
            }
            break;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))

a = inl()
b = inl()
c = inl()
n = ini()
bingo = []
for _ in range(n):
    bingo.append(ini())
ct = [0] * 9
for i in bingo:
    if i in a:
        ct[a.index(i)] = 1
    if i in b:
        ct[b.index(i) + 3] = 1
    if i in c:
        ct[c.index(i) + 6] = 1
if sum(ct[:3]) == 3 or sum(ct[3:6]) == 3 or sum(ct[6:9]) == 3:
    print("Yes")
elif (ct[0] + ct[4] + ct[8]) == 3 or (ct[2] + ct[4] + ct[6]) == 3:
    print("Yes")
elif (ct[0] + ct[3] + ct[6]) == 3 or (ct[1] + ct[4] + ct[7]) == 3 or (ct[2] + ct[5] + ct[8]) == 3:
    print("Yes")
else:
    print("No")    

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

using namespace std;

int main(){
	int N; cin >> N;
	for(int i = N; i >= 0; --i){
		int k = floor(sqrt(i));
		if((int)pow(k, 2) == i){
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	static int n, H;
	void doIt() {
		n = sc.nextInt();
		int[] x= new int[n];
		int[] y = new int[n];
		int[] h = new int[n];
		int pos = 0;
		for(int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			h[i] = sc.nextInt();
			if(h[i] > 0) pos = i;
		}

		for(int i = 0; i <= 100; i++) {
			for(int j = 0; j <= 100; j++) {
				if(solve(i, j, pos, x, y, h)) {
					System.out.println(i+" "+j+" "+H);
					return;
				}
			}
		}
	}
	boolean solve(int cx, int cy, int pos, int[] x, int[] y, int[] h) {
		int cand = h[pos] + Math.abs(x[pos] - cx) + Math.abs(y[pos] - cy);
		for(int i = 0; i < n; i++) {
			if(h[i] != Math.max(cand - Math.abs(x[i] - cx) - Math.abs(y[i] - cy), 0)) {
				return false;
			}
		}
		H = cand;
		return true;
	}
	Main(){doIt();}
	public static void main(String[] args) {
		new Main();
	}

}


Measured memory_bytes: 23892
K = int(input())
A = list(map(int, input().split()))


if K == 1:
    if A[0] == 2:
        print(2, 3)
    else:
        print(-1)
else:
    M = 2
    L = 2
    ok = True
    for i in range(K-1, -1, -1):
        a = A[i]
        nM = (M//a)*a
        if M%a != 0:
            nM += a
        nL = (L//a)*a + a - 1
        if nM >= M + a or nM > nL:
            ok = False
            break
        
        L, M = nL, nM
        #print(L, M, a, b)

    if not ok:
        print(-1)
    else:
        print(M, L)

Measured memory_bytes: 14400
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

struct AIB {
    int aib[100 * 1000 + 5];
    int n;

    AIB(int n) {
        this->n = n;
        memset(aib, 0, sizeof(aib));
    }

    void insert(int val) {
        while(val <= n) {
            aib[val] += 1;
            val += (val & (-val));
        }
    }

    int count(int val) {
        int ans = 0;
        while(val > 0) {
            ans += aib[val];
            val -= (val & (-val));
        }   
        return ans;
    }
};

vector<int> getOrder(vector<int> a, vector<int> b, vector<int> c, double x) {
    int n = a.size();
    vector<double> y(n, 0);

    for(int i = 0; i < n; ++i) {
        y[i] = (-c[i] - a[i] * x + 0.0) / b[i];
    }   

    vector<int> p;
    for(int i = 0; i < n; ++i)
        p.push_back(i);

    sort(p.begin(), p.end(), [&] (int a, int b) {
        return y[a] < y[b];
    });

    return p;
}

long long getInversions(vector<int> a, vector<int> p) {
    vector<int> aa = a;
    int n = a.size();
    vector<int> place(n, 0);
    for(int i = 0; i < n; ++i) {
        place[p[i]] = i;
    }
    for(int i = 0; i < n; ++i) {
        aa[i] = place[a[i]];
    }
        
    AIB T(n + 1);
    long long ans = 0;

    for(int i = 0; i < n; ++i) {
        ans += i - T.count(aa[i] + 1);
        T.insert(aa[i] + 1);
    }

    return ans;
}

int main() {
    ios_base :: sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n, 0), b(n, 0), c(n, 0);

    for(int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    long long total = 1LL * n * (n - 1) / 2;
        
    auto original = getOrder(a, b, c, -1e11);

    cout.precision(20);
    
    for(int it = 0; it < 2; ++it) {
        double ans = 0, lf = -1e9, rt = 1e9, mid = 0;
        for(int cnt = 0; cnt < 85; ++cnt) {
            mid = (lf + rt) * 0.5;
            auto now = getOrder(a, b, c, mid);
            long long many = getInversions(now, original);
            if(many <= total / 2) {
                ans = mid;
                lf = mid;
            } else {
                rt = mid;
            }
        }
        cout << -ans << " ";
        for(int i = 0; i < n; ++i) {
            swap(a[i], b[i]);
        }
        original = getOrder(a, b, c, -1e11);
    }
}

Measured memory_bytes: 2544
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int sl = s.length();
  int q;
  cin >> q;
  for(int i = 0; i < q; i++) {
    string x;
    cin >> x;
    if(x == "replace") {
      int a, b;
      cin >> a >> b;
      string p;
      cin >> p;
      for(int j = a; j < b + 1; j++)
        s[j] = p[j - a];
    }
    if(x == "reverse") {
      int a, b;
      cin >> a >> b;
      string p = s;
      for(int j = a; j < b + 1; j++) {
        s[j] = p[b - j + a];
      }
    }
    if(x == "print") {
      int a, b;
      cin >> a >> b;
      for(int j = a; j < b + 1; j++)
        cout << s[j];
      cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3216
#include<iostream>
using namespace std;
int main() {
	int n,num,c[5][14]={0};
	char a;
    cin>>n;
    for(int y=0;n>y;y++){
        cin>>a>>num;
		if(a=='S'){
			c[1][num]=1;
		}else if(a=='H'){
			c[2][num]=1;
		}else if(a=='C'){
			c[3][num]=1;
		}else{
			c[4][num]=1;
		}
	}
	for(int i=1;i<=4;i++){
		for(int j=1;j<=13;j++){
			if(c[i][j]==0){
				if(i==1){
					cout<<"S "<<j<<endl;
				}else if(i==2){
					cout<<"H "<<j<<endl;
				}else if(i==3){
					cout<<"C "<<j<<endl;
				}else{
					cout<<"D "<<j<<endl;
				}

			}
		}
	}

	return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	ll n; cin >> n;
	if (n % 2 == 0) cout << n << endl;
	else cout << n * 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second

using namespace std;

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

const int N = 1e5 + 10, N2 = 50;
double dp[N][N2];

const double EPS = 1e-3;

double p[N2];

double rec(int n, int i){
	if (n == 0) return 0;

	double &res = dp[n][i];
	if (res >= 0) return res;
	res = 0;
	if (i < N2 - 1) res += p[i] * (rec(n - 1, i + 1) + 1);
	res += (1 - p[i])*(rec(n - 1, 0));

	return res;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);

	p[0] = 1;
	rep(i, N2 - 1){
		p[i + 1] = p[i] * .5;
	}
	rep(i, N) rep(j, N2) dp[i][j] = -1;
	rep(i, 10) rec(i * 10000, 0);

	int n;
	while (cin >> n, n){
		cout << rec(n, 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 41232
#include <iostream>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <functional>
#include <climits>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i += 2) {
		int cnt = 0;
		for (int j = 1; j <= i; j++) {
			if (i%j == 0)cnt += 1;
		}
		if (cnt == 8)ans += 1;
	}
	cout << ans;
	return 0;
}



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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int x = input();

    cout << (x == 3 || x == 5 || x == 7 ? "YES" : "NO") << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n,p[100], k = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    for(int i = 1; i < n - 1; i++)
    {
        if((p[i] > p[i-1] && p[i] < p[i+1]) || (p[i] < p[i-1] && p[i] > p[i+1]))
            k++;
    }
    cout << k;
}

Measured memory_bytes: 3596
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;

template<class T>
using vec = std::vector<T>;

template<class T>
using vec2d = std::vector<std::vector<T>>;


template<class T>
vec2d<T> makeVec2d(const int n1, const int n2) {
  return vec2d<T>(n1, vec<T>(n2));
}


#define FOR(i, n) for (int i = 0; i < (n); ++i)


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


#define BCNT(x) __builtin_popcount(x)


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


template <class T>
inline T set_bit(T mask, int bit) {
    assert(0 <= bit && bit < numeric_limits<T>::digits);
    return mask | ((T)(1) << bit);
}


template <class T>
inline bool get_bit(T mask, int bit) {
    assert(0 <= bit && bit < numeric_limits<T>::digits);
    return mask & ((T)(1) << bit);
}


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


const int MOD = (int) 1e9 + 7;

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  vec2d<int> adj = makeVec2d<int>(n, n);
  FOR(i, n) {
    FOR(j, n) {
      adj[i][j] = next<int>(in);
    }
  }

  vec<int> f(1 << n);
  f[0] = 1;
  FOR(mask, 1 << n) {
    int i = BCNT(mask);
    FOR(j, n) {
      if (!get_bit(mask, j) && adj[i][j]) {
        f[set_bit(mask, j)] += f[mask];
        if (f[set_bit(mask, j)] >= MOD) {
          f[set_bit(mask, j)] -= MOD;
        }
      }
    }
  }
  out << f[(1 << n) - 1] << "\n";
}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for(int i = 0; i*R <= N; i++) {
        for(int j = 0; i*R+j*G <= N; j++) {
            if((N-i*R-j*G)%B == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3592
import math
h,w = map(int,input().split())
w1 = int(w/2)
h1 = int(h/2)
w2 = int(w/2)
h2 = int(h/2)
if ( w % 2 != 0 ):
  w1 += 1
if ( h % 2 != 0 ):
  h1 += 1
res = h1 * w1 + h2 * w2
if (h == 1 or w == 1):
  print(1)
else:
  print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;



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

	int n;
	cin >> n;
	vector<pair<string, pii> > r(n);
	forn(i, 0, n){
		cin >> r[i].F >> r[i].S.F;
		r[i].S.F *= -1;
		r[i].S.S = i+1;
	}
	sort(r.begin(), r.end());
	for(auto x: r){
		cout << x.S.S << endl;
	}


}



Measured memory_bytes: 3620
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    int ans = 0;
    rep(i, n) rep(j, n) {
        if (i == j) continue;
        ans += d[i] * d[j];
    }
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int n;
	int k;
	int d[10]={};
	int in;
	scanf("%d %d",&n,&k);
	for(int i=0;i<k;i++){
		scanf("%d",&in);
		d[in]=1;
	}
	int ans;
	for(ans=n;;ans++){
		int temp=ans,flag=0;
		while(temp>0){
			if(d[temp%10]){
				flag=1;
				break;
			}
			temp/=10;
		}
		if(!flag){
			cout<<ans<<endl;
			break;
		}
	}
	return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    int n=0;
    cin>>n;
    vector<double> v(n+1);
    for(int i=1;i<=n;i++) cin>>v[i];
    
    vector<vector<double>> dp(n+1,vector<double>(n+1,0));
    
    dp[1][0]=1.00-v[1];
    dp[1][1]=v[1];
    for(int i=2;i<=n;i++) dp[1][i]=0;
    
    for(int i=2;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(j==0) dp[i][0]=dp[i-1][0]*(1.00-v[i]);
            else
            {
                dp[i][j]+=dp[i-1][j]*(1.00-v[i]);
                dp[i][j]+=dp[i-1][j-1]*v[i];
            }
        }
    }
    
    
    double res=0.00;
    for(int i=(n/2)+1;i<=n;i++) res+=dp[n][i];
    cout<<fixed<<setprecision(10)<<res;
    return 0;
}

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

void replace(int& a, int& b)
{
    int temp = a;
    a = b;
    b = temp;
}

void sortValue(int a, int b, int c)
{
    if (a > c)  replace(a, c);  // ?????????. 
    if (a > b)  replace(a, b);
    if (b > c)  replace(b, c);

    cout << a << " " << b << " " << c << endl;
}

int main()
{
    int a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    sortValue(a, b, c);
    
    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();
		sc.close();
		if (n.equals(new StringBuilder().append(n).reverse().toString())) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<cstdio>
#include<map>
#include<iostream>
using namespace std;
const int MAXN = 2*int(1E5);
int fa1[MAXN + 5], fa2[MAXN + 5];
int Find1(int x) {
	if( fa1[x] == x ) return x;
	else return fa1[x] = Find1(fa1[x]);
}
int Find2(int x) {
	if( fa2[x] == x ) return x;
	else return fa2[x] = Find2(fa2[x]);
}
map<pair<int, int>, int> Map;
int main() {
	int N, K, L;
	scanf("%d%d%d", &N, &K, &L);
	for(int i=1;i<=N;i++)
		fa1[i] = fa2[i] = i;
	for(int i=1;i<=K;i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		int fx = Find1(u), fy = Find1(v);
		fa1[fx] = fy;
	}
	for(int i=1;i<=L;i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		int fx = Find2(u), fy = Find2(v);
		fa2[fx] = fy;
	}
	for(int i=1;i<=N;i++)
		Map[make_pair(Find1(i),Find2(i))]++;
	for(int i=1;i<N;i++)
		printf("%d ", Map[make_pair(Find1(i),Find2(i))]);
	printf("%d\n", Map[make_pair(Find1(N),Find2(N))]);
}

Measured memory_bytes: 13568
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        mkp             make_pair
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((int)(v).size())
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
using          dl         =      deque<ll> ;
const int N = 1e6+5 ;

ll      mod = 1e9+7 ;
vl      adj[N] ;
vpll    adjc[N] ;
ll      vis[N] ;
ll      arr[N] ;



int main()
{
    IOS;
    ll a, b, c, d, n, m, p, x, y, z, i, j, k, f = 0, tc, cnt = 0, sum = 0, mul = 1, mi = 1e18, ma = -1e18;
    string   str ;
    char     ch ;
    double   db ;
    ll       l, r ;
    //code
    ll t,s;
    cin>>d>>t>>s;
    x=s*t;
    if(x>=d)
       cout<<"Yes\n";
    else cout<<"No\n";

    //code
    return 0;
}



Measured memory_bytes: 50496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> V;
const long long MOD=1000000007LL;
const long long INFL=1LL << 60;
const int INF=1<<29;


int main() {
    int A,B;
    cin >>A>>B;
    if(A<6) cout<<0<<endl;
    else if(A<13)cout<<B/2<<endl;
    else cout<<B<<endl; 
    return 0;
}

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

typedef long long lint;

lint ans=0;
int a[200010],n;

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	int cur=0,end=0;
	for(int start=0;start<n;start++){
		while(end<n&&(cur&a[end])==0){
			cur^=a[end];end++;
		}
		ans+=end-start;
		cur^=a[start];
	}
	printf("%lld",ans);
	return 0;
}


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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve()
{
    ll n;
    cin >> n;
    for(ll i=1;i<=9;i++) {
    	if(n%i == 0) {
    		if(n/i <= 9) {
    			cout << "Yes\n";
    			return;
    		}
    	}
    }
    cout << "No\n";
}

int main()
{
    FAST_IO;
    // #ifndef ONLINE_JUDGE 
      // OC;
    // #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
using namespace std;


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

if(a>=3200){
  cout<<s<<endl;
}
else{
  cout<<"red"<<endl;
}


}


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

int main(){

        int W,H,x,y,r;

        cin >> W;
        cin >> H;
        cin >> x;
        cin >> y;
        cin >> r;

        if(((0 <= (x - r)) && (0 <= (y - r))) && (((x + r) <= W && (y + r) <= H))) {

        cout << "Yes" << endl;

        }

        else {

        cout << "No" << endl;

        }

        return 0;
}



Measured memory_bytes: 3088
#include <stdio.h>

int a[10010][10010];
int b[10010][10010];
long long int c[10010][10010]={0};
int main(){

  int n,m,l,i,j,k;

  scanf("%d %d %d",&n,&m,&l);

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%d",&b[i][j]);
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      for(k=0;k<l;k++){
        c[i][k]+=a[i][j]*b[j][k];
      }
    }
  }
  for(i=0;i<n;i++){
    for(k=0;k<l;k++){
      printf("%lld",c[i][k]);
      if(k!=l-1){
        printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 19164
#include <stdio.h>
#include <string.h>
int main(void){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(A-B>=C){
    printf("0\n");
  }
  else{
    printf("%d\n",C-A+B);
  }
  return 0;
}

Measured memory_bytes: 128
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

S = input()
ans = 0
for i in range(len(S)//2):
	if S[i] != S[len(S)-1-i]:
		ans += 1
print(ans)


Measured memory_bytes: 4336
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    string s;cin>>s;
    long long n = s.length();
    map<char, int> ma;
    long long res = 1;
    for(int i=0;i<n;++i){
        res += i - ma[s[i]];
        ma[s[i]]++;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[3 * N];
		for (int i = 0; i < 3 * N; i++) {
			A[i] = sc.nextLong();
		}
		long ans = -Long.MAX_VALUE;

		PriorityQueue<Long> quefront = new PriorityQueue<Long>(N + 1);
		PriorityQueue<Long> queback = new PriorityQueue<Long>(N + 1, new MyComparator());
		long front[] = new long[N];
		long back[] = new long[N];
		System.arraycopy(A, 0, front, 0, N);
		System.arraycopy(A, 2 * N, back, 0, N);
		long sumfront = 0;
		long sumback = 0;
		long tmp[][] = new long[N + 1][2];
		for (int i = 0; i < N; i++) {
			quefront.add(front[i]);
			queback.add(back[i]);
			sumfront += front[i];
			sumback += back[i];
		}
		tmp[0][0] = sumfront;
		tmp[N][1] = sumback;
		for (int i = N; i < 2 * N; i++) {
			sumfront += A[i];
			quefront.add(A[i]);
			sumfront -= (long) quefront.poll();
			tmp[i - N + 1][0] = sumfront;
		}
		for (int i = 2 * N - 1; i >= N; i--) {
			sumback += A[i];
			queback.add(A[i]);
			sumback -= (long) queback.poll();
			tmp[i - N][1] = sumback;
		}
		for (int i = 0; i < N + 1; i++) {
			ans = Math.max(ans, tmp[i][0] - tmp[i][1]);
		}
		System.out.println(ans);
	}
}

class MyComparator implements Comparator<Object> {

	public int compare(Object obj1, Object obj2) {

		long num1 = (long) obj1;
		long num2 = (long) obj2;

		if (num1 > num2) {
			return -1;
		} else if (num1 < num2) {
			return 1;
		} else {
			return 0;
		}
	}
}

Measured memory_bytes: 100836
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int timeline[200010];
int useline[200010]; // 使っていれば1
int neednum[200010] = {}; // その時間に求められる録画機の数（ラインの数）

void resetTimeline(){
    FOR(i, 0, 200010){
        timeline[i] = 0;
        useline[i] = 0;   
    }
}

void printArray(int *a, int num){
    FOR(i, 0, num){
        cout << a[i] << " ";
    }
    cout << endl;
}

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

    // input
    int N, channelNum;
    cin >> N >> channelNum;

    vector<int> S(N);
    vector<int> T(N);
    vector<int> C(N);

    // タイムスケールを2倍にして整数で考える
    FOR(i, 0, N){
        int s, t, c;
        cin >> s >> t >> c;
        s *= 2;
        t *= 2;
        S[i] = s;
        T[i] = t;
        C[i] = c;
    }

    // 各チャンネル毎に占有したい時間帯を求める
    FOR(c, 1, channelNum+1){
        resetTimeline();
        FOR(i, 0, N){
            if(C[i]==c){
                timeline[S[i]-1] = 1;
                timeline[T[i]] = -1;
            }
        }
        // いもす
        useline[0] = timeline[0];
        FOR(i, 1, 200010){
            useline[i] = useline[i-1] + timeline[i];
        }
        //
        FOR(i, 0, 200010){
            if(useline[i]>0){
                neednum[i]++;
            }
        }
    }

    int answer = neednum[0];
    FOR(i, 0, 200010){
        answer = max(answer, neednum[i]);
    }

    p(answer);
    
    return 0;
}

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

typedef long long ll;
const int maxn = 500005;
typedef pair<int, int>par;
const ll mod = 1e9+7;

vector<int>g[maxn];


int lis[maxn], m, a[maxn], up, sol[maxn];
void dfs( int nodo, int pad ){
    int did = 0, val, pos;
    if( lis[m] < a[nodo] ){
        m++;
        lis[m] = a[nodo];
        did = 1;
    }else{
        up = lower_bound(lis + 1, lis + m + 1, a[nodo]) - lis;
        did = 2;
        pos = up;
        val = lis[up];
        lis[up] = a[nodo];
    }

    sol[nodo] = m;
    for( auto i : g[nodo] ){
        if( i == pad )continue;
        dfs(i, nodo);
    }

    if( did == 1 ){
        m--;
        if( m+1 >= 0 )
        lis[m+1] = 0;
    }else{
        if( pos >= 0 )
            lis[pos] = val;
    }
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    freopen("a.out", "w",stdout);
    #endif // acm

    int n;
    cin >> n;

    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
    }

    int aa, bb;
    for( int i = 1; i < n; i++ ){
        cin >> aa >> bb;
        g[aa].push_back(bb);
        g[bb].push_back(aa);
    }

    dfs(1, 0);

    for( int i = 1; i <= n; i++ )
        cout << sol[i] << "\n";
    return 0;
}


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

int main() {
  ll N, W;
  cin >> N >> W;

  vector<ll> v(N), w(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i] >> w[i];
  }

  vector<ll> dp(W + 1, -1);
  dp[0] = 0;
  for (ll i = 0; i < N; i++) {
    for (ll k = 0; k + w[i] <= W; k++) {
      ll temp = k + w[i];
      dp[temp] = max(dp[temp], dp[k] + v[i]);
    }
  }

  ll ans = 0;
  for (ll i = 0; i <= W; i++) {
    ans = max(ans, dp[i]);
  }

  cout << ans << "\n";
  return 0;
}


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

#define int long long 

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define pb push_back
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MP make_pair
#define sqr(x) ((x) * (x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
	fastio;
	#ifdef FlameDragon
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	int n, k;
	cin >> n >> k;
	int ans = 0;
	if (k == 0) {
		cout << n * n << '\n';
		return 0;
	}
	for (int b = k + 1; b <= n; b++) {
		int cnt = (n / b) * (b - k) + (n % b >= k ? n % b - k + 1 : 0ll);
		ans += cnt;
		/*int tcnt = 0;
		for (int a = 1; a <= n; a++) {
			if (a % b >= k) tcnt++;
		}
		cout << b << ' ' << cnt << ' ' << tcnt << '\n';*/
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 long long INF = 1LL << 60;

int main(){
  int a, b; cin >> a >> b;

  vector<int> kai;
  REP(i, 1, 9){
    REP(j, 0, 9){
      REP(k, 0, 9){
        int num = i*10000 + j*1000 + k*100 + j*10 + i;
        kai.push_back(num);
      }
    }
  }
  sort(all(kai));

  int ans = upper_bound(all(kai), b) - lower_bound(all(kai), a);
  cout << ans << endl;

  return 0;
}


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

int main(){
  
  while(true){
    int H,W;
    cin >> H >> W;
    if(H==0 && W==0)break;

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if((i+j)%2==0){
          cout << '#';
        }
        else cout << '.';
      }
      cout << endl;
    }

    cout << '\n';
  }

  return 0;

}


Measured memory_bytes: 3104
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC079.C
{
    class Program
    {
        static void Main ()
        {
            var hw = Console.ReadLine ().Split (' ');
            int H = int.Parse (hw[0]);
            int W = int.Parse (hw[1]);
            var c = new int[10][];
            var A = new int[H][];
            for (int i = 0; i < 10; i++)
            {
                var inputs = Console.ReadLine ().Split (' ')
                    .Select (elem => int.Parse (elem))
                    .ToArray ();
                c[i] = inputs;
            }
            for (int i = 0; i < H; i++)
            {
                var inputs = Console.ReadLine ().Split (' ')
                    .Select (elem => int.Parse (elem))
                    .ToArray ();
                A[i] = inputs;
            }

            var costToOne = new int[10];
            var isFinal = new bool[10];
            for (int i = 0; i < 10; i++)
            {
                costToOne[i] = c[i][1];
            }
            isFinal[1] = true;
            while (isFinal.Contains (false))
            {
                int minval = int.MaxValue;
                int minidx = 0;
                for (int i = 0; i < 10; i++)
                {
                    if (isFinal[i]) continue;
                    if (minval > costToOne[i])
                    {
                        minval = costToOne[i];
                        minidx = i;
                    }
                }
                int j = minidx;
                isFinal[j] = true;
                for (int i = 0; i < 10; i++)
                {
                    if (isFinal[i]) continue;
                    if (costToOne[i] > costToOne[j] + c[i][j])
                    {
                        costToOne[i] = costToOne[j] + c[i][j];
                    }
                }
            }

            int mp = 0;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (A[i][j] == -1) continue;
                    mp += costToOne[A[i][j]];
                }
            }
            Console.WriteLine (mp);
        }
    }
}

Measured memory_bytes: 15444
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;

int main() {
    int N,B_val,total_val,total_ca,ans=0,temp;
    cin>>N;
    int B_ca[N];
    cin>>total_val>>B_val;
    cin>>total_ca;
    for(int i=0 ; i<N ; i++) cin >> B_ca[i];
    sort(B_ca, B_ca + N, greater<int>()); 
    for(int i=0 ; i<N+1 ; i++){
        temp = total_ca/total_val;
        ans = max(ans,temp);
        total_ca += B_ca[i];
        total_val += B_val;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3136
#[allow(unused_imports)]
use std::io;
use std::io::stdin;

fn read_line_as_vec() -> Vec<String> {
    let mut s = String::new();
    stdin().read_line(&mut s).expect("");
    s.split(' ').map(|x| x.to_string()).collect::<Vec<String>>()
}

fn main() {
    let wab = read_line_as_vec();
    let w: u32 = wab[0].trim().parse().expect("");
    let mut a: u32 = wab[1].trim().parse().expect("");
    let mut b: u32 = wab[2].trim().parse().expect("");
    if a > b {
        std::mem::swap(&mut a, &mut b);
    }
    println!("{}", b.saturating_sub(a + w));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int cnt(int n) {
    int ans = 0;
    while (n > 0) {
        ans += n % 10;
        n/=10;
    }
    return ans;
}
int main() {
    int n;
    cin >> n;
    int ans = INT_MAX;
    for(int i = 1; i <= n-i; i++) {
        ans = min(ans, cnt(i)+cnt(n-i));
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
/**
     **author : _KMS_
     **created : 05-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =6e5,MOD=2e9;
typedef long long ll;
char ch[100][100];
int m,n;
int mx=0;
int x2,y2;
struct Node{int x,y;};
queue<Node>q;
bool vis[100][100];
int A[]={1,-1,0,0};
int B[]={0,0,1,-1};
int dist[100][100];
void bfs(int x1,int yy)
{
    q.push({x1,yy});
    dist[x1][yy]=0;
    vis[x1][yy]=1;
    while(q.size())
    {
        int a=q.front().x;
        int b=q.front().y;
        q.pop();
        for(int i=0;i<4;i++)
        {
            int x3=a+A[i];
            int y3=b+B[i];
            if(x3>=0&&x3<m&&y3>=0&&y3<n&&ch[x3][y3]=='.')
            {
                if(!vis[x3][y3])
                {
                    dist[x3][y3]=dist[a][b]+1;
                    vis[x3][y3]=1;
                    q.push({x3,y3});
                }
                else
                {
                    dist[x3][y3]=min(dist[x3][y3],dist[a][b]+1);
                }
            }
        }
    }
    
        for(int k=0;k<m;k++)
         {
               for(int l=0;l<n;l++){
               mx=max(mx,dist[k][l]);
               dist[k][l]=0;
               vis[k][l]=0;
                     
               }
         }
}
int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
   cin>>m>>n;
   for(int i=0;i<m;i++)
   for(int j=0;j<n;j++)cin>>ch[i][j];
   for(int i=0;i<m;i++)
   {
         for(int j=0;j<n;j++)
         {
              if(ch[i][j]=='.')
              {
                    bfs(i,j);
              }
         }
        
   }
   cout<<mx<<endl;
   return 0;
}

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

int main(){
  int N,M;
  int w=0;
  int r=0;
  cin >> N >> M;
  vector<int> p(M);
  vector<string> s(M);
  vector<int> flag(N);
  vector<int> W(N);
  for(int i=0;i<N;i++){
    flag.at(i)=0;
    W.at(i)=0;
  }
  for(int i=0;i<M;i++){
    cin >> p.at(i) >> s.at(i);
    if(flag.at(p.at(i)-1)!=1){
      if(s.at(i)=="WA"){
        W.at(p.at(i)-1)++;
      }else if(s.at(i)=="AC"){
        r++;
        flag.at(p.at(i)-1)=1;
      }
    }
  }
  for(int i=0;i<N;i++){
    if(flag.at(i)==1){
      w+=W.at(i);
    }
  }
  cout << r << " " << w << endl;
}

Measured memory_bytes: 6912
#include <stdio.h>
#include <stdbool.h>

int main()
{
	char buff[102];
	char *index;
	bool wasAt = false;
	int repeatCount;
	
	while (fgets(buff,sizeof(buff),stdin)) {
		for (index = buff; '\0' != *index; ++index) {
			if ('@' == *index) {
				wasAt = true;
			}
			else if (wasAt) {
				repeatCount = *index - '0';
				++index;
				while (repeatCount) {
					putchar(*index);
					--repeatCount;
				}
				wasAt = false;
			}
			else {
				putchar(*index);
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-9;
constexpr 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 SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()



int main() {
    int n, d, ans = 0;
    vector<vector<int> > v;
    cin >> n >> d;
    v.resize(n);
    REP(i,n){
        v[i].resize(d);
        REP(j,d) cin >> v[i][j];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int sum = 0;
            for(int k=0;k<d;k++){
                sum += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
            }
            for(int x=1;x*x<=sum;x++){
                if(x*x==sum) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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


Measured memory_bytes: 256