akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;



void solve()
{       
    double r;
    cin>>r;
    cout<<r*M_PI*2<<endl;
}   

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

    // ll t;
    // cin >> t;

    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 3800
#include<iostream>
using namespace std;
int find_4combi(int n) {
	int cnt = 0;
	for(int i=0;i<=9999;i++) {
		int a[4];
		int ci = i;
		for(int j=0;j<4;j++) {
			a[j] = ci % 10;
			ci = ci / 10;
		}
		if(a[0]+a[1]+a[2]+a[3] == n)
			cnt++;
	}
	return cnt;
}
int main() {
	int n;
	while(cin >> n) {
		int ncombi = find_4combi(n);		
		cout << ncombi << endl;
	}
}

Measured memory_bytes: 1160
s = list(input())
t = list(input())
m = 0
for i in range(len(s)-len(t)+1):
    x = 0
    for j in range(len(t)):
        if t[j] == s[i+j]:
            x+=1
    if x > m:
        m = x
ans = len(t)-m
print(ans)

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

int main() {
  string s;
  cin >> s;
  int aidx = -1, zidx;
  for (int i = 0; i < s.size(); i++) {
    if (aidx == -1 && s.at(i) == 'A') {
      aidx = i;
    } else if (s.at(i) == 'Z') {
      zidx = i;
    }
  }
  cout << zidx - aidx + 1 << endl;
}

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

ll binary_search(
    ll lo, ll hi, function<bool(ll)> is_ok,
    bool maximize
){
    while(lo < hi){
        if(maximize){
            const ll mid = (lo + hi + 1) / 2;
            if(is_ok(mid)){
                lo = mid;
            }else{
                hi = mid - 1;
            }
        }else{
            const ll mid = (lo + hi) / 2;
            if(is_ok(mid)){
                hi = mid;
            }else{
                lo = mid + 1;
            }
        }
    }
    return lo;
}

long long K;
std::vector<long long> A;

ll f(ll mid){
    REP(i, K){
        mid -= mid % A.at(i);
    }
    return mid;
}

void solve(){
    ll lo = 2;
    ll hi = 2;
    REP(i, K){ hi += A.at(i) - 1; }
    while(lo < hi){
        ll mid = (lo + hi + 1) / 2;
        ll fmid = f(mid);
        if(fmid == 2){
            lo = mid;
        }else if(fmid > 2){
            hi = mid - 1;
        }else{ // fmid < 2
            lo = mid + 1;
        }
    }
    if(f(lo) != 2){
        cout << -1 << endl;
        return;
    }
    const ll ans_max = lo;

    ll ans_min = binary_search(
        2, ans_max,
        [&](ll mid) -> bool {
            REP(i, K){
                mid -= mid % A.at(i);
            }
            return mid == 2;
        },
        false
    );

    cout << ans_min << ' ' << ans_max << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    scanf("%lld",&K);
    A.resize(K);
    for(int i = 0 ; i < K ; i++){
        scanf("%lld",&A[i]);
    }
    solve();
    return 0;
}


Measured memory_bytes: 1024
<?php
list($n) = ints();
for ($i = 0; $i < $n; $i++) {
    list($t[], $x[], $y[]) = ints();
}
$ct = $cx = $cy = 0;
for ($i = 0; $i < $n; $i++) {
    $d = abs($x[$i] - $cx) + abs($y[$i] - $cy);
    $dt = $t[$i] - $ct;
    if ($d > $dt || ($dt - $d) % 2) exit('No');
    $ct = $t[$i];
    $cx = $x[$i];
    $cy = $y[$i];
}
echo 'Yes';

function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 355, max_m = 1000011, inf = 1000111222;
const ll inff = 1000111222333444;

int n, d[max_n];
vector<int> v[max_n];

