akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define REP(i, k, n) for(int i=(int)(k); i<(int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 998244353;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

ll num[400010];

int main(){
	int N; cin >> N;
	int X[N];
	ll val[N];
	rep(i, N){
		char c; cin >> c;
		X[i] = c - '0';
		if(i==0) val[i] = X[i];
		else val[i] = (2*val[i-1] + X[i])%mod;
	}
	vector<int> div;
	for(int i=1; i*i<=2*N; i++){
		if((2*N) % i == 0){
			if(N % i != 0) div.pb(i);
			if(i*i != 2*N && i%2 == 1) div.pb((2*N)/i);
		}
	}
	ll ans = 0;
	sort(all(div));
	rep(i, div.size()){
		int L = div[i]/2;
		num[div[i]] = (num[div[i]] + val[L-1]) % mod;
		int f = 1, ju = 0;
		rep(j, N/L){
			rep(k, L){
				if(ju) break;
				if(j%2==0){
					if(X[j*L+k] != X[k]){
						ju = 1;
						if(X[j*L+k] < X[k]) f = 0;
					}
				}else{
					if(X[j*L+k] != 1-X[k]){
						ju = 1;
						if(X[j*L+k] < 1-X[k]) f = 0;
					}
				}
			}
			if(ju) break;
		}
		num[div[i]] = (num[div[i]] + f) % mod;
		for(int j=2; j<=(2*N/div[i]); j++){
			num[div[i]*j] = (num[div[i]*j] + mod - num[div[i]]) % mod;
		}
		ans = (ans + div[i] * num[div[i]] % mod) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>
    #include <algorithm>
    using namespace std;
    using ll = long long;
     
    int main() {
        ll X, K, D;
        cin >> X >> K >> D;
        X = abs(X);
     
        ll straight = min(K, X / D);
        K -= straight;
        X -= straight * D;
     
        if (K % 2 == 0) {
            cout << X << endl;
        } else {
            cout << D - X << endl;
        }
     
        return 0;
    }

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

int main()
{
	int A,B,C;
	cin >> A >> B >> C;
	if(C >= B/A){
		cout << (int)B/A << endl;
	}else{
		cout << (int)C << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]

cnt = 1

while len(s)-cnt > 0:

    l = (len(s)-cnt)//2
    
    
    if s[0:l] == s[l:len(s)-cnt]:
        
        break
    
    
    cnt += 1
    
    
print(l*2)
        
    

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

int main() {
	int n;
	while (scanf("%d", &n), n) {
		set<string>se;
		rep(i, n) {
			string s; cin >> s;
			string s1; s1 += s[0];
			for (int i = 1; i < s.size(); i++) {
				switch (s[i - 1]) {
				case'a':case'i':case'u':case'e':case'o':
					s1 += s[i];
					break;
				}
			}
			se.insert(s1);
		}
		if (se.size() != n) {
			puts("-1");
			continue;
		}
		for (int i = 1;; i++) {
			set<string>s1;
			for (auto s : se)
				s1.insert(s.substr(0, min((int)s.size(), i)));
			if (s1.size() == n) {
				printf("%d\n", i);
				break;
			}
		}
	}
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int l = Integer.parseInt(st.nextToken());
		String[] ss = new String[n];
		for (int i = 0; i < n; i++)
			ss[i] = br.readLine();
		Arrays.sort(ss);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++)
			sb.append(ss[i]);
		System.out.println(sb);
	}
}


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

int main(){
    double a, b, c, d, e, f;
    double x, y;
    while(cin >> a >> b >> c>>d>>e>>f){
        y = (a*f-d*c)/(a*e-b*d);
        x = (c-b*y)/a;
        printf("%.3f %.3f\n", x, y);
    }
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)

int main() {
    int N,A,B;
    cin >>N>>A>>B;
    //-----------------------------------
    int ans=min(A*N,B);


    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 256
import math

n = int(input())
X = [int(x) for x in input().split()]
Y = [int(y) for y in input().split()]

d1 = 0
d2 = 0
d3 = 0
Di = []

for i in range(n) :
    d1 += abs(X[i] - Y[i])
print(f"{d1:.6f}")

for i in range(n) :
    d2 += abs(X[i] - Y[i]) ** 2
print(f"{math.sqrt(d2):.6f}")

for i in range(n) :
    d3 += abs(X[i] - Y[i]) ** 3
print(f"{math.pow(d3, 1/3):.6f}")
    
for i in range(n) :
    Di.append(abs(X[i] - Y[i]))
print(f"{max(Di):.6f}")


Measured memory_bytes: 5712
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N,M;
    cin >> N >> M;
    priority_queue<double> q;
    REP(i, N){
        int a;
        cin >> a;
        q.push((double)a);
    }

    REP(i, M){
        auto t = q.top();q.pop();
        q.push(t/2.0);
    }

    ll ans = 0;
    REP(i, N){
        auto t = q.top();q.pop();
        ans += (int)t;
    }
    pr(ans);
}

Measured memory_bytes: 1400
module WeightedDirectedGraph
  (Weight : sig
    type t
    val inf : t (* オーバーフローの恐れはないので，max_intとか突っ込んでも良い *)
    val zero : t
    val neg_inf : t (* オーバーフローの恐れはないので，min_intとか突っ込んでも良い *)
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end) :
sig
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  val bellman_ford :
    (* 頂点数n *)
    int ->
    (* 辺のリスト
       頂点は0からn-1までの整数でなくてはならない *)
    (int * int * Weight.t) church_list ->
    (* 始点 *)
    int ->
    (* 頂点を受け取り，そこまでの距離を返す関数
       頂点に到達するパスが無ければinfを返し，
       そこに到達するまでに負閉路があればneg_infを返す *)
    (int -> Weight.t)
end =
struct
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  let bellman_ford n es s =
    (* 距離を覚えるやつ *)
    let d = Array.make n Weight.inf in
    (* 自己辺の最小のコスト *)
    let self = Array.make n Weight.inf in
    (* 始点より終点のインデックスが大きくなる辺を集めた隣接リスト *)
    let inc = Array.make n [] in
    (* 始点より終点のインデックスが小さくなる辺を集めた隣接リスト *)
    let dec = Array.make n [] in
    es.fold (fun ((u, v, c) as e) () ->
      match compare v u with
      | 0 -> if 0 < Weight.compare self.(u) c then self.(u) <- c
      | cmp when 0 < cmp -> inc.(u) <- e :: inc.(u)
      | _ -> dec.(u) <- e :: dec.(u)) ();
    (* 自己辺は最初に緩和する必要がある *)
    Array.iteri (fun v c ->
      if 0 < Weight.compare Weight.inf c then
        inc.(v) <- (v, v, c) :: inc.(v)) self;
    d.(s) <- Weight.zero;
    (* 各辺のの処理 *)
    let f i is_modified (u, v, c) =
      (* 原点から到達できない頂点は更新しない *)
      if 0 <= Weight.compare d.(u) Weight.inf
      then is_modified
      else
        let dv =
          if 0 <= Weight.compare Weight.neg_inf d.(u)
          then Weight.neg_inf
          else let open Weight in d.(u) + c in
        if 0 <= Weight.compare dv d.(v)
        then is_modified
        (* n / 2 回目以降に書き換わった場合，vまでの経路に負閉路が含まれている *)
        else (d.(v) <- if i <= succ n lsr 1 then Weight.neg_inf else dv; true) in
    let rec iter = function
      | 0 -> ()
      | i ->
          if
            Array.fold_right (Fun.flip (List.fold_left (f i))) dec @@
            Array.fold_left (List.fold_left (f i)) false inc
          then iter (i - 1) in
    iter n;
    Array.get d
end

module G = WeightedDirectedGraph (struct
  type t = int
  let zero = 0
  let inf = min_int
  let neg_inf = max_int
  let ( + ) = ( + )
  let compare x y = compare y x
end)

let () = Scanf.scanf "%d %d %d\n" @@ fun n m p ->
  let abc = Array.init m @@ fun _ ->
    Scanf.scanf "%d %d %d\n" @@ fun a b c -> a - 1, b - 1, c - p in
  let d = G.bellman_ford n { G.fold = fun f -> Array.fold_right f abc } 0 (n - 1) in
  if max_int <= d
  then print_endline "-1"
  else Printf.printf "%d\n" @@ max 0 d


Measured memory_bytes: 6168
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c,k,ans;
  cin >> a >> b >> c >> k;
  if(k % 2)ans = b - a;
  else ans = a - b;
  if(abs(ans) >1000000000000000000)cout << "Unfair" << endl;
  else cout << ans << endl;
}

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


int main() { 
    int n;
    cin >> n;
    vector<int> c(n-1),s(n-1),f(n-1);
    for (int i=0;i<n-1;i++) cin >> c[i] >> s[i] >> f[i];
    for (int i=0;i<n;i++) {
        int ans=0;
        for (int j=i;j<n-1;j++) {
            if (ans%f[j]!=0) ans+=f[j]-ans%f[j];
            ans=max(ans,s[j])+c[j];
        }
        cout << ans << endl;
    }
}

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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

string s;
ll ans, sum, rs[505];

int main() {
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        ans += sum - rs[s[i]];
        rs[s[i]]++;
        sum++;
    }
    cout << ans + 1ll;
}


Measured memory_bytes: 640
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

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

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

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int N;
    string s;
    cin >> N >> s;
    int ans = 0;
    for(int i = 0; i < 1000; i++){
        int thr = i / 100;
        int two = (i - thr*100) / 10;
        int one = (i - thr*100) % 10;
        vector<char> check = {(char)('0' + thr),(char)('0'+ two),(char)('0'+one)};
        int count = 0;
        bool flag = false;
        for(int j = 0; j < N; j++){
            if(check[count] == s[j]) count++;
            if(count  == 3){
                flag = true;
                break;
            } 
        }
        if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	// your code goes here
	int N;
	cin>>N;
	int num;
	int odd=0;
	int even=0;
	for(int i=0;i<N;++i){
		cin>>num;
		if(0==num%2){
			++even;
		}else{
			++odd;
		}
	}
	while(2<=odd+even){
		if(1<=odd/2){
			odd-=2;
			++even;
		}else if(1<=even/2){
			--even;
		}
		if(1==odd&&1==even){
			break;
		}
	}
	if(2==odd+even){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
flg = True
max_num = 0
for i in range(n):
	if h[i] - 1 >= max_num:
		max_num = max(h[i] - 1, max_num)
	elif h[i] == max_num:
		max_num = max_num
	else:
		flg = False
		break

if flg == True:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 14396
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String ans = "";
		for(int i = 0; i < str.length(); i++) {
			char c = str.charAt(i);
			if(c == '9') { c = '1'; }
			else { c = '9'; }
			ans += String.valueOf(c);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 998244353;
const ll mod1 = 2e18 + 7;
const double tiaohe = 0.57721566490153286060651209;
const int inf = 0x3f3f3f3f;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 5;
int t;
char s[10][10], tmp[10][10];
int main()
{
	//freopen("in.txt", "r", stdin);
	int n;
	int h, w, k;
	while (cin >> h >> w >> k)
	{
		f(i, 1, h)scanf("%s", s[i] + 1);
		int ans = 0;
		f(i, 0, ((int)pow(2, w+h) - 1))
		{
			/*f(i, 1, h)
			{
				f(j, 1, w)cout << s[i][j] << " ";
				cout << endl;
			}*/
			//cout << endl;
			memcpy(tmp, s, sizeof s);
			f(j, 0, h + w - 1)
			{
				if (i>> j & 1)
				{
					//debug("sdddddd");
					if (j <= h - 1)
					{
						f(p, 1, w)tmp[j+1][p] = '.';
					}
					else
					{
						
						f(p, 1, h)tmp[p][j+1-h] = '.';
					}
				}
			}
			int cot = 0;
			f(i, 1, h)
			{
				f(j, 1, w)if (tmp[i][j] == '#')cot++;
			}
			if (cot == k)ans++;
		
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 4148
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


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


int main() {
	map<string, int> m;
	int mv = 0;
	string a, b;
	for (string s; cin >> s; ) {
		if(mv < ++m[s]) {
			mv = m[s];
			a = s;
		}
		if(b.size() < s.size()) b = s;
	}
	cout << a << ' ' << b << endl;
	
	return 0;
}

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

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

  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int cnt = K, g = 1;
  while (cnt < N) {
    g++;
    cnt += (K - 1);
  }
  cout << g << endl;

  return 0;
}


Measured memory_bytes: 3704
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <string>

#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

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

    vector<int> a(n);
    REP(i, m * 2){
        int bridge;
        cin >> bridge;

        a[bridge-1]++;
    }   

    REP(i, n)   cout << a[i] << endl;
}

Measured memory_bytes: 256
# seishin.py
N = int(input())
P = [2, 5, 63, 20, 30]
if N < 6:
    print(*P[:N])
    exit(0)

def gen():
    i = 0
    while 1:
        i += 1
        if i % 6 in [1, 5]:
            i += 1
        yield i
S = set()
s = 0
g = gen()
while len(S) < N:
    v = next(g)
    S.add(v)
    s += v
if s % 6 == 2:
    S.remove(8); s -= 8
    v = next(g)
    while v % 6 != 0:
        v = next(g)
    S.add(v); s += v
elif s % 6 == 3:
    S.remove(9); s -= 9
    v = next(g)
    while v % 6 != 0:
        v = next(g)
    S.add(v); s += v
elif s % 6 == 5:
    S.remove(9); s -= 9
    v = next(g)
    while v % 6 != 4:
        v = next(g)
    S.add(v); s += v
print(*S)

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

	public static void main(String[] args){

		Main main = new Main();
		main.solve();
	}

	private void solve() {

		Scanner sc = new Scanner (System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();

		int time = T/A;
		System.out.println(time*B);
	}
}

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

int main() {
  string word;
  cin >> word;
  size_t size = word.length();
  if (word[size-1] == 's') {
    cout << word << 'e' << 's' << endl;
  }
  if (word[size-1] != 's') {
    cout << word << 's' << endl;
  }
  
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else { return false; } }
long long dp[110][110000];
int main() {
  int N, W; cin >> N >> W;
  int weight[110];
  int value[110];
  for (int i = 0; i < N; i++) {
    cin >> weight[i] >> value[i];
  }
  for (int i = 0; i < 110000; i++) dp[0][i] = 0;

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= W; j++) {
      if (weight[i - 1] <= j) {
        dp[i][j] = value[i - 1] + dp[i - 1][j - weight[i - 1]];
        chmax(dp[i][j], dp[i - 1][j]); 
      } else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }

  cout << dp[N][W] << endl;

  return 0;
}


Measured memory_bytes: 88192
//~ #include<bits/stdc++.h>
//~ using namespace std;
//~ using lli = long long int;
//~ using ld = long double;
//~ using ulli = unsigned long long int;
//~ #define filein freopen ("in.txt", "r", stdin)
//~ #define fileout freopen ("out.txt", "w", stdout)
//~ #define dbg(args...) do {cerr << #args << " : "; debug(args); } while(0)
//~ #define all(v) ((v).begin()),((v).end())
//~ #define size(x) (int) x.size() 
//~ #define pb emplace_back
//~ #define mp make_pair
//~ #define PI 3.14159265
//~ #define mod 1000000007
//~ void debug () {cerr << endl;}
//~ template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//~ template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
//~ template < typename T, typename ... hello>void debug( T arg, const hello &... rest) {cerr << arg << ' ';debug(rest...);}
//~ const lli maxN = 20000;
//~ string get_res(lli n){
	//~ char str[maxN];
	//~ int i = 0;
	//~ while(n > 0){
		//~ int rem = (int) (n % 26);
		//~ if(rem == 0){
			//~ str[i++] -= 'z';
			//~ n = (n / 26) - 1;
		//~ }else{
			//~ str[i++] = (rem - 1) + 'a';
			//~ n /= 26;
		//~ }
	//~ }
	//~ str[i] = '\0';
	//~ reverse(str,str + strlen(str));
	//~ return str;
//~ }
//~ int main(){
	//~ ios::sync_with_stdio(false);
    //~ cin.tie(nullptr);
    //~ lli n;
    //~ cin >> n;
    //~ cout << get_res(n);
//~ }


//~ 1 2 3 4 = 10
//~ 2 2 3 4 = 11
//~ 2 2 4 4 = 12
//~ 4 4 4 4 = 16


#include <bits/stdc++.h>
using namespace std;
string excel(long long int n)
{
    long long int a,b,c,d,rem;
    string str1,str="abcdefghijklmnopqrstuvwxyz";
    while(n!=0)
    {
        rem=n%26;
        n=n/26;
        if(rem==0)
        {
            str1+=str[25];
            n--;
        }
        else
        {
            str1+=str[rem-1];
        }
    }
    reverse(str1.begin(),str1.end());
    return str1;
}
int main()
{
    long long int n;
    cin>>n;
    cout<<excel(n);
}


Measured memory_bytes: 3628
/*
 * 153-a
 */
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
  int h, a;
  int cnt = 0;

  scanf("%d %d", &h, &a);

  while (h > 0) {
    h -= a;
    cnt++;
  }

  printf("%d\n", cnt);
  return (0);
}
  


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

# 出力
max_distance = e - a
if max_distance <= k:
  print('Yay!')
else:
  print(':(')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long long
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
#define ar array 
using namespace std;
ll nof[1000005];
int main(){
  ll n;
  cin>>n;
  
  for(ll i=1;i<=1000000;i++){
  	 for(ll j=i;j<=1000000;j+=i){
  	 	 nof[j]++;
	   }
   }
   
   
   ll ans=0;
   for(ll i=1;i<n;i++) ans+=nof[n-i];
   
   cout<<ans<<endl;
    
    
    
    
    
    
	
   
}
  

Measured memory_bytes: 11440
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
	int R[MAX], n;
	cin >> n;
	for(int i = 0;i < n;i++) cin >> R[i];
	
	int maxv = -2000000000;
	int minv = R[0];
	
	for(int i = 1;i < n;i++)
	{ 
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	cout << maxv << endl;
	
	return 0 ;
}


Measured memory_bytes: 3916
/* AtCoder Grand Contest 018. Task , by Abreto<m@abreto.net>. */
#include <stdio.h>

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

int main(void)
{
    int N = 0, K = 0;
    int maxA = 0, Ai = 0;
    int gcdA = 0;
    scanf("%d %d", &N, &K);
    scanf("%d", &Ai);
    maxA = Ai; gcdA = Ai;
    while(--N)
    {
        scanf("%d", &Ai);
        if(Ai > maxA) maxA = Ai;
        gcdA = gcd(gcdA, Ai);
    }
    if(K > maxA || K % gcdA)
        puts("IMPOSSIBLE");
    else
        puts("POSSIBLE");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = LLONG_MAX/4;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    string a = "g";
    ll n = s.size();
    rep(i,n-1){
        if(a[i] == 'g')a += "p";
        else a += "g";
    }
    ll res = 0;
    rep(i,n){
        if(s[i] == 'g' && a[i] == 'p')res++;
        if(s[i] == 'p' && a[i] == 'g')res--;
    }
    cout << res << endl;
}

Measured memory_bytes: 640
# coding: utf-8

import math

a, b = map(int, input().split())

a_target1 = a / 0.08
a_target2 = (a + 1) / 0.08

b_target1 = b / 0.1
b_target2 = (b + 1) / 0.1


result_list = []

for i in range(math.ceil(a_target1), math.ceil(a_target2)):
    if i >= b_target1 and i < b_target2:
        result_list.append(i)

if result_list == []:
    print(-1)
else:
    result = min(result_list)
    print(result)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int K;
	cin >> K;
	string S;
	cin >> S;
	if ((int) S.size() <= K) {
		cout << S << endl;
	} else {
		for (int i = 0; i < K; i++) {
			cout << S[i];
		}
		cout << "..." << endl;
	}
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
#define MAXN 3010

vi V[MAXN];
ll A[MAXN];
ll N,a,b;
ll sub[MAXN];
ll val[MAXN];
ll low[MAXN];

void dfs(ll x, ll p){
	sub[x] = A[x]; val[x] = 0; 
	vpi tmp;tmp.clear();
	ll t = 0;
	for (auto v:V[x])if(v!=p){
		dfs(v,x);
		sub[x] += sub[v]; val[x] += (sub[v] + val[v]);
		tmp.pb(sub[v] + val[v], v);
		t += sub[v] + val[v];
	}
	if (SZ(tmp) == 0)return;
	sort(ALL(tmp));
	// if (x == 2)for (auto v:tmp)cout<<v.f<<' '<<v.s<<'\n';
	ll largest = low[tmp.back().s] + sub[tmp.back().s];
	// cout<<tmp.back().s<<' '<<low[tmp.back().s]<<' '<<sub[tmp.back().s]<<'\n';
	ll tar = t - tmp.back().f;
	if (tar >= largest){
		low[x] = t%2;
	}else{
		low[x] = largest - tar;
	}
	// cout<<"Dfs "<<x<<' '<<low[x]<<'\n';
}

ll ans = LONG_LONG_MAX;

int main(){
	cin>>N;
	string S;cin>>S;
	for (ll i=1;i<=N;++i)if(S[i-1] == '1')A[i]=1;
	for (ll i=1;i<N;++i){cin>>a>>b;V[a].pb(b);V[b].pb(a);}
	for (ll i=1;i<=N;++i){
		memset(low,0,sizeof(low));
		// if (i==1)continue;
		dfs(i,-1);
		if (low[i] != 0)continue;
		ll t = 0;
		for (auto v:V[i])t += sub[v] + val[v];
		ans = min(ans, t/2);
	}
	if (ans == LONG_LONG_MAX)cout<<-1;
	else cout<<ans;
}

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

int main() {
  string S;
  int K;
  cin >> S >> K;
  
  int64_t ans = 0;
  int n = S.size();
  
  //最初と最後が同じときその範囲を調べる
  int roop_s = n - 1, roop_e = 0;
  if (S.at(0) == S.at(n - 1)) {
    for (int i = 0; i < n; i++) {
      if (S.at(0) == S.at(i)) {
        roop_e = i;
      } else {
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (S.at(n - 1) == S.at(i)) {
        roop_s = i;
      } else {
        break;
      }
    }
    //ansへの処理
    if (roop_e == n - 1) {
      ans = (int64_t)n * K / 2;
    } else {
      //初め、最後、それ以外を足す
      ans += (roop_e + 1) / 2;
      ans += (n-1 - roop_s + 1) / 2;
      ans += (((int64_t)n + roop_e + 1) - roop_s) / 2 * (K - 1);
    }
  } else {
    roop_s = n;
    roop_e = -1;
  }
  
  //roopの範囲外で調べる
  //roop_e == n - 1のとき調べない
  int64_t eqc_n = 1;
  
  if (roop_e == n - 1) {
  } else {
    char prev = S.at(roop_e + 1);
    for (int i = roop_e + 2; i < roop_s; i++) {
      char cuc = S.at(i);
      if (cuc == prev) {
        eqc_n++;
      } else {
        ans += eqc_n / 2 * K;
        eqc_n = 1;
      }
      if (i == roop_s - 1) {
        ans += eqc_n / 2 * K;
      }
      prev = cuc;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
loop do
  n, x = gets.split.map &:to_i
  break if n == 0 and x == 0
  cnt = 0
  (1..n).each do |i|
    (i+1..n).each do |j|
      (j+1..n).each do |k|
        cnt += 1 if i+j+k == x
      end
    end
  end
  p cnt
end


Measured memory_bytes: 6856
import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        final long A = s.nextLong();
        final long B = s.nextLong();
        final long C = s.nextLong();
        long K = s.nextLong();

        long calcVal = 0 ;
        if (K - A > 0) {
            calcVal = A;
            K -= A;

        } else {
            calcVal = K;
            System.out.println(calcVal);
            return;
        }

        if ( K - B > 0) {
            K -= B;
        } else {
            System.out.println(calcVal);
            return;
        }

        if (K - C > 1) {
            calcVal += C * -1;
        } else {
            calcVal += K * -1;
        }
        System.out.println(calcVal);
    }
}

Measured memory_bytes: 27068
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
LL mod = 1000000007;

int main(){
    int N;
    cin >> N;
    vector<int> a(N+1);
    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    for(int i = 2;i <= N;i++){
        int b = i;
        for(int j = 2;j*j <= b;j++){
            if(b%j == 0){
                while(b%j == 0){
                    a[j]++;
                    b /= j;
                }
            }
        }
        if(b > 1)   a[b]++;   
    }
    LL ans = 1;
    for(int i = 1;i <= N;i++){
        ans *= a[i]+1;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def func(u):
    if u=="r":
        return "p"
    elif u =="s":
        return "r"
    else:
        return "s"

def func1(memo):
    rcount = memo.count("r")
    pcount = memo.count("p")
    scount = memo.count("s")
    if rcount ==0:
        return "r"
    elif pcount == 0:
        return "p"
    else:
        return "s"

N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
score = 0
memory = []
for i in range(0,N):
    te = func(T[i])
    memory1 = []
    memory1.append(te)
    hantei = True
    if i>=K:
        if te == memory[i-K]:
            if i+K<=N-1:
                te = T[i]
                memory1.append(te)
                te1 = func(T[i+K])
                if te1==te:
                    te = func1(memory1)
            hantei = False

    if hantei == True:
        if te == "r":
            score+=R
        elif te == "s":
            score+=S
        else:
            score+=P
    memory.append(te)

print(score)

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

int main() {
    int n, K; cin >> n >> K;
    vector<int> a(n);
    for (auto &ai: a) cin >> ai;
    vector<long long> acc(n + 1);
    for (int i = 0; i < n; i++) acc[i + 1] = acc[i] + a[i];
    long long ans = 0;
    for (int k = 40; k >= 0; k--) {
        ans |= 1LL << k;
        int cnt = 0;
        for (int l = 0; l < n; l++) for (int r = l + 1; r <= n; r++) {
            if (((acc[r] - acc[l]) & ans) == ans) cnt++;
        }
        if (cnt < K) ans ^= 1LL << k;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

std::vector<std::vector<LL>>G;
std::vector<LL>dist;

void dfs(LL v, LL d, LL p)
{
	dist[v] = d;
	for (LL u : G[v])
	{
		if (u != p) dfs(u, d + 1, v);
	}
}

int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N), b(N);
	rep(i, N) in >> a[i] >> b[i];

	G.resize(N + 1); dist.resize(N + 1);
	LL maxD_num = 0, maxD_index, diameter = 0;
	rep(i, N)
	{
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}
	dfs(1, 0, -1);
	for (LL i = 1; i <= N; ++i)
	{
		if (maxD_num < dist[i])
		{
			maxD_num = dist[i];
			maxD_index = i;
		}
	}
	dfs(maxD_index, 0, -1);
	for (LL i = 1; i <= N; ++i) diameter = std::max(diameter, dist[i]);

	out << (diameter % 3 == 1 ? "Second" : "First") << std::endl;
}


Measured memory_bytes: 25216
from collections import deque

n,q = map(int,input().split())

S = deque([deque() for _ in range(n)])
for i in range(q):
    query = tuple(map(int,input().split()))

    if query[0] == 0:
        S[query[1]].append(query[2])
    elif query[0] == 1:
        if len(S[query[1]]) != 0:
            print(S[query[1]][0])
    else:
        if len(S[query[1]]) != 0:
            S[query[1]].popleft()


Measured memory_bytes: 14612
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

ll n, a, b, c;
vector<ll> l(10);

//long to binary
string ternary(ll n){
    if(n == 2)return "2";
    else if(n == 1)return "1";
    else if(n == 0)return "0";

    return ternary(n/3)  + ternary(n%3);
}

ll dfs(ll n_i, string ter, vector<ll> cost, vector<ll> len){
    if(n_i >= n){
        //無から竹は作れない
        if(len[0]*len[1]*len[2] == 0){
            return INF;
        }
        //合成魔法は使う本数−１*10のコストがかかる
        rep(i, 3)cost[i] = 10 * max((ll)0, cost[i]-1);
        ll res = cost[0] + cost[1] + cost[2];

        //合成した後の誤差は延長，短縮魔法を使う
        res += abs(a - len[0]) + abs(b - len[1]) + abs(c - len[2]);
        return res;
    }

    string ter_bit = "012"; 
    ll res = INF;
    //使わない場合
    res = min(res, dfs(n_i+1, ter, cost, len));
    rep(i, 3){
        if(ter[n_i] == ter_bit[i]){
            //合成する場合
            cost[i]++;
            len[i] += l[n_i];
            res = min(res, dfs(n_i+1, ter, cost, len));
        }
    }

    return res;
}

int main(){
    cin >> n >> a >> b >> c;
    
    rep(i, n)cin >> l[i];

    ll ans = INF;
    vector<ll> cost(3, 0), len(3, 0);
    rep(i, pow(3, n)){
        //3進数，０〜２が竹A~Cに対応
        string ter = ternary(i);
        while(ter.size() != n)ter = '0' + ter;
        ans = min(ans, dfs(0, ter, cost, len));
    }

    cout << ans << endl;
}

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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    string A,B,C;
    cin >> A >> B >> C;
    transform(A.begin(), A.end(), A.begin(), ::toupper);
    transform(ALL(B), B.begin(), ::toupper);
    transform(ALL(C), C.begin(), ::toupper);
    string ans;
    ans += A[0];
    ans += B[0];
    ans += C[0];
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

string S;
int sum[100005] ={};

signed main(){
    cin >> S;
    rep(i, S.size()){
        sum[i+1] = sum[i] + (S[i] - '0');
    }

    rep(i, S.size()){
        if(sum[S.size()-i]-sum[i] == S.size()-2*i || sum[S.size()-i]-sum[i] == 0){
            cout << S.size()-i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4108
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define F first
#define S second
#define ld long double
#define rep(i,a,n) for (ll i= (a) ; i < (n); ++i)
#define vi vector<ll>
#define all(v) (v).begin(),(v).end()
#define M_PI 3.14159265358979323846
const ll MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
void solve() {
	ll n, W; cin >> n >> W;

	vi value(n), weight(n);
	ll sum_value = 0;
	for ( int i = 0; i < n; i++) {
		cin >> weight[i] >> value[i];
		sum_value += value[i];
	}
	vi dp(sum_value + 1, INF);
	dp[0] = 0;
	rep(i, 0, n) {

		for (ll v = sum_value - value[i]; v >= 0; v--) {
			dp[v + value[i]] = min(dp[v + value[i]], dp[v] + weight[i]);
		}
	}
	ll ans = 0;
	for (ll i = 0; i <= sum_value; i++) {
		if ( dp[i] <= W )
			ans = max(ans, i);
	}
	//for(auto c:dp) cout<<c<<" ";
	//cout<<endl;
	cout << ans << endl;
}


int main() {

	int t = 1;

	//cin >> t;
	ll k = 1;
	while (t--) {
		//cout << "Case #" << k++ << ": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp  make_pair
#define pb  push_back
#define endl "\n"
#define rep(i,a,n) for(int i=a;i<n;i++)
void solve() {
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s) {
        cout << "Yes" << endl;
        return;
    }

    cout << "No" << endl;
    return;
}
int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    int t;
    // cin >> t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3664
#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int N, Y;
    int x = -1, y = -1, z = -1, k;
    cin >> N >> Y;
    for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                k=N-i-j;
                if (10000*i+5000*j+1000*(N-i-j) == Y && k>=0) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
    cout << x << ' ' << y << ' ' << z << endl;
    return 0;
}


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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	int cnt = 0;
	for(int i = 0; i < 6; i++) {
		if(s.at(i) == '1') {
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

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

int main(void) {
    int A, B, C;
    cin >> A >> B >> C;
    cout << max(0, C-(A-B)) << endl;

    return 0;
}


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

int main(){
  int Width,Height;
  int x,y,r;
  cin >> Width >> Height >> x >> y >> r;
  
  if((x-r)>=0 && (x+r)<=Width && (y-r)>=0 && (y+r)<=Height){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int a, b, t;
  cin >> a >> b >> t;

  cout << (t / a) * b << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int ll

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mp(x,y) make_pair((x),(y))

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

signed main() {
    int N, Q;
    string S;

    cin >> N >> Q >> S;

    vector<int> Ls(Q);
    vector<int> Rs(Q);
    REP(i, Q) {
        cin >> Ls.at(i) >> Rs.at(i);
    }

    // Ss.at(i) = S.at(0) から S.at(i) まで (両端含む) にACが何回現れるか
    vi Ss(N);

    int sum = 0;
    bool prev_is_a = false;
    REP(i, N) {
        char ch = S.at(i);
        if (prev_is_a && ch == 'C') {
            sum += 1;
            Ss.at(i) = sum;
            prev_is_a = false;
        } else if (ch == 'A') {
            prev_is_a = true;
            Ss.at(i) = sum;
        } else {
            prev_is_a = false;
            Ss.at(i) = sum;
        }
    }

    REP(i, Q) {
        int l = Ls.at(i) - 1;
        int r = Rs.at(i) - 1;

        int ans = Ss.at(r) - Ss.at(l);
        cout << ans << endl;
    }


}


Measured memory_bytes: 2176
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
char ss[200010];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    scanf("%s",ss+1);
    int len=strlen(ss+1);
    for(int i=1;i<=len;i++)
    {
    	if(ss[i]=='?')putchar('D');
    	else printf("%c",ss[i]);
    }puts("");
    return 0;
}

Measured memory_bytes: 1820
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N,M;
vector<vector<int>> G;

int ideg[100005];
int odeg[100005];

ll memo[100005];

ll dfs(int u){
    if(memo[u]) return memo[u];

    if(odeg[u]==0){
        return memo[u] = 0;
    }

    ll len = 0;
    for(int v : G[u]){
        len = max(len,dfs(v)+1);
    }
    return memo[u] = len;
}

int main(){
    cin >> N >> M;
    G.resize(N);
    for(int i=0;i<M;i++){
        int x,y; cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        odeg[x]++;
        ideg[y]++;
    }

    ll ans = 0;
    for(int i=0;i<N;i++){
        if(ideg[i]==0){
            ans = max(ans,dfs(i));
        }
    }
    cout << ans << endl;
}

// NOTE: グラフが連結である保証はない


Measured memory_bytes: 11904
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int s, w;
    cin >> s >> w;
    if(s <= w) cout << "unsafe";
    else cout << "safe";
    
    
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <map>
#define N 200005
#define PI pair<int, int>
#define F first
#define S second
using namespace std;

int n, m1, m2, a1[N], a2[N];
map<PI, int> v;
int f(int p) {
	if (a1[p] == p) return p;
	return a1[p] = f(a1[p]);
}

int g(int p) {
	if (a2[p] == p) return p;
	return a2[p] = g(a2[p]);
}

int main()
{
	int i, t1, t2;
	cin >> n >> m1 >> m2;
	for (i = 1; i <= n; i++) a1[i] = i;
	for (i = 1; i <= n; i++) a2[i] = i;
	while (m1--) {
		scanf ("%d %d", &t1, &t2);
		t1 = f(t1);
		t2 = f(t2);
		if (t1 != t2) a1[t1] =t2;
	}
	while (m2--) {
		scanf ("%d %d", &t1, &t2);
		t1 = g(t1);
		t2 = g(t2);
		if (t1 != t2) a2[t1] =t2;
	}
	for (i = 1; i <= n; i++) {
//			printf("%d %d\n", a1[i], a2[i]);
		f(i);
		g(i);
		v[PI(a1[i], a2[i])]++;
	}
	for (i = 1; i <= n; i++) {
		printf("%d ", v[PI(a1[i], a2[i])]);
	}
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	long double x[n];
	string u[n];
	for(int i=0;i<n;i++)cin>>x[i]>>u[i];
	long double res=0;

	for(int i=0;i<n;i++){
		if(u[i]=="JPY"){
			res += x[i];
		}else{
			res += x[i]*380000;
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 256
/*
  AOJ 0594
  Title:Super Metropolis
  @kankichi573
*/

#include <stdio.h>
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))


int W,H,N;
int Sign(int x)
{
  if(x>0)
    return(1);
  if(x==0)
    return(0);
  if(x<0)
    return(-1);
}
int Abs(int x)
{
  return((x>0)?x:(-x));
}
int solve(int x1,int y1,int x2,int y2)
{
  if(Sign(x1-x2)!=Sign(y1-y2))
    return(Abs(x1-x2)+Abs(y1-y2));
  else
    return(Max(Abs(x1-x2),Abs(y1-y2)));
}
main()
{
  int x,y,xold,yold,res,i,ret;

  scanf("%d %d %d",&W,&H,&N);
  scanf("%d %d",&xold,&yold);
  {
    for(i=0,res=0;i<N-1;i++)
      {
	scanf("%d %d",&x,&y);
	ret = solve(xold,yold,x,y);
	//printf("%d %d %d %d =%d\n",xold,yold,x,y,ret);
	res += ret;
	xold=x;
	yold=y;
      }
    printf("%d\n",res);
  }
  return(0);
}

Measured memory_bytes: 596