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

using namespace std;

#define PI acos(-1.0)
#define EPS 1e-9

double toRadian(double deg) {return ((deg*PI)/180.0);}
double toDegree(double radian) {return ((radian*180.0)/PI);}
double handleNegZero(double x) {return ((abs(x) < EPS)?0.0:x);}

struct point_i { int x, y;     // whenever possible, work with point_i
  point_i() { x = y = 0; }                      // default constructor
  point_i(int _x, int _y) : x(_x), y(_y) {} };         // user-defined

struct Point { //Integer Point
    double x, y;
    Point(){}
    Point(double _x, double _y):x(_x), y(_y){}

    bool operator < (Point other) const {
        if(fabs(x - other.x) > EPS)
            return x < other.x;
        return y < other.y;
    }

    bool operator == (Point other) const {
        return ((fabs(x - other.x) < EPS) && (fabs(y - other.y) < EPS));
    }
};

double pointDistaceSquared2D (Point a, Point b) {return (a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y);}
double dist (Point a, Point b) {return sqrt(pointDistaceSquared2D(a, b));}
// rotate p by theta degrees CCW w.r.t origin (0, 0)
Point rotate(Point p, double theta) {
    double rad = toRadian(theta);
    return Point(p.x * cos(rad) - p.y * sin(rad),
                 p.x * sin(rad) + p.y * cos(rad));
}

struct line {double a, b, c;};
void pointsToLine(Point p1, Point p2, line &l) {
    if(fabs(p1.x-p2.x) < EPS) {
        l.a = 1.0; l.b = 0.0; l.c = -p1.x;
    } else {
        l.a = -(double)(p1.y-p2.y) / (p1.x-p2.x);
        l.b = 1.0;
        l.c = -(double)(l.a*p1.x)-p1.y;
    }
}

bool areParallel(line l1, line l2) {
    return (fabs(l1.a-l2.a) < EPS) && (fabs(l1.b-l2.b) < EPS);
}

bool areSame(line l1, line l2) {
    return areParallel(l1, l2) && (fabs(l1.c-l2.c) < EPS);
}

bool areIntersect(line l1, line l2, Point &p) {
    if(areParallel(l1, l2)) return false;
    p.x = (l2.b*l1.c-l1.b*l2.c) / (l2.a*l1.b-l1.a*l2.b);
    if(fabs(l1.b) > EPS) p.y = -(l1.a*p.x+l1.c);
    else                 p.y = -(l2.a*p.x+l2.c);
    return true;
}

struct vec {
    double x, y;
    vec(){}
    vec(double _x, double _y):x(_x), y(_y){}
};

vec toVec(Point a, Point b) {return vec(b.x - a.x, b.y - a.y);}
vec scale(vec v, double s) {return vec(v.x*s, v.y*s);}
Point translate(Point p, vec v) {return Point(p.x + v.x, p.y + v.y);}// translate p according to v
double dot(vec a, vec b) {return (a.x*b.x + a.y*b.y);}
double norm_sq(vec v) {return v.x*v.x + v.y*v.y;}

int main() {

    int q;
    double x0, y0, x1, y1, x2, y2, x3, y3;
    scanf("%d", &q);

    for(int i = 0; i < q; i++) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
        Point   a = Point(x0, y0),
                b = Point(x1, y1),
                c = Point(x2, y2),
                d = Point(x3, y3);

        line    s1, s2;
        pointsToLine(a, b, s1);
        pointsToLine(c, d, s2);

        if(abs(dot(toVec(a, b), toVec(c, d))) < EPS) {
            printf("1\n");
        } else if(areParallel(s1, s2)) {
            printf("2\n");
        } else {
            printf("0\n");
        }
    }

    return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<map>
#include<set>
#include<string>

std::map<std::string, std::set<int> > m;

