akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
inline void adv(ll x, ll y, int &nowx, int &nowy, ll k) {
  if(abs(x - nowx) >= k) {
    if(x > nowx) {
      nowx += k;
    } else {
      nowx -= k;
    }
  } else {
    if(y > nowy) {
      nowy += k - abs(x - nowx);
    } else {
      nowy -= k - abs(x - nowx);
    }
    nowx = x;
  }
}
bool swp = false, minusx = false, minusy = false;
inline void prt(int x, int y) {
  if(swp) {
      if(minusx && minusy) {
        printf("%d %d\n", -y, -x);
      } else if(minusx) {
        printf("%d %d\n", -y, x);
      } else if(minusy) {
        printf("%d %d\n", y, -x);
      } else {
        printf("%d %d\n", y, x);
      }
    } else {
      if(minusx && minusy) {
        printf("%d %d\n", -x, -y);
      } else if(minusx) {
        printf("%d %d\n", -x, y);
      } else if(minusy) {
        printf("%d %d\n", x, -y);
      } else {
        printf("%d %d\n", x, y);
      }
    }
}
signed main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  ll k, x, y; cin >> k >> x >> y;
  minusx = false;
  minusy = false;
  swp = false;
  if(x < 0) {
    x = -x;
    minusx = true;
  }
  if(y < 0) {
    y = -y;
    minusy = true;
  }
  if(x < y) {
    swap(x, y);
    swp = true;
  }
  if(k % 2 == 0 && (x + y) % 2) {
    cout << -1 << endl;
    return 0;
  }
  int c = (k - (x + y) % k) % k;
  if(x + y < k && (x + y) % 2) {
    cout << 3 << endl;
    int nowx = x, nowy = x - k;
    prt(nowx, nowy);
    nowx = x + (k + x - y) / 2;
    nowy += k - (k + x - y) / 2;
    prt(nowx, nowy);
    prt(x, y);
  } else if(x + y < k && (x + y) % 2 == 0) {
    cout << 2 << endl;
    int nowy = -(k * 2 - x - y) / 2;
    int nowx = k - abs(nowy);
    prt(nowx, nowy);
    prt(x, y);
  } else if(x + y >= k && c % 2 == 0) {
    int nowx = 0, nowy = 0;
    ll n = (x + y - 1) / k + 1;
    cout << n << endl;
    while(nowy - k >= -(k * n - x - y) / 2) {
      nowy -= k;
      prt(nowx, nowy);
    }
    if(abs(nowy + (k * n - x - y) / 2) != 0) {
      nowx = k - abs(nowy + (k * n - x - y) / 2);
      nowy = -(k * n - x - y) / 2;
      prt(nowx, nowy);
    }
    while(nowx != x || nowy != y) {
      adv(x, y, nowx, nowy, k);
      prt(nowx, nowy);
    }
  } else if(x + y >= k && c % 2) {
    int nowx = 0, nowy = 0;
    ll n = (x + y - 1) / k + 2;
    cout << n << endl;
    while(nowy - k >= -(k * n - x - y) / 2) {
      nowy -= k;
      prt(nowx, nowy);
    }
    nowx = k - abs(nowy + (k * n - x - y) / 2);
    nowy = -(k * n - x - y) / 2;
    prt(nowx, nowy);
    while(nowx != x || nowy != y) {
      adv(x, y, nowx, nowy, k);
      prt(nowx, nowy);
    }
  }
}


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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<ll,ll>> vii;
typedef vector<vii> vvii;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i=a;i<b;i++)
#define rep_(i,a,b) for (ll i=a;i>b;--i)
#define iter(i,c) for (auto i:c)
#define ss second
#define ff first
#define D(x) cout << '>' << #x << ':' << x << endl;
#define D2(x,a) cout << '>' << #x << ':' << x << " >" << #a << ':' << a <<  endl;
#define D3(x,a,b) cout << '>' << #x << ':' << x << " >" << #a << ':' << a << " >" << #b << ':' << b << endl;
#define D4(x,a,b,c) cout << '>' << #x << ':' << x << " >" << #a << ':' << a << " >" << #b << ':' << b << " >" << #c << ':' << c << endl;
#define PS(a,st,e) if (1) {if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<""<<a[noname];}cout<<"\n";}
#define PA1(a,st,e) if (1) {if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<" "<<a[noname];}cout<<'\n';}
#define PA(a,st,e) if (1) {cout<<#a<<": [";if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<", "<<a[noname];}cout<<"]\n";}
#define PSET(c) if (1) {cout<<#c<<": {";for (auto noname:c) cout<<noname<<",";cout<<"}\n";}
#define PM(c) if (1) {cout<<#c<<": {";for (auto noname:c) cout<<noname.first<<":"<<noname.second<<", ";cout<<"}\n";}

