akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int X, N, p[SIZE];
  bool f[SIZE] = {};

  cin >> X >> N;

  for (int i = 0; i < N; i++) {
    cin >> p[i];
    f[p[i]] = true;
  }

  for (int i = 0;; i++) {
    if (f[X - i] == false) {
      cout << X - i << endl;
      return 0;
    }
    if (f[X + i] == false) {
      cout << X + i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3824
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		
		var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		int n = input[0];
		int m = input[1];
		var X = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		List<int> kaisa = new List<int>();
		int ans = 0;
		if (n >= m)
		{
			ans=0;
		}
		else
		{
			Array.Sort(X);
            for(var i = 0; i < m - 1; i++)
			{
				kaisa.Add(X[i + 1] - X[i]);
			}
			kaisa.Sort();
            for(var i = 0; i < m - n; i++)
			{
				ans += kaisa[i];
			}

		}

		Console.WriteLine(ans);
	}
}

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

std::string s;
int ans;

int main()
{
	in >> s;
	int l = 0, r = s.length() - 1;
	do
	{
		if (s[l] != s[r])
		{
			if (s[l] != 'x' && s[r] != 'x')
			{
				out << -1 << std::endl;
				return 0;
			}
			++ans;
			if (s[l] == 'x') ++l;
			else if (s[r] == 'x') --r;
		}
		else
		{
			++l; --r;
		}
	} while (l < r);
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 512
/* ITP1_2_A */

import java.io.*;
import java.util.*;

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
    
    BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
    String txt = input.readLine();
    String[] text = txt.split(" ");
    int A = Integer.parseInt(text[0]);
    int B = Integer.parseInt(text[1]);
    if ( A < B ) {
        System.out.println("a < b");
    } else if ( A > B ) {
        System.out.println("a > b");
    } else {
        System.out.println("a == b");
    }
  }
}