int bfs(int x) {
    queue<int> q;
    q.push(x);
    memset(d, -1, sizeof(d));
    d[x] = 0;
    int mx = 0;
    while (q.size()) {
        x = q.front();
        q.pop();
        for (int to : v[x]) {
            if (d[to] != -1 && abs(d[to] - d[x]) != 1) {
                return -1;
            }
            if (d[to] == -1) {
                d[to] = d[x] + 1;
                mx = d[to];
                q.push(to);
            }
        }
    }
    return mx + 1;
}

char c[max_n];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        scanf("%s", c);
        for (int q = 0; q < n; ++q) {
            if (c[q] == '1') {
                v[i].push_back(q);
                v[q].push_back(i);
            }
        }
    }
    int ans = -1;
    for (int i = 0; i < n; ++i) {
        int xx = bfs(i);
        if (xx != -1) {
            ans = max(ans, xx);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool visited[100020];
int col[100020];
void dfs(int a, ll b,vector<int> edges[],vector<int> cost[])
{

    for(int i=0;i<edges[a].size();i++)
    {
        if(!visited[edges[a][i]])
        {
        if((b+cost[a][i])%2==0)
        {
            col[edges[a][i]]=0;
        }
        else
            col[edges[a][i]]=1;
        visited[edges[a][i]]=true;
        dfs(edges[a][i], b+cost[a][i],edges, cost);
        }
    }
}
int main()
{
    int n;
    cin>>n;
    vector<int> edges[n+1];
    vector<int> cost[n+1];
    for(int i=0;i<n-1;i++)
    {
        ll a, b, c;
        cin>>a>>b>>c;
        edges[a].push_back(b);
        cost[a].push_back(c);
        edges[b].push_back(a);
        cost[b].push_back(c);
    }
    col[1]=0;
    visited[1]=true;
    dfs(1,0,edges, cost);
    for(int i=1;i<=n;i++)
        cout<<col[i]<<" ";
}


Measured memory_bytes: 14208
n, a, b = list(map(int, input().split()))
p = 10**9+7

def binom(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)

    res = factinv[r] % p
    for i in range(r):
        res = res * (n - i) % p

    return res % p

factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, min(n, 2*10**5) + 1):
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

res = pow(2, n, p)

res -= 1
res = (res - binom(n, a, p)) % p
res = (res - binom(n, b, p)) % p

print(res)

Measured memory_bytes: 94628
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        String ans = s;
        int left = 0;
        int right = 0;

        int c = 0;

        if (s.charAt(0) == '(') {
            left++;
        } else {
            right++;
        }

        while( ++c < s.length() ) {
            if(s.charAt(c) == '(') {
                if(right > 0) {
                    for(int i=0; i<right; i++) {
                        ans = '(' + ans;
                    }
                    right = 0;
                    left = 1;
                } else {
                    left++;
                }
            } else {
                if(left > 0) {
                    left--;
                } else {
                    right++;
                }
            }
        }

        for(int i=0; i<left; i++) {
            ans = ans + ')';
        }

        for(int i=0; i<right; i++) {
            ans = '(' + ans;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
def bubble_sort(n, a):
  flag = True
  count = 0
  while flag:
    flag = False
    for i in range(n - 1):
      if a[i] > a[i + 1]:
        a[i], a[i + 1] = a[i + 1], a[i]
        flag = True
        count += 1
  print(*a)
  print(count)

bubble_sort(int(input()), [int(i) for i in input().split()])



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

int main() {
    string s, t;
    cin >> s >> t;

    int cnt = 0;
    int i;
    for(i = 0; i < (int)s.size(); i++) {
        if (s[i] != t[i]) {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 3844
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]


import math
import itertools


def distanse(x1, y1, x2, y2):
  return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def isValid(ox, oy, r):
  # global ox, oy, r
  global xy
  for x, y in xy:
    if distanse(x, y, ox, oy) - r > 1e-6:
      return False
  return True


rs = []
for (x1, y1), (x2, y2) in itertools.combinations(xy, r=2):
  dprint(x1, y1, x2, y2)
  r = distanse(x1, y1, x2, y2) / 2
  ox = (x1 + x2) / 2
  oy = (y1 + y2) / 2
  dprint(ox, oy, r)
  if isValid(ox, oy, r):
    rs.append(r)
# for c1, c2 in itertools.combinations(xy, r=2):
#   dprint(c1, c2)
#   r = distanse(c1, c2)
#   o=(c1+c2)/2

for (x1, y1), (x2, y2), (x3, y3) in itertools.combinations(xy, r=3):
  # http://www.ambrsoft.com/TrigoCalc/Circle3D.htm
  a = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2
  b = (x1**2 + y1**2) * (y3 - y2) + (x2**2 + y2**2) * \
      (y1 - y3) + (x3**2 + y3**2) * (y2 - y1)
  c = (x1**2 + y1**2) * (x2 - x3) + (x2**2 + y2**2) * \
      (x3 - x1) + (x3**2 + y3**2) * (x1 - x2)
  d = (x1 ** 2 + y1 ** 2) * (x3 * y2 - x2 * y3) + (x2 ** 2 + y2 ** 2) * \
      (x1 * y3 - x3 * y1) + (x3 ** 2 + y3 ** 2) * (x2 * y1 - x1 * y2)
  if a == 0:
    continue
  ox = -b / (2 * a)
  oy = -c / (2 * a)
  r = math.sqrt((b ** 2 + c ** 2 - 4 * a * d) / (4 * a ** 2))
  if isValid(ox, oy, r):
    rs.append(r)

dprint(rs)
print('{:.18f}'.format(min(rs)))


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	int n, a, b;
	cin>>n>>a>>b;
	cout<<min(n*a, b);	
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}

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

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; ++i) {
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    
    int ans = 0;
    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            for (int k = j + 1; k < n; ++k) {
                if (l[j] - l[i] < l[k] && l[k] < l[j] + l[i]) ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
/*  Seventeen and we got a dream to have a family           */
/*  A house and everything in between                       */
/*  And then, oh, suddenly we turned twenty-three           */
/*  Now we got pressure for taking our life more seriously  */
/*  We got our dead-end jobs and got bills to pay           */
/*  Have old friends and know our enemies                   */
/*  Now I, I'm thinking back to when I was young            */
/*  Back to the day when I was falling in love              */
/*  He used to meet me on the Eastside                      */
/*  In the city where the sun don't set                     */

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll t=1;
//cin>>t;
while(t--)
{


ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll xo=0;
for(i=0;i<n;i++)
xo^=a[i];

for(i=0;i<n;i++)
cout<<(xo^a[i])<<" ";
cout<<endl;

}
return 0;
}






Measured memory_bytes: 5144
#include<bits/stdc++.h>
using ll = int_fast64_t;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define SCAN(vec) for(auto &i:vec)scanf("%d",&i)

int main(){
        int n;
        scanf("%d", &n);
        int a[n+1], b[n], c[1+n];
        a[n] = c[n] = 1e9+7;
        REP(i, 0, n) scanf("%d", &a[i]);
        REP(i, 0, n) scanf("%d", &b[i]);
        REP(i, 0, n) scanf("%d", &c[i]);
        std::sort(a, a+n+1);
        std::sort(b, b+n);
        std::sort(c, c+n+1);

        ll ans = 0, posa = 0, posc = 0;
        REP(i, 0, n){
            while(a[posa]<b[i]) posa++;
            while(c[posc]<=b[i]) posc++;
            ans += posa * (n-posc);
        }
        printf("%ld\n", ans);
        return 0;
}

Measured memory_bytes: 4956
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<sstream>

#define reps(i,f,n) for(int i = int(f); i <= int(n); ++i)
#define rep(i,n) reps(i,0,n-1)
#define rep2(i,j,n,m) rep(i,n)rep(j,m)
#define pii pair<int,int>
#define ppi pair<int,pii>
#define X first 
#define Y second

using namespace std;

const int INF = 1e9;

int w,h;
int wall[256][256];

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

void bfs(){
  queue<ppi> q;
  q.push(ppi(1,pii(0,0)));

  while(!q.empty()){
    int d = q.front().X;
    int x = q.front().Y.X;
    int y = q.front().Y.Y; q.pop();
    if(cell[y][x] != INF)continue;
    //cout << "cell " << y << "," << x << endl;
    cell[y][x] = d;
    rep(i,4){
      if( x + dx[i] < 0 || w <= x + dx[i] ) continue;
      if( y + dy[i] < 0 || h <= y + dy[i] ) continue;
      switch(i){
        case 0: //left
          if(wall[y*2][x-1] != 0) continue;
          break;
        case 1: //right
          if(wall[y*2][x] != 0) continue;
          break;
        case 2: //down
          if(wall[y*2+1][x] != 0) continue;
          break;
        case 3: //up
          if(wall[y*2-1][x] != 0) continue;
          break;
      }
      //cout << y << "," << x << ":" << d  << "->" << i << endl;
      q.push(ppi(d+1,pii(x+dx[i],y+dy[i])));
    }
  }
}

int main(void){
  while(1){
    rep2(i,j,256,256)wall[i][j]=-0;
    rep2(i,j,256,256)cell[i][j]=INF;
    cin >> w >> h;
    if(w == 0) break;

    rep(i, 2*h-1){
      if(i % 2 == 0) rep(j,w-1){
        cin >> wall[i][j];
      }else rep(j,w){
        cin >> wall[i][j];
      }
    }
    bfs();
    if(cell[h-1][w-1] == INF){
      cout << 0 << endl;
    }else{
      cout << cell[h-1][w-1] << endl;
    }
  }
  return 0;
}

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

int main() {
    int a,c;
    string b;
    cin >> a>>b>>c;
    //cout <<a << c;
    if (b=="+"){
        cout << a+c;
    }else{
        cout << a-c;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
	boolean check(int[] array, int start, int sum, int key) {
		int tmpsum;
		for (int i = start; i < array.length; i++) {
			tmpsum = sum;
			tmpsum += array[i];
			if (tmpsum == key) return true;
			if (tmpsum < key) {
				if (check(array, i+1, tmpsum, key)) return true;
			}
		}
		return false;
	}
	
	void run() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = br.readLine().split(" ");
		int[] A = new int[str.length];
		for (int i = 0; i < str.length; i++) {
			A[i] = Integer.parseInt(str[i]);
		}
		int q = Integer.parseInt(br.readLine());
		str = br.readLine().split(" ");
		for (int i = 0; i < str.length; i++) {
			boolean flag = false;
			for (int j = 0; j < A.length; j++) {
				if (A[j] == Integer.parseInt(str[i])) {
					flag = true;
					break;
				}
				if (check(A, j+1, A[j], Integer.parseInt(str[i]))) {
					flag = true;
					break;
				}
				else flag = false;
			}
			if (flag) System.out.println("yes");
			else System.out.println("no");
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}



Measured memory_bytes: 25392
import sys

def fill(s): return '0' * (6 - len(s)) + s
def create_id(p, o): return fill(str(p)) + fill(str(o))

n, m, *py = map(int, sys.stdin.read().split())
pyi = sorted(zip(*[iter(py)] * 2 + [range(m)]))

def main():
    res = [None] * m
    prev = j = None
    for p, y, i in pyi:
        j = j + 1 if p == prev else 1
        res[i] = create_id(p, j)
        prev = p
    print(*res, sep='\n')
    
if __name__ ==  '__main__':
    main()

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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll n,m;
	cin>>n>>m;
	(n==m)?cout<<"Yes\n":cout<<"No\n";
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
vi a, b;
ll cur;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, x;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x;
		a.pb(x);
	}
	for(int i = 0; i < n; i++){
		cin >> x;
		b.pb(x);
	}
	cur = 0;
	for(int i = 0; i < n; i++){
		if(b[i]<a[i]){
			cur-=a[i]-b[i];
		}
		else{
			cur+=(b[i]-a[i])/2;
		}
	}
	if(cur>=0){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main(void){
  char b[10];
  int i=0;
  int count=0;
  int end=0;
  int cont=0;
  int max;

  scanf("%s",b);

    do{
      cont=1;
      if(strncmp(&b[i],"A",1)==0){
        count++;
        cont=0;
      }
      if(strncmp(&b[i],"C",1)==0){
        count++;
        cont=0;
      }
      if(strncmp(&b[i],"G",1)==0){
        count++;
        cont=0;
      }
      if(strncmp(&b[i],"T",1)==0){
        count++;
        cont=0;
      }

      if(cont==1){
        if(max<count){
          max=count;
    
        }
        count=0;
      }

      i++;
    }while(i<=10);
    printf("%d",max);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a,const void *b){
	return *(int*)a - *(int*)b;
}

int x[100000000];

int main(void){
	int n;
	int i,j;
	int count = 1;
	int ans = -1;
	while(scanf("%d",&n)){
		if(n == 0){
			break;
		}
		if(n == 1){
			scanf("%d",&x[0]);
			printf("%d\n",x[0]);
			continue;
		}
		for(i = 0;i < n;i++){
			scanf("%d",&x[i]);
		}
		qsort(x,n,sizeof(int),compare_int);
		/*for(i = 0;i < n + 3;i++){
			printf("%d ",x[i]);
		}
		printf("\n");*/
		for(i = 0;i < n - 1;i++){
			if(x[i] == x[i+1]){
				for(j = i;j < n - 1;j++){
					if(x[j] == x[j+1]){
						count++;
					}
					else{
						break;
					}
				}
			}
			if(count > n / 2){
				ans = x[i];
				break;
			}
			count = 1;
		}
		if(ans == -1){
			printf("NO COLOR\n");
			count = 1;
		}
		else{
			printf("%d\n",ans);
			ans = -1;
			count = 1;
		}
	}
	return 0;
}

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

int main()
{
  string s,t,c;
  int a,b;
  cin >> s >> t >> a >> b;
  cin >> c;
  if(s==c)
    a--;
  else if(t==c)
    b--;
  
  cout << a << " " << b << endl;
  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 rep1(i,n) for(int i=1;i<= (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

const static ll MOD = (1e+9)+7;

int main(){
    string S;cin>>S;
    int i = S.size()-1;
    bool flg = 0;
    string a = "dream",b="dreamer",c="erase",d="eraser";
    while(1){
        if(S[i] == 'm'){
            //dreamという文字列が入っているか判定.
            int j = a.size()-1;
            while(i>-1 && j>-1){
                if(S[i]!=a[j]){
                    flg = 1;
                    break;
                }
                i--;j--;
            }
            //もし途中で切れて終わっていたらOUT
            if(i==-1 && j != -1){
                flg = 1;
                break;
            }
        }else if(S[i] == 'e'){
            //eraseという文字列が入っているか判定.
            int j = c.size()-1;
            while(i>-1 && j>-1){
                if(S[i]!=c[j]){
                    flg = 1;
                    break;
                }
                i--;j--;
            }
            //もし途中で切れて終わっていたらOUT
            if(i==-1 && j != -1){
                flg = 1;
                break;
            }
        }else if(S[i] == 'r'){
            //次の文字はe?
            if(i == 0 || S[i-1] != 'e'){
                flg = 1;break;
            }
            i--;
            //次の文字はe?m?
            if(i == 0){
                flg = 1;break;
            }else if(S[i-1]=='s'){
                //上と同じ判別方法.
                //eraseという文字列が入っているか判定.
                int j = c.size()-1;
                while(i>-1 && j>-1){
                    if(S[i]!=c[j]){
                        flg = 1;
                        break;
                    }
                    i--;j--;
                }
                //もし途中で切れて終わっていたらOUT
                if(i==-1 && j != -1){
                    flg = 1;
                    break;
                }

            }else if(S[i-1]=='m'){
                i--;
                //dreamという文字列が入っているか判定.
                int j = a.size()-1;
                while(i>-1 && j>-1){
                    if(S[i]!=a[j]){
                        flg = 1;
                        break;
                    }
                    i--;j--;
                }
                //もし途中で切れて終わっていたらOUT
                if(i==-1 && j != -1){
                    flg = 1;
                    break;
                }
            }else{
                flg=1;break;
            }
        }else{
            //それ以外なら強制退場.
            flg = 1;
            break;
        }
        //途中でbreakされずに、無事i==-1にたどり着けたらクリア
        if(i == -1)break;
    }
    if(flg == 1)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 5e5+9;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =1e9+7;
const double PI = acos(-1);
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
ll fact[N],ifact[N];
ll ncr(ll n,ll r){
    ll ans = ((fact[n]*ifact[r])%mod*ifact[n-r]);
    ans%=mod;
    return ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif  
    int t = 1;
    // cin>>t;
    fact[0] = 1;
    ifact[0] = 1;
    for(int i = 1;i<N;i++){
        fact[i] = i*fact[i-1];
        fact[i]%=mod;
        ifact[i] = powm(i,mod-2)*ifact[i-1];
        ifact[i]%=mod;
    }
    while(t--){
        ll n,m;cin>>n>>m;
        // if(n==m){

        // }
        ll ans = ncr(m,n)*fact[n];
        ans%=mod;
        ans*=ans;
        ans%=mod;
        // cout<<ans<<'\n';

        for(int i = 1;i<=n;i++){
            ll val = ((((ncr(n,i)*ncr(m,i))%mod)*ncr(m-i,n-i))%mod)*ncr(m-i,n-i);
            val%=mod;
            val*=fact[n-i];
            val%=mod;
            val*=fact[n-i];
            val%=mod;
            val*=fact[i];
            val%=mod;
            if(i%2){
                ans-=val;
                ans = (ans+mod)%mod;
            }
            else{
                ans+=val;
                ans%=mod;
            }
        }
        cout<<ans<<'\n';
    }
} 

Measured memory_bytes: 11464
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#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 <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit

void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return;
        }


        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return;
        }
    }
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3040
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
using namespace std;
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout<<endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
typedef pair<int, int> P;

signed main() {
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int N,K;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K;
    cout << N-K+1<<"\n";
}

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

using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair


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

      //freopen("a.txt", "r", stdin);
      
      vector<ll> nums;
      queue <ll> q;

      for (int i = 1; i < 10; ++i)
            q.push(i);

      while (nums.size() <= 1e5 + 40) {
            ll t = q.front();
            q.pop();
            nums.push_back(t);
            ll ch = t % 10;
            if (ch > 0) {
                  q.push(t * 10 + ch - 1);
            }
            q.push(t * 10 + ch);
            if (ch < 9) {
                  q.push(t * 10 + ch + 1);
            }
      }
      
      int k;
      cin >> k;
      cout << nums[k - 1];
    
      return 0;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x%2==0)
        {
            if(x%3&&x%5)
            {
                cout<<"DENIED";
                return 0;
            }
        }
    }
    cout<<"APPROVED";
    
} 



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

#define F first
#define S second
const int LIM = 1e9+5;

using namespace std;
typedef pair<int,int> P;
int n,m;
vector<P> V;

void input(){
  cin >> n >> m;
  V.resize(n);
  for(int i = 0; i < n; i++) cin >> V[i].F >> V[i].S;
}

void solve(){
  sort(V.begin(),V.end());

  for(int i = 0; i < m; i++){
    int l,r,d,u;
    scanf("%d %d %d %d",&l,&d,&r,&u);
 
    int ans = 0;
    vector<P>::iterator ite = lower_bound(V.begin(),V.end(),P(l,-LIM));
    
    while(ite < V.end()){
      if(ite->F > r) break;
      if(d <= ite->S && ite->S <= u) ans++;
      ite++;  
    }
    printf("%d\n",ans);
  }
}

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

Measured memory_bytes: 1264
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;



llint H, W;


llint solve(){
	llint ans = INF;
	llint s1, s2, s3;
	rep(i, 1, H){
		s1 = i*W;
		s2 = (H-i)*(W/2);
		s3 = H*W-(s1+s2);
		ans = min(ans, max({ s1, s2, s3 })-min({ s1, s2, s3 }));
		s2 = ((H-i)/2)*W;
		s3 = H*W-(s1+s2);
		ans = min(ans, max({ s1, s2, s3 })-min({ s1, s2, s3 }));
	}
	rep(i, 1, W){
		s1 = i*H;
		s2 = (W-i)*(H/2);
		s3 = H*W-(s1+s2);
		ans = min(ans, max({ s1, s2, s3 })-min({ s1, s2, s3 }));
		s2 = ((W-i)/2)*H;
		s3 = H*W-(s1+s2);
		ans = min(ans, max({ s1, s2, s3 })-min({ s1, s2, s3 }));
	}
	return ans;
}


signed main(){
	cin >> H >> W;

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

const char premark = 'a' - 1;

bool dfs(map<char, vector<char>>& G, vector<bool>& vis, char c) {
  for(auto& next: G[c]) {
    if(vis[next-'a']) return false;
    vis[next-'a'] = 1;
    if(!dfs(G, vis, next)) return false;
    vis[next-'a'] = 0;
  }
  return true;
}

void NG() {
  cout << "no" << endl;
}

int main() {

  for(int N; cin >> N && N;) {
    vector<string> v;
    int L = 1;
    rep(i, N) {
      string s; cin >> s;
      v.push_back(s);
      maximize(L, s.size());
    }
    rep(i, N) {
      v[i].resize(L, premark);
    }

    map<char, vector<char>> G;
    vector<bool> vis;

    rep(i, N-1) {
      REP(ni, i+1, N) {
        rep(j, L) {
          if(v[i][j] == v[ni][j] && v[i][j] == premark) break;
          if(v[i][j] == premark) break;
          if(v[ni][j] == premark) { NG(); goto ex; }
          if(v[i][j] == v[ni][j]) continue;
          G[v[i][j]].push_back(v[ni][j]);
          break;
        }
      }
    }

    REP(c, 'a','z'+1) if(!G[c].empty()) {
      sort(all(G[c]));
      G[c].erase(unique(all(G[c])), G[c].end());
    }

    REP(c, 'a','z'+1) {
      vis.clear(); vis.resize(26);
      vis[c-'a'] = 1;
      if(!dfs(G, vis, c)) { NG(); goto ex; }
    }

    cout << "yes" << endl;
    ex:;
  }
  
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	string s;
	getline(cin,s);
	while(n--){
		vector<int> b;
		getline(cin,s);
		int pos = 0;
		while(~s.find("Hoshino",pos)){
			pos = s.find("Hoshino",pos)+1;
			b.push_back(pos-1);
		}
		for(int i=0;i<b.size();i++)
			s.replace(b[i],7,"Hoshina");
		cout << s << endl;
	}
}

Measured memory_bytes: 0
n,m=map(int,input().split())

h=list(map(int,input().split()))
ans=[0]*n

for i in range(m):
  a,b=map(int,input().split())
  a=a-1
  b=b-1
  if h[a]==h[b]:
    ans[a]+=1
    ans[b]+=1
  elif h[a]>h[b]:
    ans[b]+=1
  else:
    ans[a]+=1
#print(ans)
print(ans.count(0))

Measured memory_bytes: 20080
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    string S; cin >> S;
    if (S.back() == 's') S += "es";
    else S += "s";
    OUT(S)

    return 0;
}

Measured memory_bytes: 3652
itos = ["A", "B", "C"]

def swap(ABC, f, t):
    ABC[f] -= 1
    ABC[t] += 1
    return itos[t]


def main():
    N, A, B, C = map(int, input().split())
    S = [input() for i in range(N)]
    ABC = [A, B, C]
    StoP = {"AB": (0, 1), "BC": (1, 2), "AC": (0, 2)}
    itos = ["A", "B", "C"]
    L = []
    for i in range(N):
        x, y = StoP[S[i]]

        if ABC[x] == 0 and ABC[y] == 0:
            print("No")
            return
        if ABC[x] == 1 and ABC[y] == 1 and i < N - 1 and S[i] != S[i+1]:
            x2, y2 = StoP[S[i+1]]
            if x in [x2, y2]:
                L.append(swap(ABC, y, x))
            else:
                L.append(swap(ABC, x, y))
        elif ABC[x] < ABC[y]:
            L.append(swap(ABC, y, x))
        else:
            L.append(swap(ABC, x, y))

    print("Yes")
    print(*L, sep='\n')
if __name__ == '__main__':
    main()

Measured memory_bytes: 90176
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int solve(int a){
    int res=0;
    while(a){
        res+=a%10;
        a/=10;
    }
    return res;
}

//#define int ll
signed main(){
    int n;
    cin>>n;
    int ans=1<<30;
    rep(i,1,n){
        int x=solve(i)+solve(n-i);
        ans=min(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa

using namespace std;

int bruh (int a, int b) {
  return a/b + (a%b > 0);
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, x, t; cin >> n >> x >> t;
  cout << t*bruh(n,x);
  return 0;
}


Measured memory_bytes: 3616
import Foundation

let abhm = readLine()!.split(separator: " ").map { Double($0)! }
let (a, b, h, m) = (abhm[0], abhm[1], abhm[2], abhm[3])

let hour = h + m / 60
let angle = hour * 11 * Double.pi / 6
let squaredResult = a * a + b * b - 2 * a * b * cos(angle)

print(squaredResult.squareRoot())


Measured memory_bytes: 13776
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    int x = a-b;
    // c = min(x,c-x);
    // c = max(0LL,c);
    for(int i=0;i<x;i++){
        if(c==0){
            break;
        }
        c--;
    }
    cout<<c<<endl;
    return 0;
    
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    
    for(int i = 3; i <= n; i++){
        if(i % 3 == 0){
            cout << " " << i;
        }
        else {
            int b = 1;
            for(int j = 0; j < 5; j++){
                int a = i / b;
                if(a % 10 == 3){
                    cout << " " << i;
                    break;
                    
                }
                b *= 10;
            }
        }
    }
    cout << endl;
    
    return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A+B>C+D) {
      cout << "Left" << endl;
  }
  else if (A+B<C+D) {
      cout << "Right" << endl;
  }
  else {
      cout << "Balanced" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll A, B;
    cin >> A >> B;
    if (A <= 9 && B <= 9) {
        cout << A * B << endl;
    } else {
        cout << -1 << endl;
    }
}

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

#define M 1000000
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return (key/(M-1))+1; }

int find(char str[]){
  long long i,j,k;
  
  k = getKey(str);
  
  for(i=0; ; i++){
    j= (h1(k)+i*h2(k))%M;

    if(strcmp(H[j],str)==0)return 1;
    else if(strlen(H[j])==0)return 0;
  }
  return 0;
      
    /* your task */

}

int insert(char str[]){
  long long i,j,k;

  k=getKey(str);
  for(i=0; ; i++){
    j = (h1(k)+i*h2(k))%M;
    /* your task */
    if(strcmp(H[j],str)==0)return 1;
    else if(strlen(H[j])==0){
      strcpy(H[j],str);
      return 0;
    }
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



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

using namespace std;

int main(void){

    int a, b;
    cin >> a >> b;
    int ans = 0;

    if(a >= 2) ans += (a*(a-1)/2);
    if(b >= 2) ans += (b*(b-1)/2);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
string s;
int main() {
  cin >> n >> s;
  for (int i = 0; i < s.size(); ++i) {
    s[i] = ((s[i] + n) - 'A') % 26 + 'A';
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a1,a2,a3 = 0;
    int total =0;

    cin >> a1 >> a2 >> a3 ;

    total = a1+a2+a3;

    if(total >= 22) cout <<"bust";
    else cout << "win";
  
    return 0;
}

Measured memory_bytes: 256