#define MAXN 200005
#define MAXK 1000006
#define mod 1000000007

ll n, m, k, a[MAXN];
string s;
char c;

void solve() {
	ll l, r, d;
	cin>>l>>r>>d;
	ll first = l/d;
	if (l%d) first++;
	ll last = r/d;
	cout<<(last- first + 1)<<endl;
}

void aux() {
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int>  a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    
    long long res = 0;
    int right = 0;
    int sum = 0;
    for(int left = 0; left < n; left++)
    {
        while (right < n && (sum ^ a.at(right)) == (sum + a.at(right))) {
            sum += a.at(right);
            right++;
        }
        res += right - left;
        if (left == right) right++;
        else sum -= a.at(left);
    }
    
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void){
	char S[11];
	scanf("%s",&S);
	int l = strlen(S), c=0, i, j;
	int flag=0;
	
	if(S[0] == 'A'){
		for(i=2;i<l-1;i++){
			if(S[i] == 'C'){c++;j=i;}
		}
		if(c==1){
			flag = 1;
			for(i=1;i<l;i++){
				if(i!=j){
					if(islower(S[i])==0){//islower() 小文字でなければ0を返す、小文字なら0以外を返す
						flag = 0;
					}
				}
			}
		}
	}
	if(flag==1)	printf("AC");
	else printf("WA");
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3

from sys import stdin
from fractions import gcd	# math.gcd is introduced in python 3.5
from functools import reduce

def lcm(x, y):
    """The least common multiple of x and y."""
    return x * (y // gcd(x, y))

def multiples(t, N):
    """Set of multiples (<= N) of some x in t."""
    return set(i for x in t for i in range(x, N + 1, x))

def value(a, t):
    """The value of the jewels that are labeled a multiple of some x in t."""
    return sum(a[i - 1] for i in multiples(t, len(a)))

def remove(a, t):
    """Break all jewels that are labeled a multiple of some x in t."""
    for i in multiples(t, len(a)):
        a[i - 1] = 0

def tuples(m, N):
    """
    List of tuples over {m,...,N}.
    Each tuple t in the list satisfies that:
        the lcm of t is less than or equal to N, and
        t does not contain a proper multiple of some j in t.
    """
    if m > N: return [()]
    ts = tuples(m + 1, N)
    us = [(m,) + t for t in ts
          if reduce(lcm, t, m) <= N and all(j % m != 0 for j in t)]
    ts.extend(us)
    return ts

def solve(a):
    N = len(a)
    for t in tuples(1, N):
        if value(a, t) < 0: remove(a, t)
    return sum(a)

N = int(stdin.readline())
a = [int(w) for w in stdin.readline().split()]
if len(a) != N: raise
print(solve(a))


Measured memory_bytes: 5176
#include <iostream>
#include <set>
#include <utility>
#include <algorithm>
#include <vector>
#define llint long long
#define inf 1e18
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

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

llint calc(llint px, llint py, llint turn, bool flip)
{
	if(a[px][py]) return 0;
	
	llint ret = 0;
	for(int i = 0; i < 8; i++){
		bool flag = false;
		for(int j = 1; ; j++){
			llint nx = px + dx[i]*j, ny = py + dy[i]*j;
			if(nx < 0 || nx >= 8 || ny < 0 || ny >= 8) break;
			if(a[nx][ny] == 0) break;
			if(a[nx][ny] == turn){
				flag = true;
				break;
			}
		}
		if(!flag) continue;
		
		for(int j = 1; ; j++){
			llint nx = px + dx[i]*j, ny = py + dy[i]*j;
			if(nx < 0 || nx >= 8 || ny < 0 || ny >= 8) break;
			if(a[nx][ny] == 0) break;
			if(a[nx][ny] == turn) break;
			ret++;
			if(flip) a[nx][ny] *= -1;
		}
	}
	if(flip) a[px][py] = turn;
	
	return ret;
}

int main(void)
{
	char c;
	for(int y = 0; y < 8; y++){
		for(int x = 0; x < 8; x++){
			cin >> c;
			if(c == 'o') a[x][y] = 1;
			if(c == 'x') a[x][y] = -1;
			if(c == '.') a[x][y] = 0;
		}
	}
	
	llint turn = 1; bool pass = false;
	while(1){
		llint max_val = 0, max_x, max_y;
		if(turn == 1){
			for(int y = 0; y < 8; y++){
				for(int x = 0; x < 8; x++){
					llint res = calc(x, y, turn, 0);
					if(res > max_val){
						max_val = res;
						max_x = x, max_y = y;
					}
				}
			}
		}
		else{
			for(int y = 7; y >= 0; y--){
				for(int x = 7; x >= 0; x--){
					llint res = calc(x, y, turn, 0);
					if(res > max_val){
						max_val = res;
						max_x = x, max_y = y;
					}
				}
			}
		}
		if(max_val == 0){
			if(pass) break;
			pass = true;
		}
		else calc(max_x, max_y, turn, 1), pass = false;
		turn *= -1;
	}
	
	for(int y = 0; y < 8; y++){
		for(int x = 0; x < 8; x++){
			if(a[x][y] == 1) cout << "o";
			if(a[x][y] == 0) cout << ".";
			if(a[x][y] == -1) cout << "x";
		}
		cout << endl;
	}
	
	return 0;
}


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

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static int mod = 998244353;
	static long inf = (long) 1e18 + 1;
	static int[] col;
	static int n, m;
	static ArrayList<Integer>[] ad;
	static long[][][] memo;
	static HashSet<Integer> h;
	static int[] a;
	static Integer[][] g;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		if(sc.nextInt()>sc.nextInt())
			System.out.println("safe");
		else
			System.out.println("unsafe");
		out.flush();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 32700
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    int K;
    unsigned long long sum = 0;

    cin >> K;
    vector<vector<int>> gcd(K+1, vector<int>(K+1 ,0));

    for(int i=1; i<=K; ++i){
        for(int j=1; j<=K; ++j){

            if(gcd[i][j] == 0){
                gcd[i][j] = __gcd(i,j);
                gcd[j][i] = gcd[i][j];
            }

        }
    }

    for(int i=1; i<=K; ++i){
        for(int j=1; j<=K; ++j){
            for(int l=1; l<=K; ++l){
                sum += gcd[gcd[i][j]][l];
            }
        }
    }

    cout << sum << endl;

    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int h[n+1];
	for(int i=1; i<=n; i++) cin>>h[i];
	if(n==2) {cout<<h[2]-h[1]; return 0;}
	if(n==3) {cout<<h[3]-h[1]; return 0;}
	int dp[n+1];
	dp[0] = 0;
	dp[1] = 0;
	dp[2] = abs(h[2]-h[1]);
	dp[3] = abs(h[3]-h[1]);
	for(int i=4; i<=n; i++)
		{
			dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
		}
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

C = [A[0],
     A[1],
     A[2],
     [A[0][0], A[1][0], A[2][0]],
     [A[0][1], A[1][1], A[2][1]],
     [A[0][2], A[1][2], A[2][2]],
     [A[0][0], A[1][1], A[2][2]],
     [A[0][2], A[1][1], A[2][0]]]

for n in B:
    for i in range(8):
        for j in range(3):
            if C[i][j] == n:
                C[i][j] = 0

for i in range(8):
    C[i] = sum(C[i])

if 0 in C:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
from math import log10, floor
n = int(input())
l = log10(n)
if floor(l)%2 :
    s = 0
    for i in range(floor(l)) :
        if (i+1)%2 :
            s += 9*10**i
else :
    s = 0
    for i in range(floor(l)) :
        if (i+1)%2 :
            s += 9*10**i
    s += n-10**floor(l)+1
print(s)

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  string S; cin >> S;
  ll ans = 0;
  map<ll, ll> m; m[0] = 1;
  reverse(all(S));
  ll tmp = 0, ten = 1;
  REP(i, S.size()) {
    tmp += char_to_int(S[i]) * ten;
    tmp %= 2019;
    ten *= 10; ten %= 2019;
    m[tmp]++;
  }
  for(auto x: m) {
    ans += 0.5 * x.second * (x.second - 1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3756
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
 
#define rep(i,n) for(int i = 0; i < n; i++)
 
typedef long long ll;
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;
 
int main(){
  double L;
  cin >> L;
  printf("%10.10f\n", pow(L/3.,3));
}


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

using namespace std;

long double dp[302][302][302];int n;
long double solve(int i,int j,int k)
{
	if(i<0 || j<0 || k<0)
	return 0;
	if(!(i|j|k))
	return 0;
	if(dp[i][j][k]!=-1)
	return dp[i][j][k];
	
	//return dp[i][j][k]=(double)n/(i+j+k) + solve(i-1,j,k)/n+solve(i+1,j-1,k)/n+solve(i,j+1,k-1)/n;long double k1=0,k2=0,k3=0;
	return dp[i][j][k]=(long double)n/(i+j+k) + (solve(i-1,j,k)*i)/(i+j+k) + (solve(i+1,j-1,k)*j)/(i+j+k) + (solve(i,j+1,k-1)*k)/(i+j+k);
}
	
int main()
{
	
	cin>>n;int a[1000];
	
	int i,j,k;
	vector <int> f(6,0);
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		f[a[i]]++;
	}

	for(i=0;i<=301;i++)
	{
		for(j=0;j<=301;j++)
		{
			for(k=0;k<=301;k++)
			dp[i][j][k]=-1;
		}
	}
	long double ans;
	ans=solve(f[1],f[2],f[3]);
	
	cout.precision(17);
	//cout<<dp[0][1][0]<<" "<<dp[2][0][0]<<endl;
	cout<<ans<<fixed;
}


Measured memory_bytes: 430720
using System;
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]), k = int.Parse(input[1]);
            string s = Console.ReadLine();
            int[] arr = new int[n];
            int p = 0;
            char c = '1';
            int count = 0;
            for (int i=0; i<n; i++)
            {
                if (c != s[i])
                {
                    arr[p] = count;
                    c = s[i];
                    p++;
                    count = 1;
                }
                else count++;
            }
            arr[p] = count;
            //foreach(int i in arr) Console.Error.WriteLine(i);
            int ans = arr[0];
            for (int i=0; i<k && 2 * i + 2 < n; i++)
            {
                ans += arr[2 * i + 1] + arr[2 * i + 2];
            }
            //Console.Error.WriteLine(ans);
            int val = ans;
            for (int i=k; 2 * i + 2 < n; i++)
            {
                val += arr[2 * i + 1] + arr[2 * i + 2];
                int j = i - k;
                val -= arr[2 * j + 1] + arr[2 * j];
                //Console.Error.WriteLine(val);
                ans = Math.Max(val, ans);
            }
            Console.WriteLine(ans);
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 13224
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

var hopes [2][2001][2001]int

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)

	n := len(s)
	var counts [2][100001]int

	for i := 0; i < n; i++ {
		counts[0][i+1] += counts[0][i]
		counts[1][i+1] += counts[1][i]
		counts[s[i]-'0'][i+1]++
	}

	// n%2==0 11|11|11

	k := n
	for i := 0; i < n-i; i++ {
		if counts[0][n-i] == counts[0][i] {
			break
		}
		if counts[1][n-i] == counts[1][i] {
			break
		}

		k--
	}

	fmt.Fprintln(writer, k)

	writer.Flush()
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,t,a[110]={};
    cin>>k>>t;
    for(int i=0; i<t; i++){
        cin>>a[i];
    }
    sort(a,a+t,greater<int>());
    for(int i=1; i<t; i++){
        a[0]=a[0]-a[i];
    }
    if(a[0]>=1){
        cout<<a[0]-1<<'\n';
    }else{
        cout<<0<<'\n';
    }
    return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n,y;
    cin>>n>>y;
    ll noguchi=0,higuchi=0;
    rep(i,n+1){
        rep(j,n+1-i){
            if((y-(1000*i+5000*j))%10000==0&&(y-(1000*i+5000*j))/10000==n-i-j){
                printf("%d %d %d",n-i-j,j,i);
                return 0;
            }
        }
    }
    printf("-1 -1 -1");
}

