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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Pow(ll A, ll N){
  if (N == 0) return 1;
  if (N % 2 == 0) return Pow(A * A % MOD, N / 2);
  else return Pow(A * A % MOD, N / 2) * A % MOD;
}

ll N, K;
ll DP[int(1e5+5)];

int main(){
  cin >> N >> K;
  for (ll i = K; i >= 1; i--){
    DP[i] = Pow(K / i, N);

    ll sum = 0;
    for (ll j = 2 * i; j <= K; j += i){
      sum += DP[j]; sum %= MOD;
    }
    DP[i] -= sum; DP[i] %= MOD;
    if (DP[i] < 0) DP[i] += MOD;
  }

  ll ans = 0;
  for (ll i = 1; i <= K; i++){
    ans += i * DP[i]; ans %= MOD; 
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4316
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n;
    cin >> n;
    ll a[n+1], b[n+2]; b[0] = b[n] = INF;
    rep(i, n-1) cin >> b[i+1];
    //print(b, n+2);
    ll s= 0;
    rep(i, n) s += min(b[i], b[i+1]);
    cout << s;
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define LL long long

int main() {
	vector<string> Mimage(50), Nimage(50);
	int M, N, check = 0;
	cin >> N >> M;
	for (int i = 0; i < N; i++) cin >> Nimage[i];
	for (int i = 0; i < M; i++) cin >> Mimage[i];

	for (int i = 0; i <= N - M; i++) {
		for (int j = 0; j <= N - M; j++) {
			if (Nimage[i].substr(j, M) == Mimage[0]) {
				check++;
				for (int k = 1; k < M; k++) {
					if (Nimage[i + k].substr(j, M) == Mimage[k]) check++;
				}
				if (check == M) {
					cout << "Yes" << endl;
					break;
				}
				else check = 0;
			}
			if (check == M) break;
		}
		if (check == M) break;
	}
	if (check < M) cout << "No" << endl;
	system("pause");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
#ifdef _WIN32
#include <windows.h>
#define print(x) PRINT(x, #x)
template<typename T> inline const void PRINT(T VARIABLE, string NAME)
{
#ifndef ONLINE_JUDGE /// ONLINE_JUDGE IS DEFINED ON CODEFORCES
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, 10);
    cerr << NAME << " = " << VARIABLE;
    SetConsoleTextAttribute(hConsole, 7);
    cerr << '\n';
#endif
}
#else
#define print(x) 0
#endif
struct pair_hash
{
    template<typename T1, typename T2>
    size_t operator () (const pair<T1, T2> &p) const
    {
        auto h1 = hash<T1> {}(p.first);
        auto h2 = hash<T2> {}(p.second);
        return h1 ^ h2;
    }
};
typedef long long ll;
typedef unsigned long long ull;
const ll INFLL = 2 * (ll)1e18 + 100;
const int INFINT = 2 * (int)1e9 + 100;
//ifstream fin(".in");
//ofstream fout(".out");
void die()
{
    cout << "-1\n";
    exit(0);
}
const int NMAX = 1e5 + 5;
const int MOD = 1e9 + 7; /// careful here (7 or 9, 66.. etc)
const double PI = atan(1) * 4;
const double EPS = 1e-12;

int n;
V tree[NMAX];
int depth[NMAX], parent[NMAX], sz[NMAX];

void dfs(int nod, int p, int d)
{
    parent[nod] = p;
    depth[nod] = d;
    sz[nod] = 1;
    for(auto i: tree[nod]) if(i != p)
    {
        dfs(i, nod, d + 1);
        sz[nod] += sz[i];
    }

}




int main()
{
    FASTIO;
    cin >> n;
    for1(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        tree[a].pb(b);
        tree[b].pb(a);
    }
    dfs(1, 0, 1);

    int cur = n;
    for1(cnt, (depth[n] - depth[1] - 1) / 2)
        cur = parent[cur];
    if(n - sz[cur] - 1 <= sz[cur] - 1) cout << "Snuke";
    else cout << "Fennec";


    return 0;
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};




int main(){
	string in;
	int a, b;
	cin >> a >> b;
	for(int i = 0; i < a; i++){
		cin >> in;
		for(int j = 0; j < 2; j++){
			cout << in << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

vector<int> g[10];

int p[10];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, m;
  cin >> m >> n;
  for(int i = 0; i < n; i++) {
    int k;
    cin >> k;
    while(k--) {
      int t;
      cin >> t;
      g[i].push_back(--t);
    }
  }
  for(int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  for(int i = 0; i < 1 << m; i++) {
    int ok = 1;
    for(int j = 0; j < n; j++) {
      int b = 0;
      for(auto k : g[j]) {
        if(i & (1 << k)) b ^= 1;
      }
      ok &= b == p[j];
    }
    if(ok) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

from collections import Counter
#T = int(stdin.readline())
#for i in range(T):
    #N=int(stdin.readline())
n1,n0,nm,k=list(map(int,stdin.readline().split()))

ans=0
if n1+n0>=k:
    ans= min(n1,k) 
    print(ans)
    #continue
else:
    ans+=n1
    ans-= k-n1-n0
    print(ans)


Measured memory_bytes: 9472
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final String s = scanner.next();
        final String t = scanner.next();

        final StringBuilder builder = new StringBuilder();

        for (int i = 0; i < n; i++) {
            builder.append(s.charAt(i));
            builder.append(t.charAt(i));
        }

        System.out.println(builder.toString());
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,A[30],B[30],C[30],sum;cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    for(int i=0;i<N;i++)cin>>B[i];
    for(int i=0;i<N-1;i++)cin>>C[i];
    sum=B[A[0]-1];
    for(int i=1;i<N;i++){
        sum+=B[A[i]-1];
        if(A[i]==A[i-1]+1)sum+=C[A[i-1]-1];
    }
    cout<<sum<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

long modpow(long x, long y){
    if(y == 0){
        return 1;
    } else if (x == 0){
        return 0;
    } else if(x == 1){
        return 1;
    } else if(y % 2 > 0){
        return x * modpow(x, y-1) % mod;
    } else {
        return modpow(x * x % mod, y / 2);
    }
}

int main(){
    
    long n, ans = 0;
    cin >> n;
    
    ans += modpow(10,n);
    ans %= mod;
    ans -= (modpow(9,n) * 2 % mod);
    ans %= mod;
    ans += modpow(8,n);
    ans %= mod;
    if(ans < 0) ans += mod;
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3160
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
#define ll long long 
const int maxn=200010;
const ll mod=1e9+7;
int n,k;
ll a[maxn];
ll ans=1; int flag=0;
bool cmp(const ll &a,const ll &b){
    return abs(a)>abs(b);
}
ll ksm(ll x,ll k){
    ll res=1;
    while (k){
        if (k&1) res=res*x%mod;
        x=x*x%mod; k>>=1;
    }
    return res%mod;
}
ll inv(ll x){
    return ksm(x,mod-2)%mod;
}
int main(){
    scanf("%d%d",&n,&k);
    for (int i=1;i<=n;++i){
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+1+n,cmp);
    for (int i=1;i<=k;++i){
        if (a[i]<0){
            ans=ans*(-a[i])%mod; flag^=1;
        }else{
            ans=ans*a[i]%mod;
        }
    }
    if (flag&&ans){
        int div1,mul1,div2,mul2;
        div1=div2=k; mul1=mul2=k+1; 
        while (div1>=1&&a[div1]>0) div1--;
        while (mul1<=n&&a[mul1]<0) mul1++;
        while (div2>=1&&a[div2]<0) div2--;
        while (mul2<=n&&a[mul2]>0) mul2++;
        if (div1>=1&&mul1<=n&&div2>=1&&mul2<=n){
            if (abs(a[mul1]*a[div2])>abs(a[mul2]*a[div1])){
                ans=ans*abs(a[mul1])%mod*inv(abs(a[div1]))%mod;
            }else{
                ans=ans*abs(a[mul2])%mod*inv(abs(a[div2]))%mod;
            }
            flag^=1;
        }
        else if (div1>=1&&mul1<=n){
            ans=ans*abs(a[mul1])%mod*inv(abs(a[div1]))%mod;
            flag^=1;
        }
        else if (div2>=1&&mul2<=n){
            ans=ans*abs(a[mul2])%mod*inv(abs(a[div2]))%mod;
            flag^=1;
        }
        else{
            if (a[n]==0){
                flag^=1; ans=0;
            }else{
                ans=1;
                for (int j=1;j<=k;++j){
                    ans=ans*abs(a[n-j+1])%mod;
                }
            }
        }
    }
    if (flag){
        ans=(-ans+mod)%mod;
    }else{
        ans%=mod;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 5256
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

LL const mod = 1e9 + 7;

struct Matrix {
  LL a[4][4];
  Matrix operator * (const Matrix &A) {
    Matrix re;
    for (RI i = 0; i < 4; ++i)
      for (RI j = 0; j < 4; ++j) {
        re.a[i][j] = 0;
        for (RI k = 0; k < 4; ++k)
          (re.a[i][j] += a[i][k] * A.a[k][j] % mod) %= mod;
      }
    return re;
  }
} F, G;

Matrix Matrix_qpow(Matrix a, int k) {
  Matrix re;
  for (RI i = 0; i < 4; ++i)
    for (RI j = 0; j < 4; ++j)
      re.a[i][j] = (i == j);
  for (; k; k >>= 1, a = a * a)
    if (k & 1) re = re * a;
  return re;
}

inline void Init() {
  F.a[0][0] = 4, F.a[0][1] = mod - 2, F.a[0][2] = 1, F.a[0][3] = mod - 1;
  F.a[1][0] = 1, F.a[1][1] = 0, F.a[1][2] = 0, F.a[1][3] = 0;
  F.a[2][0] = 0, F.a[2][1] = 1, F.a[2][2] = 0, F.a[2][3] = 0;
  F.a[3][0] = 0, F.a[3][1] = 0, F.a[3][2] = 0, F.a[3][3] = 1;
}

int const MAXN = 1e5 + 5;
int a[MAXN];
map <int, int> ans;

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n, m; read(n), read(m);
  if (n == 1) return puts("1"), 0;
  for (RI i = 1; i <= m; ++i) read(a[i]);
  a[++m] = n;
  G.a[0][0] = 5, G.a[1][0] = 1, G.a[2][0] = 0, G.a[3][0] = 0;
  int now = 2;
  for (RI i = 1; i <= m; ++i) {
    if (a[i] == 1) { --G.a[0][0], G.a[3][0] += 1; ans[a[i]] = 1; continue; }
    if (a[i] == 2) { G.a[3][0] += G.a[0][0]; ans[a[i]] = G.a[0][0]; continue; }
    Init();
    while (G.a[3][0] && now < a[i] - 1) {
      G = F * G;
      ++now;
      (G.a[3][0] -= ans[now - 2]) %= mod;
    }
    int res = a[i] - now;
    F = Matrix_qpow(F, res);
    G = F * G;
    now = a[i];
    ans[now] = G.a[0][0];
    (G.a[3][0] += ans[now]) %= mod;
    (G.a[3][0] -= ans[now - 2]) %= mod;
  }
  printf("%lld\n", (G.a[0][0] + mod) % mod);
  
  return 0;
}

// created by Daniel yuan


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, L;
    cin >> N >> L;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll idx = -1;
    for (ll i = 1; i < N; i++) {
        if (A[i - 1] + A[i] >= L) {
            idx = i;
            break;
        }
    }
    if (idx == -1) {
        prints()("Impossible");
        return;
    }

    prints()("Possible");
    for (ll i = 1; i < idx; i++) {
        prints()(i);
    }
    for (ll i = N - 1; i >= idx; i--) {
        prints()(i);
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3976
program sample
    implicit none
  
    integer(8) :: i,j,m,n,a,b,d
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,d
    m=0
    do i=1,n

        read(*,*) a,b
        if(a**2+b**2<=d**2)then
            m=m+1
        end if
    end do
    write(*,*)m
    stop

end program sample
  



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

int main() {
    int H, W;
    scanf("%d %d", &H, &W);
    int a, b;
    a = max(H, W);
    b = min(H, W);
    long long x, y, ans1, ans2;

    if (a % 3 == 0 || b % 3 == 0) ans1 = ans2 = 0;
    else if (a % 3 == 1) {
        x = (long long)a / 3 * b;
        a -= a / 3;
        if (a % 2 == 0 || b % 2 == 0) y = (long long)a * b / 2;
        else y = (long long)(max(a, b) / 2 + 1) * min(a, b);
        ans1 = y - x;
    } else if (a % 3 == 2) {
        x = (long long)(a / 3 + 1) * b;
        a -= (a / 3 + 1);
        if (a % 2 == 0 || b % 2 == 0) y = (long long)a * b / 2;
        else y = (long long)(max(a, b) / 2) * min(a, b);
        ans1 = x - y;
    }
    a = max(H, W);
    b = min(H, W);
    if (b % 3 == 1) {
        x = (long long)b / 3 * a;
        b -= b / 3;
        if (a % 2 == 0 || b % 2 == 0) y = (long long)a * b / 2;
        else y = (long long)(max(a, b) / 2 + 1) * min(a, b);
        ans2 = y - x;
    } else if (b % 3 == 2) {
        x = (long long)(b / 3 + 1) * a;
        b -= (b / 3 + 1);
        if (a % 2 == 0 || b % 2 == 0) y = (long long)a * b / 2;
        else y = (long long)(max(a, b) / 2) * min(a, b);
        ans2 = x - y;
    }
    printf("%lld\n", min(ans1, ans2));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int main()
{
  ll h,w;
  cin >> h >> w;
  if(h == 1 || w == 1)
    cout << 1;
  else
    cout << h * w / 2 + ((h*w) % 2);
  
  
  
}


Measured memory_bytes: 3604
n=int(input())
c=[0 for i in range(4)]
for i in range(n):
  s=input()
  if s=="AC":
    c[0]+=1
  if s=="WA":
    c[1]+=1
  if s=="TLE":
    c[2]+=1
  if s=="RE":
    c[3]+=1

print("AC x ",c[0])
print("WA x ",c[1])
print("TLE x ",c[2])
print("RE x ",c[3])

Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int N;
vector<int> L;
vector<int> A; // A, B, C

int main() {
    cin >> N;
    A.resize(3);
    for (int i = 0; i < 3; ++i) cin >> A[i];
    L.resize(N);
    for (int i = 0; i < N; ++i) cin >> L[i];

    int res = 1<<29;
    vector<int> bit(3);
    for (bit[0] = 1; bit[0] < (1<<N); ++bit[0]) { // 0 は含めない
        for (bit[1] = 1; bit[1] < (1<<N); ++bit[1]) { // 0 は含めない
            // 共通要素あったらダメ
            if (bit[1] & bit[0]) continue;
            for (bit[2] = 1; bit[2] < (1<<N); ++bit[2]) { // 0 は含めない
                // 共通要素があったらダメ
                if (bit[2] & bit[0]) continue;
                if (bit[2] & bit[1]) continue;

                // sums: A〜C に選んだ竹の長さの合計、nums: A〜C に選んだ竹の本数
                vector<int> sums(3, 0), nums(3, 0);
                for (int i = 0; i < N; ++i) {
                    for (int j = 0; j < 3; ++j) {
                        if (bit[j] & (1<<i)) {
                            sums[j] += L[i];
                            nums[j]++;
                        }
                    }
                }

                // score を求める
                int score = 0;
                for (int i = 0; i < 3; ++i) {
                    score += abs(sums[i] - A[i]); // +1, -1 のコスト
                    score += (nums[i] - 1) * 10; // 合体のコスト
                }
                res = min(res, score);
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long A, long long B, long long K){
  set<int> x;
  for (int i = 0; i < K; i++) {
    if(A+i > B)break;
    x.insert(A+i);
  }
  for (int i = K-1; i >= 0; i--) {
    if(B-i < A)break;
    x.insert(B-i);
  }
  for (auto a : x) {
    cout << a << endl;
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int s,k; cin>>k>>s;
	cout << ((s+2)*(s+1)-(k>s?0:3*(s-k+1)*(s-k))+(k*2>s?0:3*(s-2*k)*(s-2*k-1)))/2;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <cmath>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

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

	int ans = 0;
	rep(i, n) {
		int a;
		cin >> a;

		bool flag = false;
		for(int y = 1; 2 * y * y + 2 * y <= a; y++) {
			if((a - y) % (2 * y + 1) == 0) {
				flag = true;
			}
		}

		if(flag) ans++;
	}

	cout << n - ans << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(){
	int i,n,m,l,k;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		m=0;
        l=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			if(k>=2)m++;
            if(k>=1)l++;
		}
		if(m==0){
			printf("NA\n");
			continue;
		}
		printf("%d\n",l+1);
	}
	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';

const int N = 1e5+7, INF = 1e18;
int a[N];
int dp[N][2];

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(20); 
    #endif

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < 2; ++j)
            dp[i][j] = INF;

    int n, t;
    cin >> n >> t;

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

    auto rel = [&] (int &a, int b) {
        a = min(a, b);
    };  

    int m = INF, mx = 0;
    for (int i = 0; i < n; ++i) {
        m = min(m, a[i]);
        mx = max(mx, a[i] - m);
    }   

    int mn = INF;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 2; ++j) {
            int cur = mn + j;
            for (int d = -1; d <= 1; ++d) {
                int mn1 = min(cur, a[i] + d);
                if (mn1 < min(mn, a[i])) {
                    continue;
                }   
                if (a[i] + d - cur >= mx) {
                    continue;
                }
                int to = mn1 - min(mn, a[i]);
                rel(dp[i + 1][to], dp[i][j] + abs(d));
            }   
        }
        mn = min(mn, a[i]);
    }
    
    cout << min(dp[n][0], dp[n][1]) << endl;
}


Measured memory_bytes: 5868
#include <iostream>
#include <cstdio>
#include <algorithm>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

long long n, a, b;

int main()
{
    read(n), read(a), read(b);
    if ((b - a) % 2 == 0)    std::cout << (b - a) / 2 << std::endl;
    else   std::cout << std::min(a - 1, n - b) + 1 + (b - a - 1) / 2 << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = input()
    if S[2] == S[3] and S[4] == S[5]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<iostream>
#include<cmath>

using namespace std;

int number_of_tangent_line(int array1[], int array2[]);

int main() {
  int c1[3], c2[3];
  int ntl;

  for (int i = 0; i < 3; i++) {
    cin >> c1[i];
  }

  for (int i = 0; i < 3; i++) {
    cin >> c2[i];
  }

  ntl = number_of_tangent_line(c1,c2);
  cout << ntl << endl;
  return 0;
}

int number_of_tangent_line(int c1[], int c2[]){
  int p = c2[0]-c1[0];
  int q = c2[1]-c1[1];
  float r1 = c1[2];
  float r2 = c2[2];
  float x[4] = {0};
  float y[4] = {0};
  int a = 0;

  if((pow(p,2)+pow(q,2) == 0)) return a;

  x[0] = (r1*p*(r1+r2)+q*sqrt((pow(p,2)+pow(q,2))-pow((r1+r2),2)))/(pow(p,2)+pow(q,2));
  y[0] = (r1*q*(r1+r2)-p*sqrt((pow(p,2)+pow(q,2))-pow((r1+r2),2)))/(pow(p,2)+pow(q,2));
  //cout << x[0] << y[0] << endl;
  if(x[0] >= -1000 && x[0] <= 1000 && y[0] >= -1000 && y[0] <= 1000) a++;


  x[1] = (r1*p*(r1+r2)-q*sqrt((pow(p,2)+pow(q,2))-pow((r1+r2),2)))/(pow(p,2)+pow(q,2));
  y[1] = (r1*q*(r1+r2)+p*sqrt((pow(p,2)+pow(q,2))-pow((r1+r2),2)))/(pow(p,2)+pow(q,2));
  //cout << x[1] << y[1] << endl;
  if(x[1] >= -1000 && x[1] <= 1000 && y[1] >= -1000 && y[1] <= 1000) a++;
  if(x[1] == x[0] && y[1] == y[0]) a--;

  x[2] = (r1*p*(r1-r2)+q*sqrt((pow(p,2)+pow(q,2))-pow((r1-r2),2)))/(pow(p,2)+pow(q,2));
  y[2] = (r1*q*(r1-r2)-p*sqrt((pow(p,2)+pow(q,2))-pow((r1-r2),2)))/(pow(p,2)+pow(q,2));
  //cout << x[2] << y[2] << endl;
  if(x[2] >= -1000 && x[2] <= 1000 && y[2] >= -1000 && y[2] <= 1000) a++;

  x[3] = (r1*p*(r1-r2)-q*sqrt((pow(p,2)+pow(q,2))-pow((r1-r2),2)))/(pow(p,2)+pow(q,2));
  y[3] = (r1*q*(r1-r2)+p*sqrt((pow(p,2)+pow(q,2))-pow((r1-r2),2)))/(pow(p,2)+pow(q,2));
  //cout << x[3] << y[3] << endl;
  if(x[3] >= -1000 && x[3] <= 1000 && y[3] >= -1000 && y[3] <= 1000) a++;
  if(x[3] == x[2] && y[3] == y[2]) a--;

  return a;
}



Measured memory_bytes: 3196
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# 約数生成
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

s = sr()
count = 0
ans = 0
for i,c in enumerate(s):
    if c == 'W':
        ans+=(i-count)
        count+=1
print(ans)

Measured memory_bytes: 73448
from itertools import combinations_with_replacement
n,m,q = map(int, input().split())
Q = [list(map(int, input().split())) for _ in range(q)]
com = list(combinations_with_replacement([i+1 for i in range(m)],n))
ans = 0
for combi in com:
    tmp = 0
    for a,b,c,d in Q:
        if combi[b-1]-combi[a-1] == c:
            tmp += d
            ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 87228
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
int b[3]={0};
for(int i=0;i<3;i++)
{
scanf("%d",&b[i]);
}
if((b[0]==1&&b[1]==1)||b[2]==1)
{
printf("Open\n");
}
else
{
printf("Close\n");
}
return 0;
}	


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

int main(){
  ll n, k;
  cin >> n >> k;
  ll ans = n % k;
  if(ans > abs(ans - k)) ans = abs(ans - k);
  cout << ans << endl;
}

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

cnt = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        cnt += 1
    tmp = A[i]
    A[i] = A[minj]
    A[minj] = tmp
    
for k in range(n-1):
    print(A[k], end=' ')
print(A[n-1])
print(cnt)
    


Measured memory_bytes: 5604
import java.io.*;

public class Main{
	public static void main(String[] arsg) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String str[] = new String[4];
		str = br.readLine().split(" ");
		
		double a = Double.parseDouble(str[0]);
		double b = Double.parseDouble(str[1]);
		double C = Double.parseDouble(str[2]);
		
		double sin = Math.sin(Math.toRadians(C));
		double S = a*b*sin/2;
		
		double c = Math.sqrt(Math.pow(a,2)+Math.pow(b,2)-2*a*b*Math.cos(Math.toRadians(C)));
		
		double length = a + b + c;
		
		double height = b*Math.sin(Math.toRadians(C));
		System.out.println(S);
		System.out.println(length);
		System.out.println(height);
	}
}

Measured memory_bytes: 24564
import java.util.Scanner;

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

        int n = sc.nextInt();
        int j;

        for(int i = 1; i <= n; i++){
            if(i % 3 == 0)
                System.out.print(" " + i);
            else{
                j = i;
                while(j != 0){
                    if(j % 10 == 3){
                        System.out.print(" " + i);
                        break;
                    }
                    j /= 10;
                }
            }
        }
        System.out.println();
    }
}



Measured memory_bytes: 28556
use std::collections::VecDeque;
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 in_n: usize = read();
    let in_x: usize = read();
    let in_y: usize = read();
    let x = in_x - 1;
    let y = in_y - 1;
    let mut table = Vec::new();
    let mut updated = vec![false; in_n];

    for _ in 0..in_n {
        table.push(vec![in_n; in_n]);
    }

    for i in 0..in_n {
        table[i][i] = 0;
    }

    let mut queue = VecDeque::new();

    updated[0] = true;
    queue.push_back(0usize);

    while !queue.is_empty() {
        let i = queue.pop_front().unwrap();

        if !updated[i] {
            continue;
        }

        updated[i] = false;

        for j in 0..in_n {
            let d = table[j][i] + 1;

            if i > 0 && table[j][i - 1] > d {
                table[j][i - 1] = d;
                table[i - 1][j] = d;
                updated[i - 1] = true;
                queue.push_front(i - 1);
            }

            if i < in_n - 1 && table[j][i + 1] > d {
                table[j][i + 1] = d;
                table[i + 1][j] = d;
                updated[i + 1] = true;
                queue.push_front(i + 1);
            }

            if i == x && table[j][y] > d {
                table[j][y] = d;
                table[y][j] = d;
                updated[y] = true;
                queue.push_front(y);
            }

            if i == y && table[j][x] > d {
                table[j][x] = d;
                table[x][j] = d;
                updated[x] = true;
                queue.push_front(x);
            }
        }
    }

    let mut count = vec![0; in_n];

    for i in 0..in_n {
        for j in i + 1..in_n {
            count[table[i][j]] += 1;
        }
    }

    for i in 1..in_n {
        println!("{}", count[i]);
    }
}


Measured memory_bytes: 77048
/*  Bismillahir Rahmanir Rahim  */

#include <bits/stdc++.h>

using namespace std;

const long long mod = 1e9 + 7;
const int N = 100005;

long long bigmod(long long n, long long r){
	if(r == 0) return 1LL;
	if(r % 2 == 0){
		long long ret = bigmod(n, r / 2);
		return (ret * ret) % mod;
	}
	return (n * bigmod(n, r - 1)) % mod;
}

long long F[N], I[N];

void init(){
	F[0] = 1;
	for(long long i = 1; i < N; ++i){
		F[i] = (F[i-1] * i) % mod;
	}
	for(int i = 0; i < N; ++i){
		I[i] = bigmod(F[i], mod - 2);
	}
}

long long nCr(int n, int k){
	if(k > n) return 0;
	return (((F[n] * I[k]) % mod) * I[n - k]) % mod;
}

int n, a[N], v, p1, p2;
int cnt[N];

int main(){
	init();
	scanf("%d", &n);
	++n;
	for(int i = 1; i <= n; ++i){
		scanf("%d", &a[i]);
		cnt[a[i]]++;
	}
	p1 = n + 1;
	p2 = 0;
	for(int i = 1; i <= n; ++i){
		if(cnt[i] == 2){
			for(int j = 1; j <= n; ++j){
				if(a[j] == i){
					p1 = min(p1, j);
					p2 = max(p2, j);
				}
			}
		}
	}
	for(int i = 1; i <= n; ++i){
		long long ans = 0;
		ans += nCr(n - 2, i);
		ans += nCr(n - 2, i - 2);
		ans += 2LL * nCr(n - 2, i - 1);
		ans -= nCr(p1 - 1 + n - p2, i - 1);
		ans %= mod;
		ans += mod;
		ans %= mod;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3584
#encoding=utf-8
import datetime

def tako():
	while True:
		month, day = map(int, raw_input().split())
		if month == day == 0:
			break

		date1 = datetime.date(2004,month,day)
		tag = date1.weekday()
		print syori(tag + 1)

def syori(m):
	if m == 1:
		return "Monday"
	elif m == 2:
		return "Tuesday"
	elif m == 3:
		return "Wednesday"
	elif m == 4:
		return "Thursday"
	elif m == 5:
		return "Friday"
	elif m == 6:
		return "Saturday"
	elif m == 7:
		return "Sunday"

if __name__ == "__main__":
	tako()

Measured memory_bytes: 6460
n, t = map(int, input().split())
min_cost = 9999
for _ in range(n):
  ci, ti = map(int, input().split())
  if ti <= t:
    min_cost = min(min_cost, ci)
if min_cost == 9999:
  print('TLE')
else:
  print(min_cost)

Measured memory_bytes: 2940
from math import sqrt
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    n = i * i
    e = 2
    while n <= x:
        e += 1
        n = pow(i, e)
    ans = max(ans, pow(i, e - 1))
print(ans)


Measured memory_bytes: 3060
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))

sum_a = sum(A)
ans = 0
for i,a in enumerate(A):
    if a >= sum_a / (4 * M):
        ans += 1

if ans >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 8984
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a<=b&&b<=c)printf("%d %d %d\n",a,b,c);
  if(a>b&&a< c)printf("%d %d %d\n",b,a,c);
  if(b> c&&a< b)printf("%d %d %d\n",a,c,b);
  if(a> c&&b< a&&b>=c)printf("%d %d %d\n",c,b,a);
  if(a>b&&b<c&&c<a)printf("%d %d %d\n",b,c,a);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<LL,LL>
#define LL long long
using namespace std;

LL divisors[10000005];
int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    LL n;
    cin >> n;
    
    memset (divisors, 0, sizeof(divisors));
    for (LL i = 1; i <= n; ++i)
        for (LL j = i; j <= n; j += i)
            ++divisors[j];

    LL ans = 0;
    for (LL i=1;i<=n;i++) {
        ans += i * divisors[i];
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 81772
#include <iostream>

using namespace std;

int main()
{
  int a, b;
  cin >> a >> b;
  int ans = 2 * a - 1;
  ans = max (ans, a + b);
  ans = max(ans, 2 * b - 1);
  cout << ans;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

std::string a, b;
int n, m;

int gcd(int a, int b) { return !b?a:gcd(b,a%b); }

int main() {
#ifdef WYXLOCAL
    freopen("tmp.in", "r", stdin);
    freopen("tmp.out", "w", stdout);
#endif // WYXLOCAL
    scanf("%d%d", &n, &m);
    std::cin >> a >> b;
    int l = gcd(n, m);
    if (l == 1) printf("%lld", a[0] == b[0] ? 1ll * n * m : -1);
    else {
        long long lcm = 1ll * n * m / l;
        for (int i = 0, j = 0; i <= n && j <= m; i += lcm/m, j += lcm/n) if (a[i] != b[j]) { puts("-1"); return 0; }
        printf("%lld\n", lcm);
    }
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int c, d, x;

    scanf("%d",&x);
    scanf("%d",&c);
    scanf("%d",&d);

    if(x<c){
        printf("0");
    }
    else
    {
        x=x-c;
        int t = x%d;
        printf("%d",t);
    }
    return 0;
}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;cin>>a>>b>>c;
 
 
  if(c-(a-b)<0){
    cout<<0<<endl;
  }else{
     cout<<c-(a-b)<<endl;
  }
 


}




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

using namespace std;

//#define FILE_IO

int N, Q, ans;
int i, j, q, msk;
int cnt[3];
int val[1100005], dp[1100005], dp2[1100005];
int bts[1100005];
int B, b[25];
char s[1100005];

void bck0(int pas, int msk, int smn)
{
    if(pas >= B)
    {
        ans += smn * dp[msk];
        return;
    }

    bck0(pas + 1, msk, smn);
    bck0(pas + 1, msk ^ (1 << b[pas]), -smn);
}

void bck1(int pas, int msk, int smn)
{
    if(pas >= B)
    {
        ans += smn * dp2[msk];
        return;
    }

    bck1(pas + 1, msk, smn);
    bck1(pas + 1, msk ^ (1 << b[pas]), -smn);
}

void bckq(int pas, int msk)
{
    if(pas >= B)
    {
        ans += val[msk];
        return;
    }

    bckq(pas + 1, msk);
    bckq(pas + 1, msk ^ (1 << b[pas]));
}

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d\n", &N, &Q);
    scanf("%s\n", s);
    for(i = 0; i < (1 << N); i++)
        val[i] = dp[i] = dp2[i] = s[i] - '0';
    for(j = 0; j < N; j++)
        for(i = (1 << N) - 1; i >= 0; i--)
            if( (i & (1 << j)) == 0 )
                dp[i] += dp[i ^ (1 << j)];
    for(j = 0; j < N; j++)
        for(i = 0; i < (1 << N); i++)
            if( (i & (1 << j)) != 0 )
                dp2[i] += dp2[i ^ (1 << j)];

    for(q = 1; q <= Q; q++)
    {
        scanf("%s\n", s);
        reverse(s, s + N);
        cnt[0] = cnt[1] = cnt[2] = 0;
        for(j = 0; j < N; j++)
        {
            if(s[j] == '0') cnt[0]++;
            else if(s[j] == '1')    cnt[1]++;
            else if(s[j] == '?')    cnt[2]++;
        }

        if(cnt[0] < cnt[1] && cnt[0] < cnt[2])
        {
            msk = 0;
            B = 0;
            for(i = 0; i < N; i++)
            {
                if(s[i] == '1') msk |= (1 << i);
                if(s[i] == '0') b[B++] = i;
            }

            ans = 0;
            bck0(0, msk, 1);
            printf("%d\n", ans);
        }
        else if(cnt[1] < cnt[2])
        {
            msk = 0;
            B = 0;
            for(i = 0; i < N; i++)
            {
                if(s[i] == '1')
                {
                    msk |= (1 << i);
                    b[B++] = i;
                }
                if(s[i] == '?')
                    msk |= (1 << i);
            }

            ans = 0;
            bck1(0, msk, 1);
            printf("%d\n", ans);
        }
        else
        {
            msk = 0;
            B = 0;
            for(i = 0; i < N; i++)
            {
                if(s[i] == '?') b[B++] = i;
                else    msk |= ((s[i] - '0') << i);
            }

            ans = 0;
            bckq(0, msk);
            printf("%d\n", ans);
        }
    }

    return 0;
}



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

int main() {
 int x;
  cin >> x;
  if (x == 0) {
    cout << 1 << endl;
  }
  else if (x == 1) {
    cout << 0 << endl;
  }
 return 0;
}

Measured memory_bytes: 3612
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
#include<ctime>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>

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

int main(void) {
    ll n,x[200]={},ans=1000000000,sum=0;

    cin>>n;
    for (ll i = 0; i < n; i++) {
        cin>>x[i];
    }

    for (int p = 1; p <= 100; p++) {
        sum=0;
        for (int i = 0; i < n; i++) {
            sum+=(x[i]-p)*(x[i]-p);
        }
        ans=min(ans,sum);
    }

    cout<<ans<<"\n";


    
    return 0;
}

Measured memory_bytes: 256
const main = (input) => {
  input = input.split(' ');
  const a = parseInt(input[0]);
  const b = parseInt(input[1]);
  const c = parseInt(input[2]);
  
  if (a<=c&&c<=b) {
    console.log("Yes");
  }else{
    console.log("No");
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define INF 1000000000000001
#define ll long long
using namespace std;

ll N;
vector<vector<pair<ll, ll>>> E;

vector<pair<ll, ll>> dfs(ll top)
{
  vector<pair<ll, ll>> par_dis(N, {INF, 0});//dis, par
  par_dis.at(top) = {0, 0};
  queue<ll> q;
  q.push({top});
  while (!q.empty())
  {
    ll check = q.front();
    q.pop();
    for (ll i = 0; i < E.at(check).size(); ++i)
    {
      pair<ll, ll> next = E.at(check).at(i);
      if (par_dis.at(next.first).first > par_dis.at(check).first + next.second)
      {
        q.push(next.first);
        ll par = par_dis.at(check).second;
        if (E.at(check).size() > 2 | (check == 0 && E.at(check).size() > 1))
        {
          par = check;
        }
        par_dis.at(next.first) = {par_dis.at(check).first + next.second, par};
      }
    }
  }
  return par_dis;
}

// ll calc_dist(ll a, ll b, vector<pair<ll, ll>> par_dis)
// {
//   ll same_par;
//   pair<ll, ll> a_par = par_dis.at(a), b_par = par_dis.at(b);
//   while (true)
//   {
//     if (a_par.second == b_par.second)
//     {
//       break;
//     }
//     if (a_par.first > b_par.first)
//     {
//       a_par = par_dis.at(a_par.second);
//     }
//     else
//     {
//       b_par = par_dis.at(b_par.second);
//     }
//   }
//   return par_dis.at(a).first + par_dis.at(b).first - 2 * par_dis.at(a_par.second).first;
// }

int main()
{
  cin >> N;
  ll a, b, c;
  E = vector<vector<pair<ll, ll>>>(N);
  for (ll i = 0; i < N - 1; ++i)
  {
    cin >> a >> b >> c;
    E.at(a - 1).push_back({b - 1, c});
    E.at(b - 1).push_back({a - 1, c});
  }
  // for (ll i = 0; i < N; ++i)
  // {
  //   cout << par_dis.at(i).first << par_dis.at(i).second << endl;
  // }

  ll Q, K;
  cin >> Q >> K;
  ll x, y;
  K -= 1;
  vector<pair<ll, ll>> par_dis = dfs(K);
  for (ll i = 0; i < Q; ++i)
  {
    cin >> x >> y;
    x -= 1;
    y -= 1;
    cout << par_dis.at(x).first + par_dis.at(y).first << endl;
  }
}


Measured memory_bytes: 11776
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N = 1e5 + 5;
int a[N];
int main(void) {
    int n;
    scanf("%d", &n);
    memset(a, 0, sizeof a);
    for(int i = 1; i <= n; ++i) {
        int b;
        scanf("%d", &b);
        a[b]++;
    }
    int ans = 0;
    for(int i = 1; i <= N; ++i) {
        ans = max(ans, a[i-1] + a[i] + a[i+1]);
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    while(true)
    {
        val list = readLine()!!.split(" ").map(String::toInt)
        if ((list[0]==0) or (list[1]==0))
        {
            return
        }
        for (j in 1..list[0])
        {
            for (i in 1..list[1])
            {
                print('#')
            }
            println("")
        }
        println("")
    }
}


Measured memory_bytes: 40152
#include <iostream>
#include <map>
#include <string>
#include <climits>
#include <algorithm>
using namespace std;
int main(void){
    
    int W, H, N;
    cin >> W >> H >> N;
    
    int left_X = 0, right_X = W, bottom_Y = 0, top_Y = H;
    for(int i = 0; i < N; i++){
        int x, y, a;
        cin >> x >> y >> a;
        if(a == 1) left_X = max(left_X, x);
        if(a == 2) right_X = min(right_X, x);
        if(a == 3) bottom_Y = max(bottom_Y, y);
        if(a == 4) top_Y = min(top_Y, y);
    }
    
    if(left_X < right_X && bottom_Y < top_Y){
        int ans = (right_X - left_X) * (top_Y - bottom_Y);
        cout << ans << endl;
    }
    else cout << 0 << endl;
    
    
}


Measured memory_bytes: 3192