akhauriyash/Code-Regression huggingface dataset:
n, m = map(int,input().split())

#sがあればcを可能な限り使う

if n == 0: #sが無かったら
    ans = m//4 #c4個につき1個作れる

elif m == 0: #cが無かったら
    ans = 0 #1個も作れない

elif n*2 <= m: #cを全部使ってもcが余るもしくはぴったりの場合
    ans = n + (m-2*n)//4 #sを使い切り、余ったcで何個か作る

elif n*2 > m: #Sが余る場合
    ans = m//2

print(ans)

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

using namespace std;

typedef long long ll;

ifstream fin ("hps.in");
ofstream fout ("hps.out");

#define f first
#define s second
#define pb push_back

ll n, d, a, mars[200002], ans;
pair<ll, ll>v[200002];

int main()
{
  cin >> n >> d >> a;
  for (ll i = 1; i <= n; i++)
    cin >> v[i].f >> v[i].s;
  sort(v + 1, v + n + 1);
  for (ll i = 1; i <= n; i++) {
    if (mars[i] < v[i].s) {
      ll hatz = (v[i].s - mars[i] + a - 1) / a;
      ll st = i + 1, dr = n;
      ll x = 2 * d + v[i].f, poz = i;
      while (st <= dr) {
        ll mij = (st + dr) / 2;
        if (v[mij].f <= x) {
          poz = mij;
          st = mij + 1;
        }
        else
          dr = mij - 1;
      }
      mars[i] += a * hatz;
      mars[poz + 1] -= a * hatz;
      ans += hatz;
    }
    mars[i + 1] += mars[i];
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 4992
/*************************************
>>> Author:  xiaofan
>>> Blog:    https://xiaofan7.cn
>>> Date:    2019-12-28 19:33:40
**************************************/

#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pii pair<int,int>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int INF = 0x3f3f3f3f;

inline int read () {
	register int s = 0, w = 1;
	register char ch = getchar ();
	while (! isdigit (ch)) {if (ch == '-') w = -1; ch = getchar ();}
	while (isdigit (ch)) {s = (s << 3) + (s << 1) + (ch ^ 48); ch = getchar ();}
	return s * w;
}



int main() {
	IOS;
	//freopen("D:\\in.txt","r",stdin);
	//freopen("D:\\out2.txt","w",stdout);
	ll n,a,b;
	cin>>n>>a>>b;
	ll c=b-a;
	if(c%2==0){
		cout<<c/2<<endl;
		return 0;
	}
	ll cnt=0;
	ll c1=n-b;
	ll c2=a-1;
	ll mi=min(c1,c2);
	if(mi==c1){
		cnt+=c1;
		a+=c1;
		if(n-a%2==0)
			cnt+=(n-a)/2;
		else{
			cnt++;
			cnt+=(n-a-1)/2;
		}
	}else{
		cnt+=c2;
		b-=c2;
		if(b-1%2==0){
			cnt+=(b-1)/2;
		}else{
			cnt++;
			cnt+=(b-2)/2;
		}
	}
	cout<<cnt<<endl;




	return 0;
}



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


int main(){
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int ans=0;
  for(int i=0;i<=a;++i){
    for(int j=0;j<=b;++j){
      for(int k=0;k<=c;++k){
        int tmp=500*i+100*j+50*k;
        if(tmp==x) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
inline int cntd(long long x){
  int res=0;
  while(x){x/=2;res++;}
  return res;
}
int main(){
  int n;cin>>n;
  long long k;cin>>k;
  long long a[100010]={};
  for(int i=0;i<n;++i)cin>>a[i];
  int dig=cntd(k);
  long long q=0;
  for(int i=dig-1;i>=0;--i){
	if(q+pow(2,i)>k)continue;
	int cnt=0;
	for(int j=0;j<n;++j)
	  if(a[j]&(long long)pow(2,i))cnt++;
	if(cnt<(n+1)/2)q+=pow(2,i);
  }
  long long ans=0;

  for(int i=0;i<n;++i)
	ans+=q^a[i];

  cout<<ans<<endl;
  return 0;

  

}


Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

int main(){
  string valstr;
  cin >> valstr;

  vector<vector<int>> dp(valstr.size()+1, vector<int>(2));  
  for(int i = 0; i < valstr.size(); i++){
    int val = (int)(valstr[valstr.size()-i-1] - '0');
    dp[i+1][0] = min(dp[i][0]+val, dp[i][1]+1+val);
    if (i != 0)
	  dp[i+1][1] = min(dp[i][0]+10-val, dp[i][1]+10-val-1);
    else
      dp[i+1][1] = dp[i][0]+10-val;
  }
  
  cout << min(dp[valstr.size()][0], dp[valstr.size()][1]+1);
}

Measured memory_bytes: 55940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
}

Measured memory_bytes: 21588
n, a, b, c, d = map(int, input().split())
flag = False
for i in range(n):
    s = c*(n-1-i) - d*i
    t = d*(n-1-i) - c*i
    if s <= b-a <= t:
        flag = True
        break
print("YES" if flag else "NO")

Measured memory_bytes: 3060
A,B,C,X,Y = map(int,input().split())
if X<Y:
    print(min(A*X+B*Y,Y*C*2,X*C*2+B*(Y-X)))
else:
    print(min(A*X+B*Y,X*C*2,Y*C*2+A*(X-Y)))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = (a+b)*2;
        System.out.println(area+ " " +length);
    }
}


Measured memory_bytes: 26336
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

// 負の数にも対応した mod (a = -11 とかでも OK) 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

int main() {
    ll MOD = 1000000007;
    int N; cin >> N;
    vector<ll> A(N);
    ll wa = 0;
    rep(i,N) {
        cin >> A.at(i);
        wa += A[i];
        wa %= MOD;
    }
    ll res = 0;
    rep(i,N-1) {
        wa -= A[i];
        wa = (wa % MOD + MOD) % MOD;
        res += A[i] * wa % MOD;
        res %= MOD;
    }
    cout << res << endl;
}


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

using namespace std;
typedef long long ll;
#define mp make_pair

const int p = 1e9 + 7;

int add(int a, int b) {
	a += b;
	if (a >= p)
		a -= p;
	return a;
}

int sub(int a, int b) {
	a -= b;
	if (a < 0)
		a += p;
	return a;
}

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

int main() {
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);	
	int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1) {
		cout << "0" << endl;
		return 0;
	}
	if (n < m)
		swap(n, m);
	int res = 1;
	for (int i = 1; i <= n; i++)
		res = mul(res, i);
	for (int i = 1; i <= m; i++)
		res = mul(res, i);
	if (n == m)
		res = mul(res, 2);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int[][] c;

    private void solve() {
        c = new int[3][3];

        for(int i = 0;i < 3;i++) {
            for(int j = 0;j < 3;j++) {
                c[i][j] = nextInt();
            }
        }


        // c[i][j] = a[i] + b[j]
        // c[i][j] = (a[i] + x) + (b[j] - x)
        // c[i][j] = (a[i] + (-a[0])) + (b[j] - (-a[0]))
        int[] b = {c[0][0] - 0, c[0][1] - 0, c[0][2] - 0};
        int[] a = {c[0][0] - b[0], c[1][0] - b[0], c[2][0] - b[0]};

        for(int i = 0;i < 3;i++) {
            for(int j = 0;j < 3;j++) {
                if (a[i] + b[j] != c[i][j]) {
                    out.println("No");
                    return;
                }
            }
        }
        out.println("Yes");
    }
    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

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

    if (a < b)  swap(a, b);
    if (b < c)  swap(c, b);
    if (a < b)  swap(a, b);

    cout << a*10+ b + c << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	uint32_t a, b;
	if (scanf("%"SCNu32"%"SCNu32, &a, &b) != 2) return 1;
	while (b > 0) {
		uint32_t r = a % b;
		a = b;
		b = r;
	}
	printf("%"PRIu32"\n", a);
	return 0;
}



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

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

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

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

int n, c, d[30][30], C[500][500], cnt[3][30];

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

    cin >> n >> c;
    REP(i, c) REP(j, c) cin >> d[i][j];
    REP(i, n) {
        REP(j, n) {
            cin >> C[i][j];
            C[i][j]--;
            cnt[(i + j) % 3][C[i][j]]++;
        }
    }

    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }

    int ans = INF;
    REP(i, c) {
        REP(j, c) {
            REP(k, c) {
                if (i == j || j == k || k == i) continue;
                int cost = 0;
                REP(l, c) {
                    cost += d[l][i] * cnt[0][l];
                }
                REP(l, c) {
                    cost += d[l][j] * cnt[1][l];
                }
                REP(l, c) {
                    cost += d[l][k] * cnt[2][l];
                }
                ans = min(ans, cost);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1280
s = input()
N = len(s)
P = 998244353
B = 0
R = 0

Y = [[0] * (2*N+1) for _ in range(2*N+1)] # Block

for i in range(N):
    if s[i] == "0":
        R += 2
    elif s[i] == "1":
        B += 1
        R += 1
    else:
        B += 2
        
    # print(i, B, R)
    if R < i+1:
        for j in range(i+1-R):
            Y[R+1][j] = 1
    
    if B < i+1:
        for j in range(i+1-B):
            Y[j][B+1] = 1

X = [[0] * (B+1) for _ in range(R+1)]

for i in range(R+1):
    for j in range(B+1):
        if i == 0 and j == 0:
            X[i][j] = 1
            continue
        
        if Y[i][j]:
            continue
            
        if j > 0:
            X[i][j] += X[i][j-1]
        
        if i > 0:
            X[i][j] += X[i-1][j]
            
        X[i][j] %= P

print(X[-1][-1])

Measured memory_bytes: 192904
use std::io;


/// https://beta.atcoder.jp/contests/abc068/tasks/abc068_b
fn main() {
    let s = read_one::<String>().chars().collect::<Vec<char>>();
    println!("{}{}{}", s[0], s.len() - 2, s[s.len() - 1]);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;


public class Operation{

	private int sY, sX, tY, tX;
	
	public Operation( int a, int b, int c, int d ){
		sY = a;
		sX = b;
		tY = c;
		tX = d;		
	}
	
	public void print(){
		Console.WriteLine( "{0} {1} {2} {3}", sY, sX, tY, tX );
	}
	
}


public class D{
	
	public static void Main(){
	
		string[] args;
		
		args = Console.ReadLine().Split(' ');
		int h = Int32.Parse(args[0]);
		int w = Int32.Parse(args[1]);
		
		int[,] a = new int[h+1,w+1];
		for( int i = 1; i <= h; i++ ){
			args = Console.ReadLine().Split(' ');
			for( int j = 1; j <= w; j++ ){
				a[i,j] = Int32.Parse(args[j-1]);
			}
		}
		
		List<Operation> op = new List<Operation>();
		for( int i = 1; i <= h-1; i++ ){
			
			for( int j = 1; j <= w-1; j++ ){
				if( a[i,j] % 2 != 0 ){
					a[i,j+1]++;
					op.Add( new Operation(i, j, i, j+1) );
				}
			}
			if( a[i,w] % 2 != 0 ){
				a[i+1,w]++;
				op.Add( new Operation(i, w, i+1, w) );
			}
			
		}
		for( int j = 1; j <= w-1; j++ ){
			if( a[h,j] % 2 != 0 ){
				a[h,j+1]++;
				op.Add( new Operation(h, j, h, j+1) );
			}	
		}
		
		Console.WriteLine(op.Count);
		for( int i = 0; i < op.Count; i++ ) (op[i]).print();

	}

}

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

typedef long long ll;


int main() {
string S;   cin >> S;
int c0 = 0, c1 = 0; 
for (int i = 0; i < S.size(); i++) {
    if (S[i] == '0') c0++;
    else c1++;
}

cout << 2 * min(c0, c1) << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int arr[1000];

int main()
{
   int x,n,p,res1,res2;
   cin >> x >>n;
   for(int i=1; i<=n; i++){
    cin >> p;
    arr[p]=1;
   }
   for(int i=x;;i++){
    if(arr[i] ==0){
        res1=i;
        break;
    }
   }
   for(int i=x;;i--){
    if(arr[i] == 0){
        res2=i;
        break;
    }
   }
   int l = abs(res1 - x),k = abs(x - res2);
   if(l == k) cout << res2 << '\n';
   else if(l < k ) cout << res1 << '\n';
   else cout << res2 << '\n';
   return 0;

}


Measured memory_bytes: 3560
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int k = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];

		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}


		long[]dif = new long[n];
		dif[0] = (k - a[n-1])+a[0];

		for(int i = 1; i < n; i++) {
			dif[i] = (a[i]-a[i-1]);

		}

//		dif[n] = a[0] - a[n-1];

		Arrays.sort(dif);

		long ans = 0;
		for(int i = 0; i < n-1; i++) {
			ans += dif[i];
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 89004
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, answer = 0;
  cin >> N >> K;
  vector<int> h(N);
  for (int i=0; i<N; i++)
    cin >> h.at(i);
  for (int i=0; i<N; i++){
    if(h.at(i) >= K)
      answer++;
    else
      continue;
  }
  cout << answer << endl;
}

Measured memory_bytes: 640
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF (int)(1e9+10)
#define LLINF (lint)(1e18+10)

using namespace std;

int main(){
    lint h, w;
    cin >> h >> w;
    lint ans = LLINF, maxS, minS;
    REP(i, 1, h){
        lint res = h - i;
        maxS = max({i * w, (res/2) * w, (res - res/2) * w});
        minS = min({i * w, (res/2) * w, (res - res/2) * w});
        ans = min(ans, maxS - minS);
        maxS = max({i * w, res * (w/2), res * (w - w/2)});
        minS = min({i * w, res * (w/2), res * (w - w/2)});
        ans = min(ans, maxS - minS);
    }
    REP(i, 1, w){
        lint res = w - i;
        maxS = max({i * h, (res/2) * h, (res - res/2) * h});
        minS = min({i * h, (res/2) * h, (res - res/2) * h});
        ans = min(ans, maxS - minS);
        maxS = max({i * h, res * (h/2), res * (h - h/2)});
        minS = min({i * h, res * (h/2), res * (h - h/2)});
        ans = min(ans, maxS - minS);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
int k, n, i, j, sub=0;

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

a.push_back(a[0]+k);
  
for(i=0; i < n; i++){
	  sub = max(sub, a[i+1] - a[i]);
}
  
int shor = k - sub;
cout << shor;
return 0; 
}


Measured memory_bytes: 1792
n, k = map(int, input().split())
listS = [0]*n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        listS[a-1] = 1
count = 0
for s in listS:
    if s!=1:
        count+=1
print(count)
    

Measured memory_bytes: 9112
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define ll long long

const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  map<string, int> m;
  int n; cin >> n;
  rep(i,n){
    string st; cin >> st;
    m[st]++;
  }
  int max_count = 0;
  for(auto s : m){
    string l; int r; tie(l,r) = s;
    max_count = max(max_count, r);
  }
  for(auto s : m){
    string l; int r; tie(l,r) = s;
    if(r == max_count)
      cout << l << endl;
  }
}


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

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

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

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

signed main() {
	ll n, alice = 0, bob = 0;
  ll a[100] = {0};
  cin >> n;
  rep(i, n) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  rep(i, 100) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout << alice - bob << endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    REP(i, 1, 100) {
        if (i * a % b == c) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X;
  cin >> X;
  int ans = 1;
  for (int x = 2; x <= 31; x++) {
    int t = x;
    for (int i = 0; i < 10; i++) {
      t *= x;
      if (t <= X) ans = max(ans, t);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 100100100100100100
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> PLL;

int main() 
{
    int ans = 0;
    int n; cin >> n;
    vector<int> h(n);
    rep(i,n) { cin >> h[i]; }

    rep(i,n) {
        bool view = true;
        rep(j,i) {
            if(h[i] < h[j]) { 
                view = false;
            }
        }
        if(view) { ans++; }
    }
    
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <cstring>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <numeric>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N;
  cin >> N;
  vector<ll> nums(N);
  rep(i,N){
    cin >> nums[i];
  }
  ll ans = 1LL<<60;
  auto sum = std::accumulate(ALL(nums), 0LL);
  ll x = 0;
  rep(i,N-1){
    x += nums[i];
    auto y = sum - x;
    ans = min(ans, abs(x-y));
  }
  cout << ans << endl;
  return 0;
}

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

/* define const */

/* finish defineing const */

int a, b, c;

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

    if (b - a == c - b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;

 int main(void){
   string S[3];
   rep(i,3) cin >> S[i];
   int L[3];
   rep(i,3) L[i]=S[i].length();
   int p[3]={};
   int turn=0;
   while(true){
     if(p[turn]==L[turn]){
       cout << (char)('a'-32+turn) << endl;
       break;
     }
     p[turn]++;
     turn=S[turn][p[turn]-1]-'a';
   }
 }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#define MAX 100001
#define SENTINEL 2000000000
using namespace std;

int m[101][101];
int p[101];

void mcm()
{
}

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

    for (int i = 1; i <= n; i++)
        m[i][i] = 0;
    for (int l = 2; l <= n; l++)
    {
        for (int i = 1; i <= n - l + 1; i++)
        {
            int j = i + l - 1;
            m[i][j] = MAX;
            for (int k = i; k <= j - 1; k++)
            {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }
    cout << m[1][n] << endl;

    return 0;
}


Measured memory_bytes: 3128
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::usize;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_cols<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let headers = read_cols::<u64>();
    let h = headers[0];
    let w = headers[1];
    let d = headers[2];

    let mut cell_indexes = Vec::<(i64, i64)>::new();
    cell_indexes.resize((h * w + 1) as usize, (-1, -1));
    for i in 0..h {
        let col = read_cols::<u64>();
        for j in 0..w {
            let n = col[j as usize];
            cell_indexes[n as usize] = (i as i64, j as i64);
        }
    }

    let mut jump_powers = Vec::<i64>::new();
    jump_powers.resize((h * w + 1) as usize, 0);
    for r in 1..d+1 {
        let mut sum = 0;

        let start = cell_indexes[r as usize];
        let mut current = start;
        for i in 1.. {
            let n = r + i * d;
            if n > h * w {
                break;
            }

            let next = cell_indexes[n as usize];
            sum += (current.0 - next.0).abs() + (current.1 - next.1).abs();
            jump_powers[n as usize] = sum;
            current = next;
        }
    }

    let num_queries = read::<u64>();
    for _ in 0..num_queries {
        let headers = read_cols::<usize>();
        let l = headers[0];
        let r = headers[1];

        let power = jump_powers[r] - jump_powers[l];

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


Measured memory_bytes: 7292
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  string s;
  cin>>s;
  int cnt=0;
  string t=s;
  reverse(s.begin(), s.end());
  for (int i = 0; i < s.size(); ++i)
  {
    if(s[i]!=t[i]) cnt++;
  }
  cout<<cnt/2<<endl;
}

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

using namespace std;

char num[3 + 2];

int main() {
	int N, M;
	cin >> N >> M;
	for(int i = 0; i < M; i++) {
		int s;
		char c;
		cin >> s >> c;
		--s;
		if(!(!num[s] || num[s] == c)) {
			cout << -1 << '\n';
			return 0;
		}
		num[s] = c;
	}
	for(int i = 1; i < N; i++)
		if(!num[i])
			num[i] = '0';
	if(!num[0])
		num[0] = '0' + (N != 1);
	if(num[0] == '0' && N != 1) {
		cout << -1 << '\n';
		return 0;
	}
	cout << num << '\n';
}


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

using namespace std;
int g[1005][1005];
int main()
{
    int n,m;cin>>n>>m;
    int q;cin>>q;
    int i=0,j=0;
    int dir=0;
    for(int k=1;k<=q;k++)
    {
        int x;
        scanf("%d",&x);
        while(x--)
        {
            g[i][j]=k;
            if(!dir)
            {
                j++;
                if(j>=m)
                {
                    dir=!dir;
                    i++;
                    j=m-1;
                }
            }
            else
            {
                j--;
                if(j<0)
                {
                    dir=!dir;
                    i++;
                    j=0;
                }
            }
        }
    }

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(j!=0)printf(" ");
            printf("%d",g[i][j]);
        }
        printf("\n");
    }

}


Measured memory_bytes: 640
A, B, C, X, Y = map(int, input().split())

ans = float("inf")
for i in range(max(X, Y)+1):
    x = max(X - i, 0)
    y = max(Y - i, 0)
    cost = 2*C * i + A * x + B * y
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int A, B;
char c;
void solve(){
	if(c == '+')
		cout << A + B << endl;
	else
		cout << A - B << endl;

}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> A >> c >> B;
		solve();
	return 0;
}


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

#define loop(i,n) for(int i=1;i<=n;i++)
struct S {bool col;int len;};
vector<S> v;

int main(){
  int n;
  bool c;
  while(cin>>n,n){
    v.clear();
    loop(i,n){
      cin>>c;
      if(i%2==1){
        if(v.empty()||v.back().col!=c){
          v.push_back((S){c,1});
        }else{
          v.back().len++;
        }
      }else{
        v.back().col=c;
        v.back().len++;
        if(v[v.size()-2].col==v.back().col){
          v[v.size()-2].len+=v.back().len;
          v.pop_back();
        }
      }
    }
    int r=0;
    for(int i=0;i<v.size();i++){
      if(v[i].col==0)r+=v[i].len;
    }
    cout<<r<<endl;
  }
  return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
// #define MOD 1000000007
#define MOD 998244353
#define VL vector<ll>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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



int main()
{
	ll N, K;
	cin >> N >> K;
	ll t = ((N-1)*(N-2))/2;
	vector<P> ans;
	REP(i, N-1) {
		ans.push_back(P(1, i+2));
	}

	if (t == K) {
		PRINT(ans.size());
	REP(i, ans.size()) {
		PRINT(ans[i].first << " " << ans[i].second);
	}
	return 0;
	}
	FOR(i, 2, N+1) {
		FOR(j, i+1, N+1) {
			ans.push_back(P(i, j));
			t--;
			if (t == K) {
				i = N;
				j = N;
			}
		}
	}
	if (t != K) {
		PRINT(-1);
		return 0;
	}
	PRINT(ans.size());
	REP(i, ans.size()) {
		PRINT(ans[i].first << " " << ans[i].second);
	}

	return 0;
}


Measured memory_bytes: 512
using System;

namespace ABC074_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());
            var num = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            var sum = 0;

            for(var i=0;i<n;i++)
            {
                if(num[i]<=k/2)
                {
                    sum += 2 * num[i];
                }
                else
                {
                    sum += 2 * (k - num[i]);
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/agc032/tasks/agc032_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;
    vector<int> b(N); for(auto& in:b) cin >> in;
    vector<int> ans;
    
    for(int i = 0; i < N;i++){
        bool ok = false;
        for(int j = (int)b.size(); j >= 1; j--){
            if(b[j-1] == j){
                ok = true;
                
                ans.push_back(j);
                b.erase(b.begin()+j-1);
                break;
            }
        }
        if(ok) continue;
        cout << -1 << endl;
        return res;
    }
    reverse(ans.begin(),ans.end());
    for(auto v:ans) cout << v << endl;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
# include<bits/stdc++.h>
# include<unordered_map>
# include<unordered_set>
// # include<prettyprint.hpp>
using namespace std;
# define ll long long
// # define ll int
# define vll vector<ll>
# define vvll vector<vector<ll> >
# define vchar vector<char>
# define vstr vector<string>
# define vpll vector<pair<ll, ll> >
# define mll map<ll, ll>
# define sll set<ll>
# define usll unordered_set<ll>
# define schar set<char>
# define pll pair<ll, ll>
# define append_left push_front
# define append push_back
# define pop_left pop_front
# define popb pop_back
# define add insert
# define all(v) v.begin(), v.end()
# define rall(v) v.rbegin(), v.rend()
# define loop(i, k, n, inc) for(ll i = k; i < n; i+=inc)
# define rloop(i, k, n, inc) for(ll i = k; i > n; i+=inc)
vll vin(ll n){vll a(n);loop(i, 0, n, 1) cin>>a[i];return a;}
ll intin() {ll n; cin>>n; return n;}
char charin(){char a; cin>>a; return a;}
string strin(){string s; cin>>s; return s;}
ll factorial(ll n){return (n==1 || n==0) ? 1: n * factorial(n - 1);}
ll n, m;
vvll d;
vll ts, vis;
void dfs(ll v){
    vis[v] = 1;
    for(auto i:d[v]) if (!vis[i]) dfs(i);
    ts.append(v);
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    d.resize(n);
    vis.resize(n, 0);
    ll x, y;
    loop(i, 0, m ,1){
        cin>>x>>y;
        d[x-1].append(y-1);
    }
    loop(i , 0, n, 1){
        if (!vis[i]) dfs(i);
    }
    reverse(all(ts));
    vll dist(n, -1);
    for(auto i:ts){
        if (dist[i] == -1) dist[i] = 0;
        for(auto j:d[i]) dist[j] = max(dist[j], dist[i]+1);
    }
    ll ans = *max_element(all(dist));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10228
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          string s = Input.ScanStr();
          int n=0;
          if(s[0]=='1') n++;
          if(s[1]=='1') n++;
          if(s[2]=='1') n++;
          Console.WriteLine(n);
          
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11092
import math


def calc_height(b: int, rad: float) -> float:
    h = b * math.sin(rad)
    return h


def calc_area(a: int, h: float) -> float:
    S = a * h / 2
    return S


def calc_lap(a: int, b: int, rad: float) -> float:
    c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(rad))
    L = a + b + c
    return L


def calc():
    a, b, deg = map(int, input().split())
    # rad = float(deg * 2 * math.pi / 360)
    rad = math.radians(deg)

    h = calc_height(b, rad)
    S = calc_area(a, h)
    L = calc_lap(a, b, rad)

    print(f"{S:.8f}")
    print(f"{L:.8f}")
    print(f"{h:.8f}")


if __name__ == "__main__":
    calc()



Measured memory_bytes: 5732
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int iBoundNum = Integer.parseInt(sc.next());
        final int iCoordinate = Integer.parseInt(sc.next());

        int iBoundCnt = 1;
        int iBoundTotal = 0;
        for (int i = 0; i < iBoundNum; i++) {
            int iBoundLength = Integer.parseInt(sc.next());
            iBoundTotal += iBoundLength;
            if (iBoundTotal > iCoordinate) {
                break;
            }
            iBoundCnt++;
        }
        System.out.print(iBoundCnt);
    }
}


Measured memory_bytes: 35704
# include <bits/stdc++.h>
using namespace std; 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n,x,y,p,q,i,count; 
  cin>>n; 
  string str, s, t; 
  cin>>str; 
  s=str;
  sort(s.begin(),s.end());
  x=0;
  y=0;
  for(i=0;i<n;i++){
    if(str[i]!=s[i]){
      if(str[i]=='R'){
        x++;
      }
      else{
        y++;
      }
    }
  }
  cout<<(max(x,y));
}

Measured memory_bytes: 3872
#include<bits/stdc++.h>
  using namespace std;
  signed main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>=b+c){
      cout<<0<<"\n";
   	  return(0);
    }
   cout<<(b+c)-a<<"\n";
   return(0);
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main(){
    long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
    /* ll nowa = n,nowb  = 0, nowc  = 0,nowd=0 , nowe=0 ;
    
   while(nowa > 0 ||nowb > 0 || nowc > 0||nowd > 0 ||nowe > 0){

       if(nowe >= e){
           
            nowe -=e ;
       }else if(nowe > 0){
            nowe = 0; 
       }

       if(nowd >= d){
            nowe +=d ;
            nowd -=d ;
       }else if(nowd > 0){
            nowe += nowd ;
            nowd = 0 ; 
       }

        if(nowc >= c){
            nowd +=c ;
            nowc -=c ;
       }else if(nowc > 0){
            nowd += nowc ;
            nowc = 0 ; 
       }

       if(nowb >= b){
            nowc +=b ;
            nowb -=b ;
       }else if(nowb > 0){
            nowc += nowb ;
            nowb = 0 ; 
       }

       if(nowa >= a){
            nowb +=a ;
            nowa -=a ;
       }else if(nowa > 0){
            nowb += nowa ;
            nowa =0 ; 
       }
      
      ans ++ ;
      cout << "now = " << ans << endl;
      cout << "a " << nowa << endl;
      cout << "b " << nowb << endl;
      cout << "c " << nowc << endl;
      cout << "d " << nowd << endl;
      cout << "e " << nowe << endl;
      cout << endl;
   }*/

    
    return 0 ;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: String = read();
    let b: String = read();
    let c: String = read();
    if (a == b  && a != c) || (a == c && a != b) || (b == c && a != b) {
        println!("Yes");
    } else{
        println!("No");
    }
}


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

int A[100010];

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

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

	int ans = 0;
	for(int i = 0; i < N; i++) if(A[i] >= K) ans++;
	cout << ans;
	return 0;
}


Measured memory_bytes: 640
# from sys import exit
while(True):
    N = int(input())
    if N == 0:
        break
    L = []
    for i in range(N):
        p, h, w = [int(n) for n in input().split()]
        L.append((p, abs(22- w/((h/100)**2))))
        # print(abs(22- w/((h/100)**2)))
    L = sorted(L, key=lambda x: x[1])
    print(L[0][0])



Measured memory_bytes: 5648
//============================================================================
// Name        : HelloWorld.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
typedef long long ll;
using namespace std;
int R;
int main() {
	cin>>R;

    cout<<R*R*3<<endl;
	return 0;
}


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

using namespace std;

int main(void)
{
	while(1)
	{
		map<int,int> card;
		for(int i=1;i<10;i++)card[i]=0;
		int a,b,c;
		cin>>a>>b>>c;
		if(cin.eof())break;
		card[a]=1;
		card[b]=1;
		card[c]=1;
		int n=a+b;
		int d=0;
		int e=0;
		for(int i=1;i<=10;i++)
		{
			if(card[i]!=1)
			{
				d++;
				if(n+i<=20)
				{
					e++;
				}
			}
		}
		if((double)e/(double)d>=0.5)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
}

Measured memory_bytes: 1188
N = int(input())
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
for i in range(N, 0, -1):
  S = sum(B[(m+1)*i-1] for m in range(1, N//i))
  B[i-1] = (A[i-1] + S) % 2
C = []
for i in range(N):
  if B[i] == 1:
    C.append(i+1)
print(len(C))
for i in range(len(C)):
  if i != len(C) - 1:
    print(C[i], end = ' ')
  else:
    print(C[i])

Measured memory_bytes: 12468
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] values = new int[w];
            for(int i = 0; i < values.length; i++){
                values[i]= i+1;
            }
            for(int i = 0; i < n; i++){
                String str = sc.next();
                String[] ab = str.split(",");
                int a = Integer.parseInt(ab[0])-1;
                int b = Integer.parseInt(ab[1])-1;
                int tmp = 0;
                tmp = values[a];
                values[a] = values[b];
                values[b] = tmp;
            }
            for(int j = 0; j < values.length; j++){
                System.out.println(values[j]);
            }
        }
    }
}


Measured memory_bytes: 26168
#include<stdio.h>

int a[55][55],b[55][55],c[55][55];
int main(){
	int i,j,k,l,H,W,h,w,ans,sum;
	
	scanf("%d%d",&H,&W);
	for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&a[i][j]);
	for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&b[i][j]);
	scanf("%d%d",&h,&w);
	for(i=0;i<h;i++)for(j=0;j<w;j++)scanf("%d",&c[i][j]);
	
	ans=-10000000;
	for(i=0;i<=H-h;i++){
		for(j=0;j<=W-w;j++){
			for(k=0;k<h;k++){
				for(l=0;l<w;l++)if(b[i+k][j+l]!=c[k][l])break;
				if(l!=w)break;
			}
			if(k!=h)continue;
			sum=0;
			for(k=0;k<h;k++)for(l=0;l<w;l++)sum+=a[i+k][j+l];
			if(ans<sum)ans=sum;
		}
	}
	if(ans==-10000000)printf("NA\n");
	else printf("%d\n",ans);
	
	
	return 0;
}


Measured memory_bytes: 632
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	int n, m = 0;
	int c[25];
	const int p[25] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
	47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };

	memset(c, 0, sizeof(c));

	cin >> n;

	for (int i = 1; i <= n; i++) {
		int k = i;
		for (int j = 0; j < 25; j++) {
			while (k % p[j] == 0) {
				c[j]++;
				k /= p[j];
			}
		}
	}

	int a = 0, b = 0, d = 0, e = 0, f = 0;

	for (int j = 0; j < 25; j++) {
		if (c[j] > 1)
			a++;
		if (c[j] > 3)
			b++;
		if (c[j] > 13)
			d++;
		if (c[j] > 23)
			e++;
		if (c[j] > 73)
			f++;
	}

	m = (a - 2) * (b * (b - 1)) / 2 + (a - 1) * e + (b - 1) * d + f;

	cout << m << endl;
	
	return 0;
}

Measured memory_bytes: 256