Measured memory_bytes: 3760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;
 
 
public class Main {
 
    /**
     * @param args
     * @throws IOException 
     * @throws NumberFormatException 
     */
    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //int n = Integer.parseInt(br.readLine());
        int n = 2000000;
         
        PriorityQueue<Integer> pq = new PriorityQueue<Integer>(new MyComparator());
        //int[] heap = new int[n+2];
        //Arrays.fill(heap, Integer.MIN_VALUE);
        //String[] tmpArray = br.readLine().split(" ");
        String[] tmpArray;
        while(true){
            //heap[i] = new Node(Integer.parseInt(tmpArray[i - 1]));
            tmpArray = br.readLine().split(" ");
            if(tmpArray[0].equals("insert")){
                //heap[n + 1] = Integer.parseInt(tmpArray[1]);
                //buildMaxHeap(heap);
                pq.add(Integer.parseInt(tmpArray[1]));
            }
            else if(tmpArray[0].equals("extract")){
                System.out.println(pq.poll());
                //heap[1] = Integer.MIN_VALUE;
                //buildMaxHeap(heap);
                //System.out.println(heap[0]);
            }
            else {
                break;
            }
        }
        /*
        buildMaxHeap(heap);
         
        for(int i = 1; i < heap.length ; i++){
            System.out.print(" "+heap[i]);
        }
        System.out.println();
        */
    }
     
    /*
    static void maxHeapify(int[] nodes, int i){
        int l = left(i);
        int r = right(i);
         
        int largest;
        if (l <= nodes.length - 1 && nodes[l] > nodes[i]){
            largest = l;
        }
        else {
            largest = i;
        }
        if( r <= nodes.length - 1 && nodes[r] > nodes[largest]){
            largest = r;
        }
         
        if (largest != i){
            int tmp = nodes[i];
            nodes[i] = nodes[largest];
            nodes[largest] = tmp;
            maxHeapify(nodes, largest);
        }
    }
     
    static void buildMaxHeap(int[] a){
        for(int i = a.length/2 ; i >= 1 ;i--){
            maxHeapify(a, i);
        }
    }
     
    static int left(int i){
        return i*2;
    }
     
    static int right(int i){
        return i*2 + 1;
    }
     
    static int parent(int i){
        return i/2;
    }
    */
 
}