Measured memory_bytes: 24188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int ret = 0;
    for(int i = 1;i <= min(N,K);i++) {
        for(int j = 0;j <= i;j++) {
            priority_queue<int,vector<int>,greater<int>> que;
            for(int k = 0;k < j;k++) {
                que.push(vec.at(k));
            }
            for(int k = 0;k < i - j;k++) {
                que.push(vec.at(N - 1 - k));
            }
            for(int k = 0;k < K - i;k++) {
                if(que.empty()) {
                    break;
                }
                int A = que.top();
                if(A < 0) {
                    que.pop();
                }
                else {
                    break;
                }
            }
            int cnt = 0;
            while(!que.empty()) {
                int A = que.top();
                que.pop();
                cnt += A;
            }
            ret = max(ret,cnt);
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,Q = map(int,input().split())

S = [[] for _ in range(N)]

for _ in range(Q):
    q = list(map(int,input().split()))
    if q[0] == 0:
        S[q[1]].append(q[2])
    elif q[0] == 1:
        if S[q[1]]:
            print(S[q[1]][-1])
    else:
        if S[q[1]]:
            S[q[1]].pop()


Measured memory_bytes: 13704
num = input()
pm_cnt = len(num)  - 1

for i in range(2 ** pm_cnt):
  pm = ["-"] * pm_cnt
  for j in range(pm_cnt):
    if ((i >> j) & 1):
      pm[pm_cnt - 1 - j] = "+"

  ans = ""

  for p_n, p_o in zip(num, pm + [""]):
    ans += (p_n + p_o)
  if eval(ans) == 7:
    print(ans + "=7")
    break


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

int main(void){
    long long X;cin>>X;
    for(long long i=0;i<(X/100)+1;i++){
        for(long long j=0;j<(X/101)+1;j++){
            for(long long k=0;k<(X/102)+1;k++){
                for(long long l=0;l<(X/103)+1;l++){
                    for(long long m=0;m<(X/104)+1;m++){
                        for(long long n=0;n<(X/105)+1;n++){
                            if(i*100+j*101+k*102+l*103+m*104+n*105==X){
                                cout<<'1'<<endl;
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    cout<<'0'<<endl;
    return 0;
}

Measured memory_bytes: 3636
S = input()
N = len(S)

def check(s):
    n = len(s)
    res = True
    for i in range(n//2):
        if s[i] != s[n-1-i]:
            res = False
    return res

if not check(S):
    print('No')
    quit()

S1 = S[:(N-1)//2]
if not check(S1):
    print('No')
    quit()

S2 = S[(N+3)//2-1:]
if not check(S2):
    print('No')
    quit()


print('Yes')

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

int main() {
  long N, K, ans = 0;
  cin >> N >> K;
  vector<int> item(N);
  for (int i = 0; i < N; i++) cin >> item.at(i);
  sort(item.begin(), item.end());
  
  for (int j = 0; j < K; j++) {
    ans = ans + item.at(j);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3640
def straight(cards):
    if cards==[1,10,11,12,13]:
        return 1
    else:
        for i in range(1,5):
           if cards[i] != cards[i-1] + 1 :
               return 0
        return 1       

while True:
    try:
        cards = sorted(list(map(int, input().split(','))))
    except:
        break
    if cards.count(cards[1])==4:
        print('four card')
        continue
    elif len(set(cards))==2:
        print('full house')
        continue
    elif straight(cards)==1:
        print('straight')
        continue
    elif cards.count(cards[2])==3:
        print('three card')
        continue
    elif len(set(cards))==3:
        print('two pair')
        continue
    elif len(set(cards))==4:
        print('one pair')
        continue
    else:
        print('null')
        continue


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000007
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 


int main()
{
    int x;
    cin >> x;
    lli ans=0;
    ans+=1000*1LL*(x/500);
    x=x%500;
    ans+=5*1LL*(x/5);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    private static double MAX = 1_000_000_000;
    private static double MIN = 1;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            double[] a_b = Stream.of(sc.nextLine().split(" "))
                    .mapToDouble(Double::parseDouble)
                    .toArray();
            if (a_b.length != 2) {
                throw new IllegalTestCaseException();
            }
            double a = a_b[0];
            double b = a_b[1];
            if (a > MAX || a < MIN || b > MAX || b < MIN) {
                throw new IllegalTestCaseException();
            }
            System.out.printf("%d %d %.8f\n", (int)(a / b), (int)(a % b), a / b);
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Condition is invalid.");
        }
    }
}



Measured memory_bytes: 32332
#include <bits/stdc++.h>
using namespace std;
#define mod ll(1e9+7)
typedef long long ll;

ll fact(ll n){
    if(n==1) return 1;
    return n*fact(n-1)%mod;
}

int main(void){
    int n;
    cin>>n;
    cout<<fact(n)<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

int main()
{
    int x = 0, h = 0, m = 0, s = 0;
    std::cin >> x;
    s = x % 60;
    m = x / 60 % 60;
    h = x / 3600;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

bool cmp(P a, P b) {
    if(a.fi!=b.fi) return a.fi<b.fi;
    else return a.se<b.se;
}

signed main() {
    int n;
    cin >> n;
    V(P) red(n), blue(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        red[i] = P(a, b);
    }
    rep(i, n) {
        int c, d;
        cin >> c >> d;
        blue[i] = P(c, d);
    }
    sort(ALL(red), cmp); sort(ALL(blue), cmp);

    V(bool) done(n, false);
    int res = 0;
    rep(i, n) {
        int mj = 0;
        rep(j, n) {
            if(done[j]) continue;
            if(red[j].fi<blue[i].fi && red[j].se<blue[i].se) {
                if(red[mj].fi<blue[i].fi && red[mj].se<blue[i].se && !done[mj]) {
                    if(red[j].se > red[mj].se) mj = j;
                } else mj = j;
            }
        }
        if(red[mj].fi<blue[i].fi && red[mj].se<blue[i].se && !done[mj]) {
            res++;
            done[mj] = true;
        }
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this;}
  mint& operator++() { x += 1; return *this;}
  mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
  mint& operator--() { x -= 1; return *this;}
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res+=a; }
  mint operator-(const mint a) const { mint res(*this); return res-=a; }
  mint operator*(const mint a) const { mint res(*this); return res*=a; }
  bool operator==(const int n) const { mint a(n); return this->x == a.x; }
  bool operator==(const ll n) const { mint a(n); return this->x == a.x; }
  bool operator!=(const int n) const { mint a(n); return this->x != a.x; }
  bool operator!=(const ll n) const { mint a(n); return this->x != a.x; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { mint res(*this); return res/=a; }
};
istream& operator>>(ostream& is,const mint& m) { return is >> m.x; }
ostream& operator<<(ostream& os,const mint& m) { return os << m.x; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<mint>> dp(n+1,vector<mint>(3,0));
    vector<mint> num(n+1,1);
    rep(i,n) {
        char c = s[i];
        num[i+1] = num[i];
        if(c == 'A') {
            rep(j,3) dp[i+1][j] += dp[i][j];
            dp[i+1][0] += num[i];
        } else if(c == 'B') {
            rep(j,3) dp[i+1][j] += dp[i][j];
            dp[i+1][1] += dp[i][0];
        } else if(c == 'C') {
            rep(j,3) dp[i+1][j] += dp[i][j];
            dp[i+1][2] += dp[i][1];
        } else {
            rep(j,3) dp[i+1][j] += dp[i][j]*3;
            dp[i+1][0] += num[i];
            dp[i+1][1] += dp[i][0];
            dp[i+1][2] += dp[i][1];
            num[i+1] *= 3;
        }
    }
    cout << dp[n][2] << endl;
}


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

double sqr(double x) {
  return x*x;
}

int main() {
  int N;
  cin >> N;
  vector<int> x(N, 0), y(N,0);
  for(int i=0; i<N; ++i) {
    cin >> x[i] >> y[i];
  }
  double S=0;
  int nb=0;
  for(int i=0; i<N; ++i) 
    for(int j=0; j<i; ++j) {
       S+= sqrt( sqr(x[i]-x[j])+sqr(y[i]-y[j]) );
       ++nb;
  }
        cout << setprecision(12) << (S/nb*(N-1)) << endl;
}



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

int main() {
    string str;
    int q;
    cin >> str;
    cin >> q;
    for (int i = 0; i < q; i++) {
        string command;
        cin >> command;
        if (command == "print") {
            int a, b;
            cin >> a >> b;
            cout << str.substr(a, b-a+1) << endl;;
        } else if (command == "reverse") {
            int a, b;
            cin >> a >> b;
            for (int i = 0; i < (b-a+1)/2; i++) {
                char t = str[a+i];
                str[a+i] = str[b-i];
                str[b-i] = t;
            }
        } else  if (command == "replace") {
            int a, b;
            string p;
            cin >> a >> b >> p;
            str = str.replace(a, b-a+1, p);
        }
    }
    return 0;
}


Measured memory_bytes: 3224
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
struct kk
{
	int x,y;
}p[200010];
bool cmp(kk A,kk B)
{
	return A.x<B.x;
}
void swap(int &a,int &b)
{
	int t=a;a=b;b=t;
}
const double pi=acos(-1);
int x[10],y[10],l,r,mid,a[200010],b[200010];
double ans;
int main()
{
	scanf("%d%d%d%d",&x[1],&y[1],&x[2],&y[2]);
	if (x[1]>x[2])
	{
		swap(x[1],x[2]);
		swap(y[1],y[2]);
	}
	int n,i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d%d",&p[i].x,&p[i].y);
	ans=100*(double)(abs(x[1]-x[2])+abs(y[1]-y[2]));
	int minn=min(abs(x[1]-x[2]),abs(y[1]-y[2]))+1;
	sort(p+1,p+n+1,cmp);
	if (p[n].x<x[1]||p[1].x>x[2])
	{
		printf("%.12lf\n",ans);
		return 0;
	}
	p[n+1].x=-1;p[n+1].y=-1;
	int now=1;
	while (p[now].x<x[1]&&now<=n) now++;
	if (x[1]==x[2])
	{
		if (y[1]>y[2]) swap(y[1],y[2]);
		if (p[now].x==x[1]&&p[now].y>y[1]&&p[now].y<y[2])
		{
			ans-=20;
			ans+=pi*10;
		}
		printf("%.12lf\n",ans);
		return 0;
	}
	if (y[1]==y[2])
	{
		bool flag=0;
		while (p[now].x<=x[2]&&now<=n) 
		{
			if (p[now].y==y[1]) 
			{
				flag=1;
				break;
			}
			now++;
		}
		if (flag)
		{
			ans-=20;
			ans+=pi*10;
		}
		printf("%.12lf\n",ans);
		return 0;
	}
	int tot=0,num=0;
	if (y[1]<y[2])
	{
	while (p[now].x<=x[2]&&now<=n) 
	{
	  if (p[now].y>=y[1]&&p[now].y<=y[2]) a[++tot]=p[now].y;
	  now++;
	}
	if (tot>=1) {num=1;b[1]=a[1];}
	for (i=2;i<=tot;i++)
	{
	     l=1;r=num+1;
	     while (l<r)
	     {
	     	int mid=(l+r)/2;
	     	if (b[mid]<a[i]) l=mid+1;
	     	else r=mid;
		 }
		 b[r]=a[i];
		 if (r>num) num=r;
	}
	ans-=num*20;
	ans+=(double)num*pi*5.0;
	if (num==minn) {ans+=pi*5.0;}
	printf("%.12lf\n",ans);
	return 0;
    }
    //y1>y2
    while (p[now].x<=x[2]&&now<=n) 
	{
	  if (p[now].y>=y[2]&&p[now].y<=y[1]) a[++tot]=p[now].y;
	  now++;
	}
	if (tot>=1) {num=1;b[1]=a[1];}
	for (i=2;i<=tot;i++)
	{
	     l=1;r=num+1;
	     while (l<r)
	     {
	     	int mid=(l+r)/2;
	     	if (b[mid]>a[i]) l=mid+1;
	     	else r=mid;
		 }
		 b[r]=a[i];
		 if (r>num) num=r;
	}
	ans-=num*20;
	ans+=(double)num*pi*5.0;
	if (num==minn) {ans+=pi*5.0;}
	printf("%.12lf\n",ans);
	return 0;
}
//LIS

Measured memory_bytes: 3328
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
vector<int> A, B;

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        int a, b; cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
    LL ans = 0;
    ++K;
    while (K) {
        int KK = K-1;
        K &= KK;
        LL tmp = 0;
        for (int i = 0; i < N; ++i) {
            if ((KK|A[i]) == KK)  tmp += B[i];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4356
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                   as M
import           Data.List
import           Data.Maybe
import           Data.Ord
import           Data.Time
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readLine :: Read a => IO [a]
readLine = map (read . BS.unpack) . BS.words <$> BS.getLine

readLines :: Read a => Int -> IO [[a]]
readLines n = replicateM n readLine

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main :: IO ()
main = do
  s <- getLine
  putStrLn $ replicate (length s) 'x'
  return ()


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

using namespace std;

int main(void) {
  int N, i, j;
  
  cin >> N;
  
  vector <int> H;

  for (i = 0; i < N; i++) {
    int h;
    cin >> h;
    H.push_back(h);
  }

  int c, mx;
  
  c = 0;
  mx = 0;
  for (i = 0; i < N; i++) {
    if (mx <= H[i]) {
      c++;
      mx = H[i];
    }
  }
  cout << c << endl;
  return 0;

}


Measured memory_bytes: 256
package main

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

func main() {
	sc := newScanner()
	var x = sc.readInt()
	var y = sc.readInt()
	var z = sc.readInt()
	fmt.Println(z, x, y)

}

//////////////////
//////////////////
//////////////////

func abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func reverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func reverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type scanner struct {
	bufScanner *bufio.Scanner
}

func newScanner() *scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &scanner{bufSc}
}

func (sc *scanner) readString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *scanner) readInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *scanner) readInt64() int64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseInt(text, 10, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(int i=0;i<(int)v.size();i++) cout<<" "<<v[i]; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int l,r,d;
	cin>>l;
	int ct=0;
	for(int i=0;i<l;i++){
		cin>>r;
		if((i+1)%2&&r%2)
			ct++;
	}
	cout<<ct<<endl;
}



Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char ch;
    cin >> ch;
    if ((int)ch >= 65 && (int)ch <= 91)
    {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'a' << endl;
    }

    return 0;
}

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

int dp[512][512][10][3][2];
char start[512], end[512];
char look[512];
int mod;

int min(int a, int b)
{
    return (b > a ? a : b);
}

int memo(int digits, int div, int now, int upd, int same)
{
    int i, j;
    int ans;
    
    if (digits == (int)strlen(look)){
        return (!div);
    }
    
    if (dp[digits][div][now][upd][same] >= 0){
        return (dp[digits][div][now][upd][same]);
    }
    
    ans = 0;
    if (upd == 2){
        if (digits != (int)strlen(look) - 1){
            ans += memo(digits + 1, div * 10 % mod, now, 2, same && (look[digits] - '0') == 0);
            ans %= 10000;
        }
        for (i = now + 1; i <= (same ? look[digits] - '0' : 9); i++){
            ans += memo(digits + 1, (div * 10 + i) % mod, i, 1, same && (look[digits] - '0') == i);
            if (digits != (int)strlen(look) - 1){ // 1-digit number will be same at two status, up and down
                ans += memo(digits + 1, (div * 10 + i) % mod, i, 0, same && (look[digits] - '0') == i);
            }
            ans %= 10000;
        }
    }
    else if (upd == 0){ //increase
        for (i = now + 1; i <= (same ? look[digits] - '0' : 9); i++){
            ans += memo(digits + 1, (div * 10 + i) % mod, i, upd ^ 1, same && (look[digits] - '0') == i);
            ans %= 10000;
        }
    }
    else {              //decrease
        for (i = min(now - 1, same ? look[digits] - '0' : now - 1); i >= 0; i--){
            ans += memo(digits + 1, (div * 10 + i) % mod, i, upd ^ 1, same && (look[digits] - '0') == i);
            ans %= 10000;
        }
    }
    
    return (dp[digits][div][now][upd][same] = ans % 10000);
}

int ZigZag(char *str)
{
    int len = strlen(str);
    int up = 0;
    int i;
    
    if (len == 1){
        return (1);
    }
    if (len == 2){
        return (str[0] != str[1]);
    }
    up = str[0] < str[1];
    for (i = 1; i < strlen(str); i++){
        if (up && str[i] > str[i - 1]){
            up ^= 1;
        }
        else if (!up && str[i] < str[i - 1]){
            up ^= 1;
        }
        else {
            return (0);
        }
    }
    return (1);
}

int main(void)
{
    int first, next;
    
    scanf("%s", start);
    scanf("%s", end);
    scanf("%d", &mod);
    
    memset(dp, -1, sizeof(dp));
    
    sprintf(look, "0%s", start);
    first = memo(0, 0, 0, 2, 1);
    
    memset(dp, -1, sizeof(dp));
    
    sprintf(look, "0%s", end);
    next = memo(0, 0, 0, 2, 1);
    
    printf("%d\n", (next - first + ZigZag(start) + 10000) % 10000);
    
    return (0);
}

Measured memory_bytes: 60000
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,k;
    cin >> a >> b >> k;
    if(a+k-1<b-k+1){
        REP(i,k){
            cout << a+i << endl;
        }
        REP(i,k){
            cout << b-k+1+i << endl;
        }
    }else{
        for(int i=a;i<=b;++i){
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)

#define vi vector<int>
#define pb push_back

typedef long long ll;
using namespace std;


int main(){
    int n,m,p;
    while(cin >> n >> m >> p,n) {
        vi x;
        int tmp;
        int sum = 0;
        rep(i,n){
            cin >> tmp;
            x.pb(tmp);
            sum += tmp;
        }
        if(x[m - 1] == 0) cout << 0 << endl;
        else cout << sum * (100 - p) / x[m - 1] << endl;
    }
    return 0;
}



Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[n-1] - a[0] << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	)

func main() {
	var N int
	fmt.Scan(&N)
	var total float64
	for i:=0; i<N; i++ {
		var x float64
		var y string
		fmt.Scan(&x,&y)
		if y=="JPY" {
			total = total + x
		} else {
			total = total + x*380000.0
		}
	}
	fmt.Println(total)
}




Measured memory_bytes: 512
N = 100000
X = [-1] * (N+1)

k = 2
while k <= N:
    X[k] = 1
    for i in range(k*2, N+1, k):
        X[i] = 0
    while k <= N and X[k] >= 0:
        k += 1
P = [i for i in range(N+1) if X[i] == 1]
Y = [0] * (N+1)

for i in range(3, N+1):
    if X[i] and X[(i+1)//2]:
        Y[i] = Y[i-1] + 1
    else:
        Y[i] = Y[i-1]

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print(Y[r] - Y[l-1])


Measured memory_bytes: 5348
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    double x  = N /1.08;
    int y = x, z;
    bool price = false;
    for(int i = y; i < y + 4; i++){
        int a = i * 1.08;
        if(a == N){
        price = true;
        z = i;
        }
    }
    if(price) cout << z << endl;
    if(price == false) cout << ":(" << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readInt()
    val a = readIntList()

    val col = MutableList(8) { 0 }
    var cnt = 0
    a.forEach { rate ->
        when (rate) {
            in 1..399 -> col[0]++
            in 400..799 -> col[1]++
            in 800..1199 -> col[2]++
            in 1200..1599 -> col[3]++
            in 1600..1999 -> col[4]++
            in 2000..2399 -> col[5]++
            in 2400..2799 -> col[6]++
            in 2800..3199 -> col[7]++
            else -> cnt++
        }
    }

    val min = col.count { it > 0 }
    if (min == 0) {
        print(1)
    } else {
        print(min)
    }
    print(" ")

    println(min + cnt)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)

Measured memory_bytes: 37788
using System;

class D
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int x = h[0], y = h[1];

		if ((x + y) % 3 != 0 || 2 * y < x || y > 2 * x) { Console.WriteLine(0); return; }
		int n = (x + y) / 3, r = x - n;
		Console.WriteLine(ModNcr(n, r, 1000000007));
	}

	static long ModPow(long b, int i, int mod)
	{
		for (var r = 1L; ; b = b * b % mod)
		{
			if (i % 2 > 0) r = r * b % mod;
			if ((i /= 2) < 1) return r;
		}
	}
	static long ModInv(int x, int p) => ModPow(x, p - 2, p);
	static long ModFactorial(int n, int mod) { for (long x = 1, i = 1; ; x = x * ++i % mod) if (i >= n) return x; }
	static long ModNpr(int n, int r, int mod)
	{
		if (n < r) return 0;
		for (long x = 1, i = n - r; ; x = x * ++i % mod) if (i >= n) return x;
	}
	static long ModNcr(int n, int r, int p) => n < r ? 0 : n - r < r ? ModNcr(n, n - r, p) : ModNpr(n, r, p) * ModInv((int)ModFactorial(r, p), p) % p;
}


Measured memory_bytes: 13140
/*

*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define MAXIN 300000
//#define gc() (SS==TT&&(TT=(SS=IN)+fread(IN,1,MAXIN,stdin),SS==TT)?EOF:*SS++)
#define mod 1000000007
#define Mod(x) x>=mod&&(x-=mod)
typedef long long LL;
const int N=5005;

int Enum,H[N],nxt[N<<1],to[N<<1],f[N][N],sz[N],g[N];
char IN[MAXIN],*SS=IN,*TT=IN;

inline int read()
{
	int now=0;register char c=gc();
	for(;!isdigit(c);c=gc());
	for(;isdigit(c);now=now*10+c-'0',c=gc());
	return now;
}
inline void AE(int u,int v)
{
	to[++Enum]=v, nxt[Enum]=H[u], H[u]=Enum;
	to[++Enum]=u, nxt[Enum]=H[v], H[v]=Enum;
}
void DFS(int x,int fa)
{
	static int tmp[N];

	sz[x]=1;
	int *fx=f[x]; fx[1]=1;
	for(int i=H[x],v; i; i=nxt[i])
		if((v=to[i])!=fa)
		{
			DFS(v,x);
			for(int j=0; j<=sz[x]; ++j)
				for(int k=0; k<=sz[v]; ++k)
					tmp[j+k]+=1ll*fx[j]*f[v][k]%mod, Mod(tmp[j+k]);
			for(int j=0,l=sz[x]+sz[v]; j<=l; ++j)
				fx[j]=tmp[j], tmp[j]=0;
			sz[x]+=sz[v];
		}
	LL t=0;
	for(int i=1; i<=sz[x]; ++i) t+=mod-1ll*fx[i]*g[i]%mod;
	f[x][0]=t%mod;
}

int main()
{
	int n=read();
	for(int i=1; i<n; ++i) AE(read(),read());
	g[0]=1;
	for(int i=2; i<=n; i+=2) g[i]=1ll*g[i-2]*(i-1)%mod;
	DFS(1,1), printf("%d\n",mod-f[1][0]);

	return 0;
}

Measured memory_bytes: 97920
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <cstdio>
using namespace std;

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using vvvll = V<V<V<ll>>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vvpll = V<vpll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<char>;
using vvch = V<vch>;
using dqll = deque<ll>;
using vdqll = V<dqll>;
using pqll = priority_queue<ll>;
using vpqll = V<pqll>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin() 
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define ba back()
#define fr front()
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,n) substr(a,n)
#define cfs(a) cout<<fixed<<setprecision(a) //
/*vvll v(n,vll(m)) n行m列  continue
A.erase(A.begin()+i); 配列Aのi番目を消せる
std::binary_search(v.bgn,v.en,a); 二分探索
abs(a,b)   pow(a,n)  to_string  stoll
auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aとなる初のv[i]
v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる
lower upper  co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi
vvll v(100001,vll(0)); v[a].pb(b); v[b].pb(a);
pqll pq; pq.push(ai); pq.top(); pq.pop();
priority_queue<ll,vll,greater<ll>> pqg; 昇順
vdqll dq(3);  dq[0].pb(1); dq[0].pb(2); dq[0].pf(0);
dq[0].fr→0 dq[0].ba→1 dq[0].pof; dq[0].fr→1
que.sz while(!que.empty())
ll a=1,b=2,c=4,xo; xo=a^b^c; if(a^b^c==0)co(xo)→7(miss) if(xo==0)co(xo)→なし
a<<b→a*2^b a>>b→a/2^b
rep(i,1<<10)rep(j,10)if((i>>j)&1)→iの二進で1となる桁のjのみ 
*/

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll pow_mod(ll a,ll n,ll mod){
  ll res=1;        //n=k_2  pow(a,k_2)
  for(;n>0;n/=2){  //ex,pow(a,1011_2)=a^8*a^2*a^1
    if(n%2==1)res=(res*a)%mod;
    a=(a*a)%mod;
  }
  return res;
}
ll digit_sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0)break;
  }
  return m;
}
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}

int main(){
  ll a,b;
  cin>>a;
  b=pow(a,3);
  co(b);
}
  

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

#define all(v) v.begin(), v.end()
using in = int64_t;
#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 Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

vector<in> divisor(in n){
  vector<in> a={};
  for(in i=1;i*i<=n;i++){
    if(n%i==0){
      a.push_back(i);
      if(i*i!=n)
        a.push_back(n/i);
    }
  }
  sort(all(a));
  return (a);
}

bool judge(in n,in k){
  if(k==1) return false;
  if(n<k) return (n==1);
  if(n%k==0)
    return judge(n/k,k);
  return (n%k)==1;
}

int main(){
  in n;
  cin>>n;
  vector<in> ans = divisor(n-1);
  
  //ans.push_back(1);
  vector<in>  div_n = divisor(n);
  for(in i : div_n){
    if(judge(n,i))
      ans.push_back(i);
  }
  
  cout<<ans.size()-1<<endl;

  /*rep(i,ans.size()){
    cout<<ans.at(i)<<endl;
  }*/
}

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

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define FIN freopen("entrada.in", "r", stdin);
#define FOUT freopen("saida.sol", "w", stdout);

#define ull unsigned long long
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define MAX int(1e6+4)

const int INF = 0x3f3f3f3f;
using namespace std;

int main() {

    IO
    int x, y;
    cin >> x >> y;
    for (int i = 0; i <= x; i++) {
        int b = x - i;
        if ((2 * i + 4 * b) == y) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";

    return 0;
}

Measured memory_bytes: 3640
N = int(input())
S = input()


def calculate(S):
    SSS = []

    totalENum = S.count("E")

    for index, value in enumerate(S):
        if index == 0:
            obj = {}
            if value == "W":
                obj.__setitem__("W", 1)
                obj.__setitem__("E", 0)
            else:
                obj.__setitem__("E", 1)
                obj.__setitem__("W", 0)
            SSS.append(obj)
        else:
            obj = {}
            prevW = SSS[index - 1].__getitem__("W")
            prevE = SSS[index - 1].__getitem__("E")
            if value == "W":
                obj.__setitem__("W", prevW + 1)
                obj.__setitem__("E", prevE)
            else:
                obj.__setitem__("E", prevE + 1)
                obj.__setitem__("W", prevW)

            SSS.append(obj)

    resVal = len(S)
    for index,value in enumerate(S):
        if value == "W":
            resVal = min(resVal,SSS[index].__getitem__("W") - 1 + totalENum - SSS[index].__getitem__("E"))
        else:
            resVal = min(resVal, SSS[index].__getitem__("W") + totalENum - SSS[index].__getitem__("E"))

    return resVal


result = calculate(S)

print(result)


Measured memory_bytes: 104524
module type Comparable = sig
  type t
  val compare : t -> t -> int
end

module Make(Cmp : Comparable) = struct
  type tree = Nil | Node of Cmp.t * tree * tree

  let create () = Nil

  let insert x t =
    let rec doit = function
      | Nil -> Node (x, Nil, Nil)
      | (Node (y, _, _)) as d when x = y -> d
      | Node (y, l, r) when Cmp.compare x y < 0 -> Node (y, doit l, r)
      | Node (y, l, r) -> Node (y, l, doit r)
    in
    doit t

  let preorder f t =
    let rec doit = function
      | Nil -> ()
      | Node (x, l, r) -> (f x; doit l; doit r)
    in
    doit t

  let inorder f t =
    let rec doit = function
      | Nil -> ()
      | Node (x, l, r) -> (doit l; f x; doit r)
    in
    doit t
end

module T = Make(struct type t = int let compare x y = x - y end)

let print t =
  let f e = print_string " "; print_int e in
  T.inorder f t;
  print_newline ();
  T.preorder f t;
  print_newline ()

let () =
  let m = read_int () in
  let rec read i t =
    if i < m then begin
      let op = Scanf.scanf "%s " (fun i -> i) in
      if op = "print" then (print t; read (i + 1) t)
      else
        let k = Scanf.scanf "%d " (fun i -> i) in
        read (i + 1) (T.insert k t)
    end
  in
  read 0 (T.create ())

Measured memory_bytes: 31976
n = io.read('*n')
a = {}
for i = 1, n do a[i] = io.read('*n') end

max = -1
max_idx = {}
cnt = {}
for i = 1, n do
    if a[i] > max then
        max = a[i]
        max_idx[a[i]] = i
    end
    cnt[a[i]] = (cnt[a[i]] or 0) + 1
end

cnt_sorted = {}
for val, count in pairs(cnt) do
    cnt_sorted[#cnt_sorted + 1] = { val, count }
end
table.sort(cnt_sorted, function (a, b) return a[1] > b[1] end)

ans = {}
for i = 1, n do ans[i] = 0 end
accum, total = 0, 0
next_idx, next_ans = -1, 0
for i = 1, #cnt_sorted do
    local val, count = cnt_sorted[i][1], cnt_sorted[i][2]
    if max_idx[val] ~= nil then
        if next_idx ~= -1 then
            ans[next_idx] = accum - val * total - next_ans
            next_ans = accum - val * total
        end
        next_idx = max_idx[val]
    end
    accum = accum + val * count
    total = total + count
end
ans[next_idx] = accum - next_ans

for i = 1, n do print(ans[i]) end


Measured memory_bytes: 33364
A,B,C = map(int,input().split())
if A==B==C:
  if A%2:
    print(0)
  else:
    print(-1)
else:
  ans = 0
  while True:
    if A%2 or B%2 or C%2:
      break
    else:
      A,B,C = (B+C)//2,(A+C)//2,(A+B)//2
      ans += 1
  print(ans)

Measured memory_bytes: 3064
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int h,w,n;
  cin >> h >> w >> n;
  if(n%max(h,w) == 0) cout << n/max(h,w) << endl;
  else cout << n/max(h,w)+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#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;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)


const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;

int main() 
{

    fast();
    

    // #ifndef ONLINE_JUDGE
    //         freopen("input.txt", "r", stdin);
    //         freopen("output.txt","w",stdout);
    // #endif
    ll a,b,c;
    cin>>a>>b>>c;
    a-=b;
    if(c-a<0)
    {
        cout<<0;
    }
    else
        cout<<c-a;



    

        
    







  


    
    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int b[n];
  for(int i = 0;i< n;i++)
  {
    cin >> a[i]>>b[i];
  
  }
  bool x = false;
  for(int i = 0;i+2< n;i++)
  {
    if(a[i] == b[i]&& a[i + 1] == b[i+1] && a[i + 2] == b[i + 2])
    {
      x = true;
      break;
    }
  }
  if(x == false)
  {
    cout << "No" << endl;
  }
  else if(x == true)
  {
    cout << "Yes" << endl;
  }
}


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

using namespace std;

int n, m, x, y;
vector<int> Rank(100001, 0);
vector<int> parent(100001, 0);

int find(int x);
bool isSame(int x, int y);
void unite(int x, int y);


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

    vector<int> p(n+1, 0);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &p[i]);
    }
    
    for (int i = 1; i <= n; i++ ) {
        parent[i] = i;
    }

    for (int i = 0; i < m; i++) {
        scanf("%d %d", &x, &y);
        
        if (!isSame(x, y)) 
            unite(x, y);
    }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (isSame(i, p[i]))
                ans++;
    }

    cout << ans << '\n';


}


int find(int x) {
    if (x == parent[x]) return x;
    else {
        return parent[x] = find(parent[x]);
    }
}

bool isSame(int x, int y) {
    return find(x) == find(y);
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y) return;

    if (Rank[x] < Rank[y]) {
        parent[x] = y;
    } 
    else {
        parent[y] = x;
        if (Rank[x] == Rank[y]) 
            Rank[x]++;
    }
}


Measured memory_bytes: 1408
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            List<string> hash = new List<string>(){"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
            List<string> stringList = new List<string>();
            var valuesList = cin.ReadLine.ToCharArray();
            
            
            for (int i = 0; i<valuesList.Length; i++){
                stringList.Add(valuesList[i].ToString());
            }
            
            var ans = hash.Except(stringList);
            
            WriteLine(ans.Count() > 0? ans.OrderBy(value => value).First(): "None");
            
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 18144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N,M;
  cin >> N >> M;
  vector<int> A(2*M);
  for(int i=0;i<2*M;i++){
  	cin >> A.at(i);
  }
  vector<int> B(N);
  for(int i=1;i<N+1;i++){
    int count=0;
  	for(int j=0;j<2*M;j++){
      if(A.at(j)==i){
      	count++;
      }
    }
    B.at(i-1)=count;
  }
  for(int i=0;i<N;i++){
  	cout << B.at(i) << endl;
  }
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  char a;
  cin>>a;
  if(islower(a))puts("a");
  else puts("A");

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int A, B;
    cin >> A >> B;
    cout << max(A-B*2, 0) << endl;
    return 0;
}




Measured memory_bytes: 256