int main()
{
	std::string s;
	int p;
	while( std::cin >> s >> p )
		m[s].insert( p );

	for( std::map<std::string, std::set<int> >::iterator it = m.begin(); it != m.end(); ++it )
	{
		std::cout << it->first << std::endl;

		std::set<int>& s = it->second;

		for( std::set<int>::iterator it2 = s.begin(); it2 != s.end(); ++it2 )
			( it2 == s.begin() ? std::cout : std::cout << " " ) << *it2;
	
		std::cout << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    string S;
    cin >> S;

    int bucket[26]={0};
    for(int i = 0; i < S.size(); i++)
    {
        bucket[char(S[i] - 'a')]++;
    }
    int c = 0;
    for(int i = 0; i < 26; i++)
    {
        if(bucket[i] == 0)
        {
            c = i;
            cout << char(i + 'a') << endl;
            return 0;
        }
    }

    cout << "None" << endl;
    return 0; 
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
  int array[200001];
  int N;
  scanf("%d",&N);
  for(int i=0; i<N; i++){
    scanf("%d",&array[i]);
  }

  quick_sort(array, 0, N-1);

    for(int i = 0; i < N; i++){
        if(array[i]==array[i+1]){
          printf("NO");
          exit(0);
        }
    }
  printf("YES");
  return 0;
}

Measured memory_bytes: 896
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n = int(readline())
ab = [list(map(int, readline().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
cost = 0
for i in range(n):
    cost += ab[i][0]
    if cost > ab[i][1]:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 47044
import std.stdio;
import std.array;
import std.conv;
import std.string;
import std.algorithm;

void main()
{
  int[] m;
  while((m=map!(to!int)(readln.strip.split).array)!=[0,0]) {
    int n=m[0],x=m[1],sum = 0;
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<x-i;j++)
        {
            int k = x-i-j;
            if(j<k && k<=n) {
                sum += 1;
            }
        }
    }
    writeln(sum);
  }
}

Measured memory_bytes: 2408
//
// Created by 永徳泰明 on 2019-03-03.
//

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;
#define dump(x)  cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define fill(x, y) memset(x,y,sizeof(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 999999999;

void readFromInputFile() {
#ifdef LOCAL
    static std::ifstream in("/Users/hoo/CLionProjects/for_atcoder/input");
    std::cin.rdbuf(in.rdbuf());
#endif
}

int main() {
    readFromInputFile();
    string s;
    cin >> s;
    int a = 0, b = 0;

    rep(i, s.size()) {
        if (s[i] == '1') {
            a++;
        } else {
            b++;
        }
    }

    cout << min(a, b) * 2 << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000, MAX_Q = 100000;
int N, Q;
ll A[MAX_N];
ll X[MAX_Q];
ll sum_odd[MAX_N];
ll sum_even[MAX_N];
ll sum[MAX_N];

int main() {
  std::ios::sync_with_stdio(false);std::cin.tie(0);
  cin >> N >> Q;
  rep(i, N) cin >> A[i];
  rep(i, Q) cin >> X[i];

  sum_even[0] = A[0];
  sum_odd[1] = A[1];
  for (ll i = 2; i < N; i += 2) {
      sum_even[i] = A[i] + sum_even[i-2];
  }
  for (ll i = 3; i < N; i += 2) {
      sum_odd[i] = A[i] + sum_odd[i-2];
  }
  sum[0] = A[0];
  for (ll i = 1; i < N; ++i) sum[i] = A[i] + sum[i-1];

  for (ll q = 0; q < Q; ++q) {
      ll x = X[q];

      ll lb = -1, ub = 1e10, mid;
      while (ub-lb > 1) {
          mid = (lb+ub)/2;
          ll _idx1 = lower_bound(A, A+N, x-mid) - A;
          ll _idx2 = upper_bound(A, A+N, x+mid) - A;
          ll _aoki = _idx2-_idx1, _takahashi = N-_idx2;
          if (_aoki >= _takahashi) ub = mid;
          else lb = mid;
      }

      ll idx1 = lower_bound(A, A+N, x-ub) - A;
      ll idx2 = upper_bound(A, A+N, x+ub) - A;
      ll aoki = idx2-idx1, takahashi = N-idx2;

      ll ans = 0;
      if (aoki == takahashi) {
          ans = sum[N-1]-sum[idx2-1];
          if (0 <= idx1-1 && (idx1-1)%2 == 0) ans += sum_even[idx1-1];
          if (0 <= idx1-1 && (idx1-1)%2 == 1) ans += sum_odd[idx1-1];
      } else if (aoki == takahashi+1) {
          ll addIdx = idx2-1;
          if (abs(A[idx1]-x) > abs(A[idx2-1]-x)) addIdx = idx1;
          ans = sum[N-1]-sum[idx2-1];
          ans += A[addIdx];
          if (0 <= idx1-2 && (idx1-2)%2 == 0) ans += sum_even[idx1-2];
          if (0 <= idx1-2 && (idx1-2)%2 == 1) ans += sum_odd[idx1-2];
      } else if (aoki == takahashi+2) {
          ans = sum[N-1]-sum[idx2-2];
          if (0 <= idx1-1 && (idx1-1)%2 == 0) ans += sum_even[idx1-1];
          if (0 <= idx1-1 && (idx1-1)%2 == 1) ans += sum_odd[idx1-1];
      }


      cout << ans << endl;
  }

  return 0;
}


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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int x,y; cin >> x>> y;
    cout << x+y/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[100000];
int num[9] = {2,5,5,4,5,6,3,7,6};

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> A(M);
    for(int i=0; i<M; ++i) cin >> A[i];
    sort(A.begin(), A.end(), greater<int>());

    for(int i=1; i<=N; ++i) dp[i] = -1001001001001001;
    dp[0] = 0;
    for(int i=1; i<=N; ++i) {
        for(int j=0; j<M; ++j) {
            if(i >= num[A[j]-1]) {
                dp[i] = max(dp[i], dp[i - num[A[j]-1]] + 1);
            }
        }
    }

    int n = dp[N];
    for(int i=n; i>0; --i) {
        for(int j=0; j<M; ++j) {
            int m = num[A[j]-1];
            if(N >= m && i - 1 == dp[N - m]) {
                cout << A[j];
                N -= m;
                break;
            }
        }
    }
    cout << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll a, m, n, k;
bool f[maxn];
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	qread(n);
	qread(k);
	for(int i = 1;i <= k;i++){
		qread(m);
		for(int j = 1;j <= m;j++){
			qread(a);
			f[a] = 1;
		}
	}
	ll cnt = 0;
	for(int i = 1;i <= n;i++){
		if(!f[i]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

vector<int>rinsetu[26];
int in[26], out[26];
bool flag[26];
void dfs(int a) {
	flag[a] = true;
	for (int b : rinsetu[a]) {
		if (!flag[b]) {
			dfs(b);
		}
	}
}
signed main() {
	int a;
	while (cin >> a, a) {
		for (int i = 0; i < 26; i++) {
			in[i] = out[i] = flag[i] = 0;
			rinsetu[i].clear();
		}
		int S=0;
		for (int b = 0; b < a; b++) {
			string c; cin >> c;
			S = c[0] - 'a';
			in[*c.rbegin() - 'a']++;
			out[c[0] - 'a']++;
			rinsetu[c[0] - 'a'].push_back(*c.rbegin() - 'a');
		}
		bool k = true;
		for (int i = 0; i < 26; i++) {
			if (in[i] != out[i])k = false;
		}
		dfs(S);
		for (int i = 0; i < 26; i++) {
			if (in[i] && !flag[i])k = false;
		}
		if (k)puts("OK");
		else puts("NG");
	}
}

Measured memory_bytes: 3048
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int x = Integer.parseInt(scan.next());
		int ans = 0;
		int sum = 0;

		while(x > sum){
			++ans;
			sum+=ans;
		}
		System.out.print(ans);

	}
}
//end


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,pll> ppll;
typedef vector <pll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main() {
    FAST;
    ll i, n, k, m, x = 0, y = 0, t, z = 0, ans = 0, j, c = 0;
    cin >> n >> m ;
    if ( n == m ) out("Yes");
    out("No");
}

Measured memory_bytes: 256
sentinel = str(10**9+1)

def partition(A, p, r):
    x = int(A[r][1])
    i = p - 1
    for j in range(p, r):
        if int(A[j][1]) <= x:
            i = i + 1
            A[i], A[j] = A[j], A[i]

    A[i+1], A[r] = A[r], A[i+1]
    return i + 1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q-1)
        quick_sort(A, q+1, r)

def merge(lst,left,middle,right):
    left_lst  =  lst[left:middle] + [['',sentinel]]
    right_lst = lst[middle:right] + [['',sentinel]]

    i,j = 0,0
    for k in range(left,right):
        if int(left_lst[i][1]) <= int(right_lst[j][1]):
            lst[k] = left_lst[i]
            i += 1
        else:
            lst[k] = right_lst[j]
            j += 1

def merge_sort(lst,left,right):
    if left+1 < right:
        middle = (left+right)//2
        merge_sort(lst,left,middle)
        merge_sort(lst,middle,right)
        merge(lst,left,middle,right)


n = int(input())
n_lst = [[i for i in input().split()] for _ in range(n)]
m_lst = list(n_lst)
quick_sort(n_lst,0,n-1)
merge_sort(m_lst,0,n)
print('Stable' if n_lst == m_lst else 'Not stable')
for ans in n_lst:
    print('{} {}'.format(ans[0],ans[1]))



Measured memory_bytes: 23296
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
signed main()
{
  vector <int> z;
  int a={10000},i=0;
  while(true){
  cin>>a;
  if(a==0){
    break;
  }
  i++;
  z.push_back(a);
  cout<<"Case "<<i<<": "<<z[i-1]<<"\n";
  } 
  return(0);
}



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

int main()
{
  int n;
  int four = 0, two = 0;
  cin >> n;
  int a[n];
  int i;
  for (i=0;i<n;i++) {
    cin >> a[i];
    if (a[i]%4 == 0) four += 1;
    else if (a[i]%2 == 0) two += 1;
  }
  if (n - 2*four <= 1) cout << "Yes" << endl;
  else if (n- 2*four - two <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0; 
}

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

#define MOD 1000000007

long long dp[101][26][26][26] = {{{{}}}};
long long n;

int dfs(char c1, char c2, char c3, int i)
{
    if(c1 == 'A' && c2 == 'G' && c3 == 'C')
        return 0;
    
    if(i >= n)
        return 1;
        
    if(dp[i][c1-'A'][c2-'A'][c3-'A'] != 0)
        return dp[i][c1-'A'][c2-'A'][c3-'A'];
        
    long long count = 0;
        
    if(c2 == 'A' && c3 == 'C'){
        count += dfs(c2, c3, 'A', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'T', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'C', i + 1);
        count = count % MOD;
    }
    
    else if((c2 == 'G' && c3 == 'A') || (c1 == 'A' && c2 == 'G') || (c1 == 'A' && c3 == 'G')){
        count += dfs(c2, c3, 'A', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'T', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'G', i + 1);
        count = count % MOD;
    }

    else{
        count += dfs(c2, c3, 'A', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'T', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'C', i + 1);
        count = count % MOD;
        count += dfs(c2, c3, 'G', i + 1);
        count = count % MOD;
    }
    
    dp[i][c1-'A'][c2-'A'][c3-'A'] = count;
    
    return count;
}

int main(void){
    // Your code here!
    
    cin >> n;
    cout << dfs('X', 'X', 'X', 0) << endl;
}


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

using namespace std;

int main(){
    long N, M;
    cin>>N>>M;
    vector<long> p(M);
    vector<string> S(M);

    vector<long> WA_cnt(N, 0);
    vector<bool> AC_flag(N, false);
    for(int i=0; i<M; ++i){
        cin>>p[i]>>S[i];
        if(S[i] == "AC"){
            AC_flag[p[i]-1] = true;
        }else if(S[i] == "WA" && AC_flag[p[i]-1] == false){
            WA_cnt[p[i]-1] += 1;
        }
    }

    long wa = 0;
    long ac = 0;
    for(int i=0; i<N; ++i){
        if(AC_flag[i] == true){
            ac += 1;
            wa += WA_cnt[i];
        }
    }
    cout<<ac<<" "<<wa<<endl;
    
    return 0;
}


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

int main()
{
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int T[2]={A,B};
  int Bus[2]={C,D};
  sort(Bus,Bus+2);
  if(A>B){
  cout<<T[1]+Bus[0]<<endl;
}else{
  cout<<T[0]+Bus[0]<<endl;
}
  return 0;

}


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


struct Info{
	int x;
	double  h;
};

double  calc(double  tmp_x,double  tmp_distance){
	return sqrt(tmp_x*tmp_x + (tmp_distance/(2*tmp_x))*(tmp_distance/(2*tmp_x)));
}

int main(){

	double distance;
	int N,bounce_limit;

	scanf("%lf %d %d",&distance,&N,&bounce_limit);

	Info info[N];

	for(int i = 0; i < N ;i++){
		cin >> info[i].x >> info[i].h;
	}

	double  tmp_distance;

	double  ans = 1000000.0;
	double  left,right,m,tmp_x,max_x,tmp_y,tmp_dist,tmp_h;

	bool FLG;

	for(int b_count = 1; b_count <= bounce_limit+1; b_count++){

		tmp_distance = (double)distance/b_count;

		left = 0.0,right = DBL_MAX,m = (left+right)/2;
		max_x = 0;

		while(left <= right){

			tmp_x = m;
			tmp_y = tmp_distance/(2*tmp_x);

			FLG = true;

			for(int i = 0; i < N; i++){
				tmp_dist = info[i].x;

				while(tmp_dist >= tmp_distance)tmp_dist -= tmp_distance;

				tmp_h = (tmp_y/tmp_x)*tmp_dist-1.0/(2*tmp_x*tmp_x)*(tmp_dist*tmp_dist);

				if(info[i].h > tmp_h){
					FLG = false;
					break;
				}
			}
			if(FLG){
				max_x = max(max_x,m);
				left = m+EPS;
			}else{
				right = m-EPS;
			}
			m = (left+right)/2;
		}

		ans = min(ans,calc(max_x,tmp_distance));

		left = 0.0,right = max_x;

		while(true){
			if(right-left < EPS){
				ans = min(ans,calc((right-left)/2,tmp_distance));
				break;
			}

			double  mid1 = left + (right-left)/3;
			double  mid2 = left + (right-left)/3*2;

			double  v_1 = calc(mid1,tmp_distance);
			double  v_2 = calc(mid2,tmp_distance);

			ans = min(ans,min(v_1,v_2));

			if(v_1 < v_2){
				right = mid2-EPS;
			}else{
				left = mid1+EPS;
			}
		}
	}

	printf("%.12lf\n",ans);

	return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n, d, x;
  cin >> n >> d >> x;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans = x;
  rep(i,n) {
    int temp = 0;
    for (int j = 1; j <= d; j++) {
      if (temp * a[i] + 1 == j) temp++;
    }
    ans += temp;
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());
  if(s < t){
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

int main() {
	
	int a,i;
	
	
	while(cin>>a && a!=0){
	
		for(i=1;i<10;i++){
		int b;
		cin>>b;
		a=a-b;
		}
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
local n=io.read("n")
local t={}
for i=1,n do
    local x,l=io.read("n","n")
    t[i]={x+l,x-l}
end
table.sort(t,function(x,y)
    return x[1]<y[1]
end)

local counter,eoa=0,-(10^9+1)
for i=1,n do
    if eoa<=t[i][2] then
        counter=counter+1
        eoa=t[i][1]
    end
end
print(counter)

Measured memory_bytes: 13808
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String[] a = new String[n];
		
		
		for(int i = 0; i < n; i++) {
			String str = br.readLine();
			
			str = str.replaceAll("Hoshino", "Hoshina");
			
			a[i] = str;
		}
		
		for(String i : a) {
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 24528
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i > 0; i--)

using namespace std;

const int MAX_BARS = 8;
const int MOD = pow(10, 9) + 7;

class D {
	int rows, bars, goal;
	int transition[MAX_BARS][MAX_BARS];
public:
	D()
	{
		memset(transition, 0, sizeof transition);
		cin >> rows >> bars >> goal;
		--goal;

		// create transition table
		int dp[2][MAX_BARS];

		REP(from, bars)
		{
			int adj[]{ from, from + 1};
			for (int to : adj)
			{
				if (to >= bars)
					continue;

				memset(dp, 0, sizeof dp);
				dp[0][0] = 1;
				
				if (from == to)
				{
					REP(i, bars - 1)
					{
						dp[0][i + 1] = dp[1][i] + dp[0][i];

						if (i == to || i + 1 == to)
							dp[1][i + 1] = 0;
						else
							dp[1][i + 1] = dp[0][i];
					}
				}
				else
				{
					REP(i, bars - 1)
					{
						if (i + 1 == to)
						{
							dp[0][i + 1] = 0;
							dp[1][i + 1] = dp[0][i];
						}
						else if (i + 1 == from)
						{
							dp[0][i + 1] = dp[0][i] + dp[1][i];
							dp[1][i + 1] = 0;
						}
						else
						{
							dp[0][i + 1] = dp[1][i] + dp[0][i];
							dp[1][i + 1] = dp[0][i];
						}
					}
				}

				transition[from][to] = transition[to][from] = dp[0][bars - 1] + dp[1][bars - 1];
			}
		}
	}
	void solve()
	{
		vector<vector<int64_t>> dp(rows + 1, vector<int64_t>(bars, 0));
		dp[0][0] = 1;

		REP(row, rows)
		{
			REP(bar, bars)
			{
				int adjs[]{ bar - 1, bar, bar + 1 };
				for (int adj : adjs)
				{
					if (adj < 0 || adj >= bars)
						continue;

					dp[row + 1][adj] += (dp[row][bar] * transition[bar][adj]) % MOD;
				}
			}
		}

		cout << dp[rows][goal] % MOD << endl;
	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

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

int main(){
    int n, i, m = -1, c = 0, an, bn, a1 = 0, a2 = 0, b1 = 0, b2 = 0;
    cin >> n;
    int a[n/2], b[n/2];
    for(i=0; i<n; i++){
        if(i%2 == 0){
            cin >> a[i/2];
        }else{
            cin >> b[i/2];
        }
    }
    sort(a, a+n/2);
    sort(b, b+n/2);
    for(i=0; i<n/2; i++){
        if(m != a[i]){
            if(c >= a1){
                a2 = a1;
                a1 = c;
                an = m;
            }else if(c > a2){
                a2 = c;
            }
            m = a[i];
            c = 1;
        }else{
            c++;
        }
    }
    if(c >= a1){
        a2 = a1;
        a1 = c;
        an = m;
    }else if(c > a2){
        a2 = c;
    }
    c = 0;
    m = -1;
    for(i=0; i<n/2; i++){
        if(m != b[i]){
            if(c >= b1){
                b2 = b1;
                b1 = c;
                bn = m;
            }else if(c > b2){
                b2 = c;
            }
            m = b[i];
            c = 1;
        }else{
            c++;
        }
    }
    if(c >= b1){
        b2 = b1;
        b1 = c;
        bn = m;
    }else if(c > b2){
        b2 = c;
    }
    if(an != bn){
        cout << n - a1 - b1;
    }else{
        cout << n - max(a1+b2, a2+b1);
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int MOD = 1000000007;

struct Pony
{
    long a, b;
 
    Pony(long a_, long b_)
    {
        a = a_;
        b = b_;
    }
 
    bool operator<(const Pony &another) const
    {
        return b < another.b;
    };
};

int fac(int k){
    int sum = 0;
    for (int i = 1; i <= k; ++i)
    {
        sum += i;
    }
    return sum;
}

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

  int n;

  cin >> n;

  cout << 3 * n * n <<endl;
}


Measured memory_bytes: 888
#include<iostream>
using namespace std;
long long aa[123456];
int dp[123456];

int main()
{
	int n;int maxx=0;int count=0;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>aa[i];
	for(int i=1;i<=n;i++)
	{
		if(aa[i]<=aa[i-1]) 
		{
			dp[i]=dp[i-1]+1;
			maxx=max(maxx,dp[i]);
			count=i;
		}
	}
	cout<<maxx<<endl;
}

Measured memory_bytes: 1408
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(c):
        if c == "r":
            return 0
        elif c == "s":
            return 1
        return 2
    def g(i,j):
        if (i+1)%3 == j:
            return 1
        return 0
    n,K = LI()
    r = LI()
    t = input()
    t = [f(i) for i in t]
    c = [1]*n
    ans = 0
    for i in range(n):
        if not c[i]:
            continue
        j = i
        l = []
        while j < n:
            l.append(j)
            c[j] = 0
            j += K
        dp = [[0]*3 for j in range(len(l))]
        for j in range(3):
            li = t[l[0]]
            dp[0][j] = r[j]*g(j,li)
        for j in range(1,len(l)):
            nj = j-1
            cj = t[l[j]]
            for k in range(3):
                q = r[k]*g(k,cj)
                for m in range(3):
                    if k == m:
                        continue
                    nd = dp[nj][m]+q
                    if dp[j][k] < nd:
                        dp[j][k] = nd

        ans += max(dp[-1])
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 60448
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif


// -------------------------------------Code starts here--------------------------------------------------------------------- 

	string a;
	cin>>a;
	int n=a.length();
	int l=0,r=n-1;
	int cnt=0;
	while (l<=r)
	{
		if(a[l]!=a[r])
		{
			cnt++;
		}
		l++;
		r--;
	}
	cout<<cnt;
		
	
// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

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

using namespace std;

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

    int n;
    cin>>n;

    int arr[n]={},num;

    for(int i=0;i<n-1;i++){
        cin>>num;

        arr[num-1]++;
    }

    for(int i=0;i<n;i++){
        cout<<arr[i]<<"\n";
    }




    return 0;
}


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

class SCC {
private:
    std::vector<std::vector<int>> gg, rg;
    std::vector<std::pair<int, int>> edges;
    std::vector<int> comp, order, used;
public:
    SCC(size_t v) : gg(v), rg(v), comp(v, -1), used(v, 0) {}

    void addEdge(int x, int y)
    {
        gg[x].push_back(y);
        rg[y].push_back(x);
        edges.push_back({x, y});
    }

    int operator[](int k)
    {
        return comp[k];
    }

    void dfs(int idx)
    {
        if (used[idx]) return;
        used[idx] = true;
        for (auto& to: gg[idx]) dfs(to);
        order.push_back(idx);
    }

    void rdfs(int idx, int cnt)
    {
        if (comp[idx] != -1) return;
        comp[idx] = cnt;
        for (auto& to: rg[idx]) rdfs(to, cnt);
    }

    void build(std::vector<std::vector<int>> &t)
    {
        for (int i{}; i < (int)gg.size(); i++)
            dfs(i);
        std::reverse(order.begin(), order.end());
        int ptr{};
        for (auto& e: order)
            if (comp[e] == -1)
                rdfs(e, ptr), ptr++;
        
        t.resize(ptr);
        std::set<std::pair<int, int>> connect;
        for (auto& e: edges)
        {
            int x{comp[e.first]}, y{comp[e.second]};
            if (x == y) continue;
            if (connect.count({x, y})) continue;
            t[x].push_back(y);
            connect.emplace(x, y);
        }
    }
};

class Solve {
private:
public:
    bool is_last_;
    Solve()
    {
        int n;
        std::cin >> n;
        if (n == 0)
        {
            is_last_ = true;
            return;
        }
        std::vector<long double> p(n);
        SCC sc(n);
        for (int i{}; i < n; i++)
        {
            std::cin >> p[i];
            int m;
            scanf("%d", &m);
            for (int j{}; j < m; j++)
            {
                int a;
                scanf("%d", &a);
                sc.addEdge(i, a - 1);
            }
        }
        std::vector<std::vector<int>> t;
        sc.build(t);
        std::vector<bool> isTop(t.size(), true);
        for (auto& e: t)
            for (auto& f: e)
                isTop[f] = false;
        std::vector<std::vector<int>> belong(t.size());
        for (int i{}; i < n; i++)
            belong[sc[i]].push_back(i);
        long double ans{1};
        for (int i{}; i < (int)t.size(); i++)
        {
            if (!isTop[i]) continue;
            long double tmp{1};
            for (auto& e: belong[i])
                tmp *= p[e];
            ans *= 1 - tmp;
        }
        printf("%.10Lf\n", ans);
    }
};

int main()
{
    while (!Solve().is_last_);
    return 0;
}


Measured memory_bytes: 3308
s = input()

num1 = int(s[:2])
num2 = int(s[2:])

def month(num):
    if 1 <= num <= 12:
        return True
    else:
        return False

if month(num1) == True and month(num2) == True:
    print('AMBIGUOUS')
elif month(num1) == True and month(num2) == False:
    print('MMYY')
elif month(num1) == False and month(num2) == True:
    print('YYMM')
else:
    print('NA')

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

#define int long long 
#define MIN -1e18
#define MAX 1e18

using namespace std;

void solve()
{
    int n;cin >> n;
    if(n==0)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //int t;cin >> t;while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 3648
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        h1: usize,
        m1: usize,
        h2: usize,
        m2: usize,
        k: usize,
    }
    let l = h2 * 60 + m2 - h1 * 60 - m1;
    println!("{}", l - k);
}


Measured memory_bytes: 2112
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

long long a[200001];

int main() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.setf(ios::showpoint);
    cout.precision(12);
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    map<long long, int> count;

    long long res = 0;
    long long sum = 0;
    count[0] = 1;
    for(int i = 0; i < n; ++i) {
        long long cur;
        cin >> cur;
        sum += cur;
        res += count[sum];
        // cout << "i = " << i << ", cur = " << cur << ", sum = " << sum << ", count = " << count[sum] << endl;
        ++count[sum];
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 12800
//#include <algorithm>
//#include <iostream>
//#include <vector>
//#include <string>
#include <stdio.h>

int MAX = 2147483647;

int D[20000000];
int n;
int l;
int n_;


int min(int a, int b)
{
    if(a < b) return a;
    else return b;
}


int initRMQ(int n)
{
    int n_ = 1;

    while(n_ < n)
        n_ *= 2;

    for(int i = 0; i < 2*n_ - 1; i++)
        D[i] = MAX;

    return n_;
}


void update(int k, int a)
{
    k += n_ - 1;
    D[k] = a;
    //printf("%d : %d\n", k, D[k]);

    while(k > 0)
    {
        k = (int)((k - 1) / 2);
        D[k] = min(D[k*2 + 1], D[k*2 + 2]);
        //printf("%d : %d\n", k, D[k]);
    }
}


int query(int a, int b, int k, int l, int r)
{
    //printf("query : %d %d %d %d %d\n", a, b, k, l, r);
    if(r <= a || b <= l)
    {
        //printf(" : ret1 %d\n", MAX);
        return MAX;
    }

    if(a <= l && r <= b)
    {
        //printf(" : ret2 %d\n", D[k]);
        return D[k];
    }

    int vl = query(a, b, k*2 + 1, l, (int)((l + r)/2));
    int vr = query(a, b, k*2 + 2, (int)((l + r)/2), r);

    //printf(" : ret3 %d\n", min(vl, vr));
    return min(vl, vr);
}


int findMin(int a, int b)
{
    return query(a, b, 0, 0, n_);
}


int main(int argc, char const* argv[])
{
    scanf("%d %d", &n, &l);

    int A[10000000];

    for(int i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        A[i] = a;
    }

    n_ = initRMQ(n);

    for(int i = 0; i < n; i++)
    {
        update(i, A[i]);
    }

    int m = findMin(0, l);
    printf("%d", m);

    for(int i = 1; i < n-l+1; i++)
    {
        int prev = D[n_-2+i];
        int next = D[n_-2+i+l];

        if(m >= next)
            m = next;

        if(m == prev)
            m = findMin(i, i+l);

        printf(" %d", m);

    }
    printf("\n");
}



Measured memory_bytes: 13908
sel='A'

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

if sel=='B':
    X=int(input())
    ans=0
    ans+=(X//500)*1000
    ans+=((X%500)//5)*5
    print(ans)

if sel=='C':
    K,N=map(int,input().split())
    A=[int(i) for i in input().split()]
    d=[A[0]+K-A[-1]]
    for i in range(N-1):
        d.append(A[i+1]-A[i])
    d.sort()
    print(K-d[-1])

# if sel=='D':




Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<unordered_map>
#include<math.h>

using namespace std;
typedef long long ll;
int k;
int ans = 0;
#define INF 10e+11 + 7
void calc(int a, int b){
	if(abs(a - b) > k){

		ans = 1;
	}
}
int main(){
	int a[5];
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
	for(int i = 0; i < 5; i++){
		for(int j = 0; j < 5; j++){
			if(i != j){
				calc(a[i], a[j]);
			}
		}
	}
	if(ans == 0){
		cout<<"Yay!"<<endl;
	}else{
		cout<<":("<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <queue>
#include <algorithm>
#include <time.h> 
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //code goes here
    int num, sum=0;
    vector<int>value;
    vector<int>cost;
    cin >> num;
    for(int i=0;i<num;i++){
        int tmp;
        cin >> tmp;
        value.push_back(tmp);
    }

    for(int i=0;i<num;i++){
        int tmp;
        cin >> tmp;
        cost.push_back(tmp);
    }

    priority_queue <long ,vector<long>, greater<long>> diff;

    for(int i=0;i<num;i++){
        diff.push(value[i] - cost[i]);
    }

    for(int i=0;i<num;i++){
        if(diff.top() >=0){
            sum += diff.top();
        }
        diff.pop();
    }
    cout<<sum;
}


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<vector<ll> > A(N, vector<ll>(N, 0));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      scanf("%lld", &A[i][j]);
    }
  }

  vector<vector<int> > needed(N, vector<int>(N, 1));
  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        ll sum = A[i][k] + A[k][j];
        if (A[i][j] > sum) {
          printf("-1\n");
          return 0;
        }
        else if (A[i][j] == sum and k != i and k != j) {
          needed[i][j] = 0;
        }
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (needed[i][j]) { ans += A[i][j]; }
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1532
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    c -= min(c, a-b);
    cout << c << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3636
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String word = input.next();
        for (int i = 0; i < word.length(); i++) {
            if ((i + 1) % 2 == 0) {
                if (word.charAt(i) == 'R') {
                    System.out.println("No");
                    return;
                }
            } else {
                if (word.charAt(i) == 'L') {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 26896
#include<stdio.h>
#define N 500000

int A[N], n;

void maxHeapify(int i){
  int a, l, r, largest;
  
  l = left(i);
  r = right(i);
  if(l <= n && A[l] > A[i]){
    largest = l;
  }
  else{ 
    largest = i;
  }
  if(r <= n && A[r] > A[largest]){
    largest = r;
  }
  if(largest != i){
    a = A[largest];
    A[largest] = A[i];
    A[i] = a;
    maxHeapify(largest);
  }
}

void buildMaxHeap(){
  int i;
  for(i = n/2 ; i >= 1 ; i--){
    maxHeapify(i);
  }
}
	      
int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){
  int i;

  scanf("%d",&n);
  for(i = 1 ; i <= n ; i++){
    scanf("%d", &A[i]);
  }
  
  buildMaxHeap();
  
  for(i = 1 ; i <= n ; i++){
    printf(" %d", A[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 2552
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int k=sc.nextInt();
	  String s=sc.next();
	  if(s.length()<=k) {
		  System.out.println(s);
	  }else {
		  System.out.println(s.substring(0, k)+"...");
	  }
  }
}

Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define pb push_back
#define read2(a, b) (read(a), read(b))
#define read3(a, b, c) (read(a), read(b), read(c))
#define lop(i,a,b) for(register int i = (a); i <= (b); ++i)
#define dlop(i,a,b) for(register int i = (a); i >= (b); --i)
#define eps (1e-7)
#define fir first
#define sec second

const int inf = 0x3f3f3f3f-1;
const int MAXN = 1e6+7;
typedef long long LL;
typedef long double LF;
typedef pair<int,int> pii;
typedef unsigned long long ULL;
typedef unsigned int uint;
template<class T> void read(T & x) {
  register int c = getchar(), f = 1; x = 0;
  while(!isdigit(c)) {if (c == '-') f = -f; c = getchar();}
  while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
int n, m;
ULL prea[MAXN], prex[MAXN], a[MAXN];
ULL ans;
int main(void) {
  #ifdef LOCAL_DEBUG
  // freopen("data.in", "r", stdin);
  #endif
  read(n);
  int l = 1;
  for(int i = 1; i <= n; ++i) read(a[i]), prea[i] = prea[i-1] + a[i], prex[i] = prex[i-1] ^ a[i];
  for(int r = 1; r <= n; ++r) {
    while(prea[r] - prea[l-1] != (prex[r] ^ prex[l-1]) && l <= r) ++l;
    ans += r-l+1;
  }
  cout << ans;
  return 0;
}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
// typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 998244353;
const lli e3 = 1 << 12;
const lli INF = 1ll << 63;

lli a,b,c;

int main(){
  cin >> a >> b >> c;
  if(b/a < c) cout << b/a << endl;
  else cout << c << endl;
}


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

#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

const int INF = 1e9 + 7;
const int N = 1e5+5;

int main() {

	IO;
	
	ll n; 
	cin >> n;
	string ans = "";
	while(n>0) {
		n--;
		char c = (n%26) + 'a';
		ans = c + ans;
		n/= 26;
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 3616
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)


Measured memory_bytes: 6072
from collections import defaultdict

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
Ddic = defaultdict(int)
Tdic = defaultdict(int)

for d in D:
    Ddic[d] += 1
for t in T:
    Tdic[t] += 1
for n, v in Tdic.items():
    Ddic[n] -= v
dv = Ddic.values()
if all(i >= 0 for i in dv):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 127572
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>

using namespace std;

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

const ll mod = 1000000007;

struct unionfind {
  vector<int> group;
  vector<int> rank;

  unionfind() {
    unionfind(0);
  }

  unionfind(int n) {
    group = vector<int>(n);
    rank = vector<int>(n);
    for (int i = 0; i < n; i++) group[i] = i;
  }

  int root(int x) {
    if (group[x] == x) return x;
    return group[x] = root(group[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rank[rx] > rank[ry]) group[ry] = rx;
    else if (rank[ry] > rank[rx]) group[rx] = ry;
    else if (rx != ry) {
      group[ry] = rx;
      rank[rx]++;
    }
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

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

  int n, m;
  cin >> n >> m;
  vector<Pii> ab(m);
  for (auto &x: ab) {
    cin >> x.first >> x.second;
    x.first--;
    x.second--;
  }

  unionfind uf(n);
  for (auto &x: ab) uf.unite(x.first, x.second);

  unordered_set<int> roots;
  for (int i = 0; i < n; i++) roots.insert(uf.root(i));

  int ans = roots.size() - 1;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7364
#include <iostream>
#include <vector>

int main() {
    int n, q;
    std::cin >> n >> q;

    std::vector<std::vector<int>> As(n);

    for (int i = 0; i < q; i++) {
        int op, t;
        std::cin >> op >> t;

        if (op == 0) {
            int x;
            std::cin >> x;
            As[t].push_back(x);
        } else if (op == 1) {
            for (int i = 0; i < As[t].size(); i++) {
                std::cout << As[t][i];
                if (i < As[t].size() - 1) {
                    std::cout << " ";
                }
            }
            std::cout << std::endl;
        } else if (op == 2) {
            As[t].clear();
        }
    }
}



Measured memory_bytes: 5856