class MyComparator implements Comparator<Integer> {

	@Override
	public int compare(Integer o1, Integer o2) {
		// TODO ?????????????????????????????????????????????
		if(o1 > o2){
			return -1;
		}
		else if( o1 < o2){
			return 1;
		}
		else {
			return 0;
		}
	}
	
}

Measured memory_bytes: 232436
def dm(a, b)
  [a.to_s.length, b.to_s.length].max
end

n = gets.to_i
ans = 11
(1..Math.sqrt(n)).each do |i|
  x = n.divmod(i)
  if x[1].zero?
    ans = [ans, dm(i, x[0])].min
  end
end
puts ans

Measured memory_bytes: 14364
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
typedef pair<int,P> iP;


int main(){
    while(1){
        int w;
        scanf("%d",&w);
        if(w==-1)break;

        int cost=1150;
        w -= 10;
        if(0<w){
            if(w>10){
                cost += 1250;
            }else{
                cost += w * 125;
            }
        }

        w -= 10;
        if(0<w){
            if(w>10){
                cost += 1400;
            }else{
                cost += w * 140;
            }
        }

        w -= 10;
        if(0<w){
            cost += w * 160;
        }
        cout << 4280-cost << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
const int N=510;
char f1[N][N],f2[N][N];
int main()
{
	int n,m,i,j;cin>>n>>m;
	char c;
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++) {
			while ((c=getchar())!='#'&&c!='.');
			if (c=='#') f1[i][j]=f2[i][j]='#';
			else if (i&1) f1[i][j]='#',f2[i][j]='.';
			else f1[i][j]='.',f2[i][j]='#';
		}
	for (i=1;i<=n;i++)
		f1[i][1]=f2[i][m]='#',f1[i][m]=f2[i][1]='.';
	for (i=1;i<=n;i++) puts(f1[i]+1);
	putchar(10);
	for (i=1;i<=n;i++) puts(f2[i]+1);
	return 0;
}

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

#define    ll     long long int

ll sum = 0;
int n;
string s;

void go(int at, ll num, vector<int> v) {
    //cout << at << ' ' << num << '\n';
    if (at == n) {
        for (int i = 0; i < (int) v.size(); i++) {
            sum += v[i];
        }
        sum += num;
        return ;
    }
    v.push_back(num);
    go(at + 1, s[at] - '0', v);
    v.pop_back();
    go(at + 1, num * 10 + s[at] - '0', v);
}

int main( )
{
    cin >> s;
    n = (int) s.size();
    vector<int> v;
    go(1, s[0] - '0', v);
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 256
#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>; 
    
    ll gcd(ll x,ll y){
    	if(y==0) return x;
    	else	 return gcd(y,x%y);
    }
    int main() {
    int k;
    cin >> k;
    ll sum = 0;
    
    for(int a = 1; a <= k; a++){
    	for(int b = 1; b <= k; b++){
    		for(int c = 1; c <= k; c++){
    			sum += gcd(gcd(a,b),c);
   		    }
    	
        }
    }
    
    cout << sum <<'\n';
     
     return 0;
    }
    
    

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 int  n ;
 cin >> n ;
 vector<int> s(n) ;
 rep(i,n) cin>> s[i] ;
 sort(s.begin(),s.end()) ;
 int ans= 0 ;
 int sum =0 ;
 rep(i,n) sum+= s[i] ;
 if(sum%10!=0) {
   ans=sum ;
 }

 else{
   int hazure=-1 ;
   rep(i,n) if(s[i]%10!=0){
     hazure=s[i] ;
     break ;
   }
 if(hazure==-1) ans=0 ;
 else ans=sum-hazure ;
 
 }
 
 cout <<ans<<endl ;
     return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n;
	ll x[100], y[100], h[100];
	cin >> n;
	REP(i, n) cin >> x[i] >> y[i] >> h[i];

	REP(i, 101){
		REP(j, 101){
			//-1は決まっていない、-2は不可能
			int needh = -1;
			REP(k, n){
				if(h[k] > 0){
					int p = h[k] + abs(i-x[k]) + abs(j-y[k]);
					if(needh == -1) needh = p;
					else{
						if(needh != p){
							needh = -2;
							break;
						}
					}
				}
			}
			if(needh == -2) continue;

			REP(k, n){
				if(h[k] == 0){
					int p = h[k] + abs(i-x[k]) + abs(j-y[k]);
					if(p < needh){
						needh = -2;
						break;
					}
				}
			}
			if(needh == -2) continue;

			cout << i << ' ' << j << ' ' << needh << endl;
			return 0;
		}
	}

	return 0;
}

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

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((b - a) == (c - b) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
# coding:utf-8
import math
while True:
    n = input()
    if n == 0:
        break
    t = [0.0 for i in range(n)]
    a2 = 0.0
    array = map(float,raw_input().split())
    average = sum(array) / n
    for i in range(n):
        t[i] = math.pow(array[i]-average,2)
    a2 = sum(t) / n
    a = math.sqrt(a2)
    print a



Measured memory_bytes: 4860
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=split(readline(),"")
    if "7" in s
        println("Yes")
    else
        println("No")
    end
end
main()

Measured memory_bytes: 153012
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define endl "\n"
#define deb(x) cerr << #x << "=" << x << endl
#define debb(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define mod ((ll)1e9+7)
#define N ((ll)1e4)
#define pb push_back
#define in insert
#define F first
#define S second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
ll dr[] = { -1, 1, 0, 0};
ll dc[] = {0, 0, 1, -1};

/*Functions*/
ll gcd(ll a, ll b);
ll exp(ll x, ll y, ll p);
ll exp(ll x, ll y);
void InverseofNumber();
void InverseofFactorial();
void factorial();
ll Binomial(ll n, ll R);


ll factorialNumInverse[N + 1];
ll naturalNumInverse[N + 1];
ll fact[N + 1];

void fileIO() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main() {
    clock_t start, end;
    start = clock();
    speed
    // InverseofNumber(),InverseofFactorial(),factorial();
    // fileIO();
    ll n; cin>>n;
    ll ans=n+n*n+n*n*n;
    cout<<ans;




    end = clock();
    double timeTaken = double(end - start) * 1000 / double(CLOCKS_PER_SEC);
    deb(timeTaken);

    return 0;
}



/*All Functions*/
ll gcd(ll a, ll b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll exp(ll x, ll y, ll p) {
    ll res = 1;
    while (y) {
        if (y % 2)
            res = (res * x % p) % p;
        x = (x * x) % p;
        y /= 2;
    }
    return res;
}
ll exp(ll x, ll y) {
    ll res = 1;
    while (y) {
        if (y % 2)
            res = (res * x ) ;
        x = (x * x) ;
        y /= 2;
    }
    return res;
}
void InverseofNumber() {
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (ll i = 2; i <= N; i++)
        naturalNumInverse[i] = naturalNumInverse[mod % i] * (mod - mod / i) % mod;
}
void InverseofFactorial() {
    factorialNumInverse[0] = factorialNumInverse[1] = 1;
    for (ll i = 2; i <= N; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % mod;
}
void factorial() {
    fact[0] = 1;
    for (ll i = 1; i <= N; i++)
        fact[i] = (fact[i - 1] * i) % mod;
}
ll Binomial(ll n, ll R) {
    ll ans = ((fact[n] * factorialNumInverse[R]) % mod * (factorialNumInverse[n - R]) % mod) % mod;
    return ans;
}

Measured memory_bytes: 3756
fun main(args:Array<String>) {
    println(isYYMM(readLine()!!))
}


fun isYYMM(s:String):String {
    if(s.take(2).toInt() in (1..12)) {
        if(s.drop(2).toInt() in (1..12)) {
            return "AMBIGUOUS"
        } else {
            return "MMYY"
        }
    } else if(s.drop(2).toInt() in (1..12)) {
        return "YYMM"
    } else {
        return "NA"
    }
}


Measured memory_bytes: 35972
import scala.io.StdIn.readLine
object Main extends App {
  val in = readLine().split(" ").map(s => s.toInt)
  val div:Int = in(0) / in(1)
  val rem:Int = in(0) % in(1)
  val divD:Double = in(0).toDouble / in(1).toDouble
  print("%d %d %.10f\n".format(div, rem, divD))
}

Measured memory_bytes: 44104
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

s = sys.stdin.buffer.readline().decode().rstrip()
ans = INF
for i in range(len(s ) - 2):
    a = int(s[i: i+3])
    ans = min(ans, abs(753 - a))


print(ans)


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



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

    int N, Y;
    cin >> N >> Y;
    for(int tt = 0; tt <= N; tt++){
        if(10000 * tt > Y){
            break;
        }
        int remain = Y - 10000 * tt;
        int bills = N - tt;
        //5000 * F + 1000 * (bills - F) = remain
        //4000 * F + 1000 * bills = remain
        //F = (remain - 1000 * bills) / 4000
        if((remain - 1000 * bills) % 4000){
            continue;
        }
        int F = (remain - 1000 * bills) / 4000;
        if(0 <= F && F <= bills){
            cout << tt << " " << F << " " << bills - F << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1";
}


Measured memory_bytes: 256
N = int(input())

A = list(map(int,input().split()))

S = A[0]
X = A[0]
l = 0
r = 0
count = 0

while r < N and l <= r:
    if S == X and r < N-1:
        r += 1
        S += A[r]
        X = X ^ A[r]
    elif S == X and r == N-1:
        count += r-l+1
        l += 1
        S -= A[l-1]
        X = X ^ A[l-1]
    else:
        count += r-l
        l += 1
        S -= A[l-1]
        X = X ^ A[l-1]
    #print([l,r,count])

print(count)

Measured memory_bytes: 25556
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n];
    map<ll,ll>m1,m2;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        m1[arr[i]+i]++;
        if((i-arr[i])>0)
        m2[i-arr[i]]++;
    }
    ll sum=0;
    for(auto itr=m1.begin();itr!=m1.end();itr++)
    {
        if(m2.find(itr->first)!=m2.end())
        sum+=((itr->second)*m2[itr->first]);
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 20428
#include<cstdio>
#include<algorithm>
using namespace std;
int aa[100090];
main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i;
		for(i=0;i<n;i++)
		{
			scanf("%d",&aa[i]);
		}
		sort(aa,aa+n);
		int k=n/2+1;
		int kk=aa[k-1]-aa[k-2];
		printf("%d\n",kk);
		
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int K; cin >> K;
    vll a(K); for(auto& e : a) cin >> e;
    reverse(_all(a));

    ll l = 2, u = 2; // [l, u]
    for(auto& e : a){
        ll nl = l + e - 1; nl = nl - (nl % e);
        ll nu = u / e * e + e - 1;

        if(nl > nu){
            cout << -1 << endl;
            return 0;
        }
        l = nl, u = nu;
    }

    cout << l << " " << u << endl;

    return 0;
}


Measured memory_bytes: 1024
n = int(input())
l = []
for i in range(n):
    l.append(list(map(int, input().split())))

l.sort(key = lambda x:x[1])

# print(l)

curTime = 0
f = False

for i in l:
    curTime += i[0]

    if curTime > i[1]:
        f = True
        break


if f:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 53720
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
 
using namespace std;
 
#define MOD 1000000007
#define A first
#define B second
 
typedef long long ll;
 
inline int mulmd(ll a, ll b){
  ll ret = (a * b) % MOD;
  return (int) ret;
}
 
inline int power(ll x, ll y, int m){
  ll res = 1;
  x = x % m;
  while(y > 0){
    if(y & 1){
      res = mulmd(res, x);
    }
    y = y >> 1;
    x = mulmd(x, x);
  }
  return (int) res;
}
 
inline int submd(ll a, ll b){
  ll ret = (a - b);
  if(ret < 0) ret += MOD;
  return (int) ret;
}
 
inline int addmd(ll a, ll b){
  ll ret = (a + b) % MOD;
  return (int) ret;
}
 
inline int invPow(ll a){
  return power(a, MOD - 2, MOD);
}
 
inline int divmd(ll a, ll b){
  ll ret = mulmd(a, invPow(b));
  return (int) ret;
}
 
const int N = 1e5 + 5;

int arr[N];

void solve(){
  int n;
  cin >> arr[0] >> arr[1] >> arr[2];
  sort(arr, arr + 3);
  if(arr[0] == arr[1] && arr[1] != arr[2]){
    cout << "Yes";
  }
  else if(arr[1] == arr[2] && arr[0] != arr[1]){
    cout << "Yes";
  }
  else {
    cout << "No";
  }
  
}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[105],i,j,k,n,sum=0;
int main()
{
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    //sort(a,a+n);
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i]&&a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
                {
                    //printf("%d %d %d\n",i+1,j+1,k+1);
                    sum++;
                }
            }
        }
    }
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 3864
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

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

    int a, b, c;
    cin >> a >> b >> c;
    if( b + c > a ) cout << c - ( a - b );
    else cout << 0;
    cout << endl;
    return 0;
}



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

int main () {
    int N,Y;
    scanf("%d %d", &N, &Y);

    int a = 0;
    int b = 0;
    int c = 0;
    for(int i = 0; i<=N; i++) {
        for(int j = 0; j<=N; j++) {
            int tmp_c = N - (i + j);
            if(i * 10000 + j * 5000 + tmp_c * 1000 == Y && tmp_c >= 0) {
                printf("%d %d %d", i, j, tmp_c);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
A = []
is_checked = []
res = False

for i in range(3):
    A.append(list(map(int, input().split())))

N = int(input())

b = {int(input()) for i in range(N)}

for i in range(3):
    is_checked.append([False]*3)
    for j in range(3):
        if A[i][j] in b:
            is_checked[i][j] = True

for i in range(3):
    if is_checked[i][0] and is_checked[i][1] and is_checked[i][2]:
        res = True
    if is_checked[0][i] and is_checked[1][i] and is_checked[2][i]:
        res = True

if is_checked[0][0] and is_checked[1][1] and is_checked[2][2]:
    res = True
if is_checked[0][2] and is_checked[1][1] and is_checked[2][0]:
    res = True

print(['No', 'Yes'][res])

Measured memory_bytes: 9188
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    char ch;
    int a[26] = {};
    while (cin >> ch) {
        ch = tolower(ch);
        if (isalpha(ch)) {
            a[ch - 'a']++;
        }
    }
    for (int i = 0; i < 26; i++) {
        printf("%c : %d\n", 'a' + i, a[i]);
    }
}
    


Measured memory_bytes: 3220
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
#define tc int t;cin>>t;while(t--)
#define get cin>>
#define geta ll a[n];for (int i = 0; i < n; ++i){cin>>a[i];}
#define puta for (int i = 0; i < n; ++i){cout<<a[i];}
#define put cout<<
ll maxi=LLONG_MIN;
ll mini=LLONG_MAX;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
int main() 
{
   fast();
   int n;cin>>n;
   double p[n+1];
   for (int i = 1; i <= n; ++i)
   {
       cin>>p[i];
   }
   double dp[n+1][n+1];
   memset(dp, 0, sizeof(dp));
   dp[0][0]=1;
   for(int i = 1; i <= n; i++)
    {
        double head=p[i],tail=1-p[i];

        dp[0][i] = tail*dp[0][i-1];

        for(int heads = 1; heads <= i;++heads)
        {
            dp[heads][i] = head*dp[heads - 1][i - 1] + tail*dp[heads][i - 1];
        }
    }
    double ans = 0;
    for(int i = n/2 + 1; i <= n; ++i)
    {
        ans += dp[i][n];
    }
    cout << setprecision(9) << ans;
    return 0;
}


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

using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve() 
{
	int n , x;
	
	cin >> n >> x;
	
	int a[100005] {};
	int l[n+1] {};
	int b[n+1] {};
	
	a[0]++;
	
	for(int i = 1; i <= n; ++i) {
		cin >> l[i];
		b[i+1] = b[i] + l[i];
		a[b[i+1]]++;
	}
	
	int ans = 0;
	
	for(int i = 0; i <= x; ++i) {
		ans += a[i];
	}
	
	cout << ans;
}

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


Measured memory_bytes: 4424
import java.util.Scanner;

public class Main {

  public static String[] bubble_sort(String[] a) {
    for (int i = 0; i < a.length; i++) {
      for (int j = a.length - 1; j >= i+1; j--) {

        int j_val = Integer.parseInt(a[j].substring(1));
        int j_minus_val = Integer.parseInt(a[j-1].substring(1));

        if (j_val < j_minus_val) {
          String tmp = a[j];
          a[j] = a[j-1];
          a[j-1] = tmp;
        }

      }
    }

    display_cards(a);
    display_stability(true);

    return a;
  }

  public static String[] selection_sort(String[] a) {
    boolean stable = true;
    for (int i = 0; i < a.length; i++) {
      int mini = i;

      int i_val = Integer.parseInt(a[i].substring(1));

      int same_value_seen_at = a.length;
      for (int j = i; j < a.length; j++) {

        int j_val = Integer.parseInt(a[j].substring(1));
        int mini_val = Integer.parseInt(a[mini].substring(1));

        if (j > i && j_val == mini_val)
          same_value_seen_at = j;

        if (j_val < mini_val)
          mini = j;
      }
      if (mini > same_value_seen_at)
        stable = false;
      String tmp = a[i];
      a[i] = a[mini];
      a[mini] = tmp;
    }

    display_cards(a);
    display_stability(stable);

    return a;
  }

  public static void display_cards(String[] a) {
    for (int i = 0; i < a.length; i++) {
      System.out.print(a[i]);
      if (i != a.length - 1)
        System.out.print(" ");
      else
        System.out.print("\n");
    }
  }

  public static void display_stability(boolean stable) {
    if (stable)
      System.out.println("Stable");
    else
      System.out.println("Not stable");
  }


  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    String[] a = new String[n];
    for (int i = 0; i < n; i++)
      a[i] = s.next();
    s.close();
    String[] b = a.clone();

    String[] bubble_sorted = bubble_sort(a);
    String[] selection_sorted = selection_sort(b);
  }
}



Measured memory_bytes: 26792