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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	ll n, k; cin >> n >> k;
	ll ans = 0;

	rep(b, k + 1, n + 1) {
		ll p = n / b, q = n % b;
		ll lv = 0;
		lv += p * (b - k);
		if (q >= k) lv += q - k + 1;
		//cerr << b << " " << lv << endl;
		ans += lv;
	}
	if (k == 0) ans -= n;

	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int g = sc.nextInt();
		int[] p = new int[d];
		int[] c = new int[d];

		for(int i = 0;i < d;i++) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		int minNum = Integer.MAX_VALUE;
		for(int bit = 0;bit < (1 << d);bit++) {
			// bitが立っているp[i]に関して、すべての問題を解くという前提を置く
			int totalScore = 0;
			int tmpNum = 0;
			for(int i = 0;i < d;i++) {
				if(((bit >> i) & 1) == 1) {
					totalScore += ((i + 1) * 100) * p[i] + c[i];
					tmpNum += p[i];
				}
			}
			
			// スコアが足りない場合、bitが立っていないp[i]のうち、スコアが大きいものから一問ずつ解いていく
			if(totalScore < g) {
				for(int i = d - 1;i >= 0;i--) {
					if(((bit >> i) & 1) == 1) continue;
					for(int j = 0;j < p[i] - 1;j++) {
						totalScore += ((i + 1) * 100);
						tmpNum++;
						if(totalScore >= g) break;
					}
					
					if(totalScore >= g) break;
				}
			}
			
			if(totalScore >= g && tmpNum < minNum) minNum = tmpNum;
		}

		System.out.println(minNum);
	}
}

Measured memory_bytes: 23124
/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline char gc(){
	static char buf[1000000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int frd(){
	int x=0,f=1; char ch=gc();
	for (;ch<'0'||ch>'9';ch=gc())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=gc())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline int read(){
	int x=0,f=1; char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline void print(int x){
	if (x<0)	putchar('-'),x=-x;
	if (x>9)	print(x/10);
	putchar(x%10+'0');
}
const int N=1e5;
int v[N+10];
int main(){
	int n=read(),Max=-inf,Min=inf;
	for (int i=1;i<=n;i++){
		v[i]=read();
		Max=max(Max,v[i]);
		Min=min(Min,v[i]);
	}
	if (Max-Min>1)	printf("No\n");
	if (Max==Min)	printf(Max==n-1||Max<=n>>1?"Yes\n":"No\n");
	if (Max==Min+1){
		int cnt=0;
		for (int i=1;i<=n;i++)	if (v[i]==Min)	cnt++;
		n-=cnt,Max-=cnt;
		printf(Max>0&&Max<=n>>1?"Yes\n":"No\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

vll fac(2010);
vll ifac(2010);

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

int main(){
    int N,K;
    cin>>N>>K;
    //青球を入れる場所は(N-K+1)か所
    //操作回数iならば、まず(N-K+1)か所のうちiか所に青球を入れる。iか所の選び方が(N-K+1)C(i)
    //残りの(K-i)個の青球の配置方法が問題。(K-i+i-1)C(K-i)=(K-1)C(K-i)を求める。
    //(N-K+1)C(i) * (K-1)C(K-i) が答え
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<2009; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, MOD-2) % MOD; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    for(int i=1;i<=K;i++){
        cout<<(comb(N-K+1,i)*comb(K-1,K-i))%MOD<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    string s;
    cin >> s;
    cout << s.substr(0,4) << " " << s.substr(4) << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (int r = (aa)-1; r >= (bb); r--)
#define be(x) (x.begin(), x.end())
#define pb(t) push_back(t)
#define ll long long
#define mp(a, b) make_pair(a, b)
int main(){
	ll n ,k, s=0;
	cin>>n>>k;
	vector<ll>A(n);
	rep(i,0,n)cin>>A[i];
	sort be(A);
	rep(i,0,n-k)s+=A[i];
	cout<<s<<"\n";
}



Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

	int a,b,c;
	int x=0,y=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
        if(a*a+b*b==c*c){
            x++;
            //cout<<a<<b<<c<<endl;
        }
        if(a==b){
            y++;
           // cout<<a<<b<<c<<'.'<<endl;
        }
	}
	cout<<x<<endl<<y<<endl;


	return 0;
}

Measured memory_bytes: 1208
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

struct number {
    int length = 0;
    vector<int> A;

    number() : A(10) {}

    void sum(int i) {
        A[i]++;
    }

    int num(int i) {
        return A[i];
    }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M; cin >> N >> M;
    vector<int> F(M);
    rep(i,M) cin >> F[i];

    vector<vector<number>> P(M+1, vector<number>(N+1));
    for (int i = 1; i <= N; i++) P[0][i].length = INF;
    vector<int> A = {-1,2,5,5,4,5,6,3,7,6};
    rep(i,M) {
        rep(j,N+1) {
            P[i+1][j] = P[i][j];
            if (j < A[F[i]]) continue;
            if (P[i+1][j-A[F[i]]].length == INF) continue;
            if (P[i+1][j].length == INF) {
                P[i+1][j] = P[i+1][j-A[F[i]]];
                P[i+1][j].length++;
                P[i+1][j].sum(F[i]);
            } 
            if (P[i+1][j].length < P[i+1][j-A[F[i]]].length + 1) {
                P[i+1][j] = P[i+1][j-A[F[i]]];
                P[i+1][j].length++;
                P[i+1][j].sum(F[i]);
            } else if (P[i+1][j].length == P[i+1][j-A[F[i]]].length + 1) {
                bool check = false;
                for (int k = 9; k >= 1; k--) {
                    if (k == F[i]) {
                        if (P[i+1][j].num(k) < P[i+1][j-A[F[i]]].num(k) + 1) check = true;
                        else if (P[i+1][j].num(k) > P[i+1][j-A[F[i]]].num(k) + 1) break;
                    } else {
                        if (P[i+1][j].num(k) < P[i+1][j-A[F[i]]].num(k)) check = true;
                        else if (P[i+1][j].num(k) > P[i+1][j-A[F[i]]].num(k)) break;
                    }
                }
                if (check) {
                    P[i+1][j] = P[i+1][j-A[F[i]]];
                    P[i+1][j].length++;
                    P[i+1][j].sum(F[i]);
                }
            }
        } 
    }

    string ans = "";
    for (int i = 9; i >= 1; i--) {
        rep(j,P[M][N].num(i)) ans.push_back(char(i + '0'));
    }

    cout << ans << endl;
}

Measured memory_bytes: 8832
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

vector<bool> IsPrime;

void sieve(ll max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(ll i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(ll j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

int main(){
    ll n; cin >> n;
    vll h(0);
    ll c = 1;
    ll p = 2;
    sieve(55556);
    h.emplace_back(p);
    while(c < n){
        p++;
        if(IsPrime[p]){
            if(p%5 == 2){
                h.emplace_back(p);
                c++;
            }else{
                continue;
            }
        }else{
            continue;
        }
    }  
    for(auto x: h){
        prt(x); prt(" ");
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);

int main () {
  int n, m;
  cin >> n >> m;
  set<int> a;
  rep(i,m) {
    a.insert(in());
  }
  
  vll dp(n+5);
  dp[0] = 1;
  rep(i,n) {
    if (!a.count(i+1)) {
      dp[i+1] += dp[i];
      dp[i+1] %= mod;
    }
    if (!a.count(i+2)) {
      dp[i+2] += dp[i];
      dp[i+2] %= mod;
    }
  }

  //showv(dp);
  cout << dp[n] << endl;
  return 0;
}

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

int digitSum(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {
	int N;
	cin >> N;
	int sum = digitSum(N);
	int ans = N % sum;
	if (ans == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N=100005;
LL S;
int z[N],A[N],i,j,k,n,m,d,G;
bool F;
char c;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

bool check(int G)
{
	return S/G&1;
}

void make()
{
	G=1;
	if (!check(G=__gcd(A[1]-1,z[2])))
	{
		d=A[1];
		for (register int i=2;i<n;d=__gcd(d,A[i]),++i)
			if (check(G=__gcd(__gcd(d,A[i]-1),z[i+1])))
			{
				--A[i];
				return;
			}
		if (check(G=__gcd(d,A[n]-1)))
			--A[n];
	}
	else
		--A[1];
}

bool solve()
{
	n=read(),S=-1;
	if (n==1) return 0;
	for (register int i=1;i<=n;++i) A[i]=read(),F^=A[i]&1,S+=A[i];
	if (!(n&1)) return F;
	if (!F) return 1;
	while (1)
	{
		z[n]=A[n];
		bool P=0;
		for (register int i=n-1;i;--i) z[i]=__gcd(z[i+1],A[i]),P|=A[i]==1;
		if (P) return !F;
		make();
		if (!check(G)) return !F;
		S=-1;
		for (register int i=1;i<=n;++i)
			A[i]/=G,S+=A[i];
		F^=1;
	}
}

int main()
{
	puts(solve()?"First":"Second");
	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
string s,t;

int main(){
    cin >> s >> t;
    int mn = 1e9;
    for(int i=0; i<=s.length()-t.length(); i++){
        int curr = 0;
        for(int j=0; j<t.length(); j++){
            if(s[j+i]!=t[j]){
                curr++;
            }
        }
        mn = min(mn,curr);
    }
    cout << mn << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int INF = 100000000;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n){
        cin >> a[i];
    }

    vector<int> b(n);
    REP(i, n){
        b[a[i] - 1] = i + 1;
    }

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

    return 0;
}

Measured memory_bytes: 1664
toInt x = read x :: Int
puts a b = putStrLn $ if a < b then  show a ++ " " ++ show b else show b ++ " " ++ show a

main = do
  s <- getLine
  let [a,b] = map toInt . words $ s
  if a == 0 && b == 0 then return ()
  else do
    puts a b
    main

Measured memory_bytes: 4116
h,w,n = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
def sq(a,b,h,w):
	A,B,X = [a-2,a-1,a],[b-2,b-1,b],[]
	for i in A:
		for j in B:
			if 1<=i<=h-2 and 1<=j<=w-2: X.append((i,j))
	return X
y,ans = [],[0 for i in range(10)]
for i,j in x: y += sq(i,j,h,w)
from collections import Counter
for (i,j),k in Counter(y).most_common(): ans[k]+=1
ans[0] = (h-2)*(w-2)-sum(ans)
for i in ans: print(i)

Measured memory_bytes: 218968
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
c_apple = p[0:x] + q[0:y]
c_apple.sort()
for i in range(len(r)):
    if c_apple[i] < r[i]:
        c_apple[i] = r[i]
    else:
        break
print(sum(c_apple))

Measured memory_bytes: 23328
<?php
fscanf(STDIN,"%d %d %d",$n,$k,$q);
for($i=1;$i<=$q;$i++){
	fscanf(STDIN,"%d",$a);	//正解者
	$arr[$i]=$a;
}
$ac_arr=array_count_values($arr);

//print_r($ac_arr);

//echo $ac_arr[3];

for($j=1;$j<=$n;$j++){
	$atai=$k-($q-$ac_arr[$j]);
	//echo $atai."\r\n";
	if($atai>0){
		echo "Yes";
	}else{
		echo "No";
	}
	if($j<>$n){
		echo "\r\n";
	}
}

/*
for($j=1;$j<=$n;$j++){
	$t_arr[$j]=$k;	//全員に初期point
}

for($k=1;$k<=$q;$k++){	//試合回数
	for($j=1;$j<=$n;$j++){
		if($j<>$arr[$k] && $t_arr[$j]>0){
			$t_arr[$j]=$t_arr[$j]-1;
		}
	}
}

for($j=1;$j<=$n;$j++){
	if($t_arr[$j]>0){
		echo "Yes";
	}else{
		echo "No";
	}
	if($j<>$n){
		echo "\r\n";
	}
}
*/
?>

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;


const int SIZE = 1e2+100;
ll x, ans,mem_ans;

int main(){
    ans = 1;
    cin >> x;
    for(ll i = 2; i <= x; i++){
        mem_ans = i*i;
        while(x >= mem_ans){
            ans = max(mem_ans, ans);
            mem_ans *= i;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
    int a[3];
    int c=0,h=0;
    while(~scanf("%d,%d,%d",&a[0],&a[1],&a[2])){
        if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]) c++;
        if(a[0]==a[1]) h++;
    }
    printf("%d\n%d\n",c,h);
}

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

#define debug(a) cerr << #a << ": " << (a) << '\n';
#define debug_arr(a, n) { cerr << #a << ": "; for(int i = 0; i < n; ++i) cerr << a[i] << " \n"[i == n-1]; }
#define debug_two(a, b) cerr << #a << ": " << (a) << ", " << #b << ": " << (b) << '\n';
#define endl '\n'

int n, m, A, B;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cout << setprecision(20); cout << fixed;
    
    cin >> n >> m >> A >> B;
    for(int i = 0; i < B; ++i) {
        for(int j = 0; j < A; ++j) cout << '1';
        for(int j = 0; j < m - A; ++j) cout << '0';
        cout << endl;
    }
    for(int i = 0; i < n - B; ++i) {
        for(int j = 0; j < A; ++j) cout << '0';
        for(int j = 0; j < m - A; ++j) cout << '1';
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define ll long long
#define MOD 998244353

int main(){
    long double a,b,h,m;
    scanf("%Lf %Lf %Lf %Lf", &a, &b, &h, &m);
    // end input

    long double theta = (h/12.0 - 11*m/720.0) * 2*M_PI;
    long double d2 = a*a + b*b - 2*a*b*cos(theta);
    long double d = sqrt(d2);
    printf("%20.20Lf\n\n", d);

    return 0;
}

Measured memory_bytes: 2484
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n)cout<<a[i]<<'\n'
#define pri3(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



Int n,m,_,x,y,q,key;
string s,sb;
bool ok;

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

  cin>>n; Int a[n]; rep(i,n)cin>>a[i]; sort(a,a+n);
  y=a[0],x=a[n-1]; V(Int) mi,ma; V(Pl) op;
  rer(i,1,n-1){
    if(a[i]<0)ma.eb(a[i]);
    else mi.eb(a[i]);
  }
  for(auto e:ma){
    op.eb(Pl(x,e)); x-=e;
  }
  for(auto e:mi){
    op.eb(Pl(y,e)); y-=e;
  }
  op.eb(x,y);
  pri1(x-y);
  rep(i,n-1){
    prip(op[i]);
  }
}

Measured memory_bytes: 5872
/*input
4 4
1 2
2 3
4 1
3 4
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int cnt[maxn];
bool red[maxn]={1};

int main()
{
	IOS;
	int n,m;
	cin>>n>>m;
	REP(i,n) cnt[i]++;
	while(m--){
		int x,y;
		cin>>x>>y;
		x--;y--;

		if(red[x]) red[y]=1;
		cnt[y]++;
		cnt[x]--;
		if(cnt[x]==0) red[x]=0;
	}
	int ans=0;
	REP(i,n) ans+=red[i];
	cout<<ans<<'\n';
	return 0;
}


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

using namespace std;

const int INF = 1e8;

int solveHor(vector<vector<int>> &state, int k) {
    int n = state.size();
    int m = state[0].size();
    vector<int> cnts(n);
    int ans = 0;
    for (int j = 0; j < m; j++) {
        bool cut = false;
        for (int i = 0; i < n; i++) {
            int v = state[i][j];
            if (v > k) {
                return INF;
            }
            if (cnts[i] + v > k) {
                cut = true;
            }
        }
        if (cut) {
            ans++;
            cnts.assign(n, 0);
        }
        for (int i = 0; i < n; i++) {
            cnts[i] += state[i][j];
        }
    }
    return ans;
}

int go(vector<string> &a, vector<vector<int>> &state, int i, int k) {
    int n = a.size();
    int m = a[0].size();
    if (i == n) {
        return solveHor(state, k);
    }
    vector<int> cur(m, 0);
    int ans = INF;
    for (int j = i; j < n; j++) {
        for (int u = 0; u < m; u++) {
            if (a[j][u] == '1') {
                cur[u]++;
            }
        }
        state.push_back(cur);
        ans = min(ans, go(a, state, j+1, k) + 1);
        state.pop_back();
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<int>> state;
    int ans = go(a, state, 0, k) - 1;
    cout << ans << endl;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s, w[3]={"Sunny", "Cloudy", "Rainy"};
  cin >> s;
  if(s==w[0]) cout << w[1];
  if(s==w[1]) cout << w[2];
  if(s==w[2]) cout << w[0];
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
if N == 1:
    print(1)
    exit()
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)

Measured memory_bytes: 460020
#include <stdio.h>
#include <math.h>
int main(){
    int N,M,Q;
    scanf("%d %d",&N,&M);
    if(M/N<2){
        puts("1");
        return 0;
    }
    Q=(M%N);
    if(Q==0){
        printf("%d\n",M/N);
        return 0;
    }
    else{
        while(M%N!=0 ){
        N+=1;
            if(N>M/2){
                printf("1");
                return 0;
            }
        }
    }
    if(M/N)
    printf("%d\n",M/N);
    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;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
int main()
{
    ios;
    ll n , k ;
    cin >> n >> k  ;
    string s ;
    cin >> s ;
    s[k-1] = s[k-1] + 32 ;
    cout << s << el ;

}


















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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main(){
    int n;
    cin >> n;
    vector<int> ls(n);
    rep(i, n) cin >> ls[i];
    int lmax = *max_element(be(ls));
    int sum = accumulate(be(ls), 0);
    cout << ((sum - lmax*2) > 0 ? "Yes" : "No") << nl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  std::string S;
  std::cin >> S;
  std::cout << (S[0] == S[1] || S[1] == S[2] || S[2] == S[3] ? "Bad" : "Good") << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

typedef long long ll;
#define fi first
#define se second

using namespace std;

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

ll N;
ll A;
ll B;

int main(){
  
  cin>>N;
  cin>>A>>B;
  
  if( N == 1 ){
    if( A == B )puts("1");
    else{      puts("0");}
  }
  else{
    if( A > B ) puts("0");
    else if( A == B ){ puts("1");}
    else{
      printf("%lld\n", 1+(B*(N-1)+A)-(A*(N-1)+B) );      
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<long long int>
#define vi  vector<int>
#define vpi vector<pair<int,int>>
#define prec fixed<<setprecision(12)
#define set(x) __builtin_popcount(x)
#define ffs(x) __builtin_ffs(x)
#define clz(x) __builtin_clz(x)
#define inf 1000000007
#define linf 1000000000000000007
#define a(v) v.begin(),v.end()
void fast(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
}


int main(){
	fast;
    int n,m;
    cin >> n >> m;
    ll sum=0;
    int a;
    for(int i=0;i<m;i++)cin >> a,sum+=a;
    if(sum > n)cout << -1;
    else cout << n-sum;
    
}


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

int main()
{
    int i, j, k, a, b;
    char s[10], t[10], u[10];
    scanf("%s %s %d %d %s", s, t, &a, &b, u);
    if(strcmp(s, u)==0){
        a -= 1;
    }
    if(strcmp(t, u)==0){
        b -= 1;
    }
    printf("%d %d\n", a, b);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(void){
    int A; cin >> A;
    int a, b;
    a = A/100; b = A%100;
    if(a <= 12 && 1 <= a){
        if(b <= 12 && 1 <= b) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" <<endl;
    }
    else{
        if(b <= 12 && 1 <= b) cout << "YYMM" << endl;
        else cout << "NA" <<endl;
    }
}

Measured memory_bytes: 256
from collections import defaultdict
from sys import stdin
def gen_bound(x,B):
	if x < 3: lb = 2
	else: lb = x - 1
	if x > B-2: ub = B-1
	else: ub = x + 1
	return lb,ub+1
def solve():
	count = defaultdict(int)
	ans = [0]*10
	L = map(lambda x:map(int,x.split()),stdin.read().split("\n"))
	H,W,N = L[0]
	for i in xrange(1,N+1):
		xlb,xub = gen_bound(L[i][0],H)
		ylb,yub = gen_bound(L[i][1],W)
		for x in xrange(xlb,xub):
			for y in xrange(ylb,yub):
				count[x+(y<<34)] += 1
	for v in count.itervalues():ans[v] += 1
	ans[0] = (H-2)*(W-2) - sum(ans[1:])
	for c in ans: print c
solve()

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

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

const int INF = 1e9;

int main() {
    string S; cin >> S;
    int N = S.size();
    vector<vector<int>> dp(N + 1, vector<int>(2, INF));
    dp[0][0] = 0;
    for(int i = 0; i < N; ++i) {
        int d = S[i] - '0';
        chmin(dp[i + 1][0], min(dp[i][0], dp[i][1]) + d);
        chmin(dp[i + 1][1], min(dp[i][0] + 1, dp[i][1] - 1) + 10 - d);
    }
    cout << min(dp[N][0], dp[N][1]) << '\n';
    return 0;
}


Measured memory_bytes: 58892
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;

int main() {
	int a;
	int b;
	int i = 1;
	cin >> a >> b;
	while(i < 20){
		if(i*a-i+1 >= b) break;
		i++;
	}
	if(b==1) cout << 0 << endl;
	else cout << i << endl;
}

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

int cmpnum(const void * n1, const void * n2)
{
	if(*(double *)n1 >*(double *)n2)
	{
		return -1;
	}
	else if(*(double *)n1 < *(double *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
}
}

int main(void)
{
	int i,j,n,m;

  scanf("%d%d",&n,&m);

	double a[101]={0};
	double sum=0;

	for(i=1;i<=n;i++){
		scanf("%lf",&a[i]);
		sum+=a[i];
	}

	qsort(a, sizeof(a)/ sizeof(a[0]),sizeof(double),cmpnum);

	if(a[m-1]<sum/(4*m))
		printf("No");
	else
		printf("Yes");

	return 0;
}


Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : April 22 2020 15:43:57 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vi a(n);
    fori(i,n) cin >> a[i];
    sort(all(a));
    reverse(all(a));
    int A = 0,B = 0;
    fori(i,n){
        if(i&1) B += a[i];
        else A += a[i];
    }

    cout << A - B << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
const int MAX=200001;
int fac[MAX],finv[MAX],inv[MAX];
int A[50],P[50];

int saiki(int N,int x){
    if(N==0)return (x<=0?0:1);
    if(x<=(1+A[N-1]))return saiki(N-1,x-1);
    return P[N-1]+1+saiki(N-1,x-2-A[N-1]);
}

signed main(){
    int N,X;cin>>N>>X;
    REP(i,50){
        if(i==0){
            A[i]=P[i]=1;
        }
        else{
            A[i]=2*A[i-1]+3;
            P[i]=2*P[i-1]+1;
        }
    }
    cout<<saiki(N,X)<<endl;
}


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

int seq[1000];
int n,k;
int c[1000][1000];

bool check(void){
  bool f = true;
  for(int i=0;i<k;i++){
    int sum = 0;
    for(int j=0;j<n/2;j++)sum += seq[c[i][j]-1];
    f &= (sum>=n/8)&&(sum<=3*n/8);
  }
  return f;
}

int main(){
  while(scanf(" %d %d ",&n,&k)!=EOF){

    for(int i=0;i<k;i++){
      for(int j=0;j<n/2;j++)scanf(" %d ",&c[i][j]);
    }
    
    for(int i=0;i<n;i++)seq[i] = 1&i;

    while(!check())random_shuffle(seq,seq+n);

    for(int i=0;i<n;i++)printf("%d",seq[i]);
    printf("\n");
  }
}

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

int main(){
    int a,b=1,c=2;
    for(int i=1;i<=3;i++){
        cin>>a;
        if(a==5) c--;
        if(a==7) b--;
    }
    if(b==0 || c==0) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <limits>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int min = numeric_limits<int>::max();
    int max = numeric_limits<int>::min();
    for(int i=0; i<n;i++)
    {
        int tmp;
        cin >> tmp;
        if(tmp < min)
        {
            min = tmp;
        }
        if(tmp > max)
        {
            max = tmp;
        }
    }
    cout << max - min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;

double calcExVal(map<int, double> &_mp, double p) {
	if (_mp[p] != 0) {
		return _mp[p];
	}

	_mp[p] = calcExVal(_mp, p - 1) + p;
	return _mp[p];
}

int main() {
	vector<double> expectValue;
	map<int, double> mp;
	mp[0] = 0;
	mp[1] = 1;

	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		double p;
		cin >> p;
		calcExVal(mp, p);
		expectValue.push_back(mp[p] / (double)p);
	}
	double maxValue = 0;
	double value = 0;
	for (int i = 0; i < N; ++i) {
		value += expectValue[i];
		if (K <= i) {
			value -= expectValue[i - K];
		}
		maxValue = max(maxValue, value);
	}
	
	printf("%.8lf\n", maxValue);

	return 0;
}


Measured memory_bytes: 2552
//https://atcoder.jp/contests/abc164/tasks/abc164_c
#include<bits/stdc++.h>
int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int n ;
  std::cin >> n ;
  std::set<std::string>s;
  for(int i = 0 ; i < n; i++)
  {
    std::string x ;
    std::cin >> x ;
    s.insert(x) ;
  }

  std::cout << s.size() << std::endl ;
}


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

int main()
{
    int n,i,j,sum,ans=0;
    cin>>n;
    int ara[n];
    for(i=0;i<n;i++){
        cin>>ara[i];
    }
    for(i=0;i<n-1;i++){
        sum =0;
        for(j = i+1;j<n;j++){
            sum += ara[j];
        }
        ans += ara[i]*sum;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a,b,x,p,q,c,d;
    int s= -1;
    scanf("%d %d %d",&x, &a ,&b);
    p=(x-a);
    q=(x-b);

    if(p<0 ){
        p=p*(-1);
    }
    else{
        p=p;
    }

    if(q<0 ){
        q=q*(-1);
    }
    else{
        q=q;
    }

    if(p>q){
        printf("B\n");
    }

    if(q>p){
        printf("A\n");
    }


    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

struct data {
  int a, b, c;
  data(int a=0, int b=0, int c=0): a(a), b(b), c(c) {}
};

int main() {
  int N, Ma, Mb;
  cin >> N >> Ma >> Mb;
  vector<data> D(N);
  rep(i, N)
    cin >> D[i].a >> D[i].b >> D[i].c;
  vector<vector<vector<int> > > dp(N+1, vector<vector<int> >(405, vector<int>(405, inf)));
  dp[0][0][0] = 0;
  rep(i, N) {
    int a = D[i].a, b = D[i].b, c = D[i].c;
    rep(j, 405) {
      rep(k, 405) {
        dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
        int an = j + a, bn = k + b;
        if(an < 405 && bn < 405 && dp[i][j][k] < inf)
          dp[i+1][an][bn] = min(dp[i+1][an][bn], dp[i][j][k] + c);
      }
    }
  }
  int ans = inf;
  REP(j, 1, 405)
    REP(k, 1, 405)
      if(j * Mb == k * Ma)
        ans = min(ans, dp[N][j][k]);
  cout << (ans == inf ? -1 : ans) << endl;
  return 0;
}



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

int main() {
  char t;
  cin >> t;
  int a = (int)t;
  if (a >= 'A' && a <= 'Z')
    cout << 'A' << endl;
  else if (a >= 'a' && a <= 'z')
    cout << 'a' << endl;
}


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

class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++){
            list.add(scanner.nextInt());
        }
        scanner.close();
        int count = 0;
        int min = list.get(0);
        for(int i=0; i<list.size(); i++){
            if(list.get(i).compareTo(min)==1){
                continue;
            }
            count += 1;
            min = list.get(i);
        }
        System.out.println(count);
    }
}


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

using namespace std;

/*helpfull*/
using vl  = vector<long long>;
using vpl = vector<pair<long long, long long>>;
using vs = vector<string>;
using pl  = pair<long long, long long>;
using ll  = long long int;
using vb  = vector<bool>;


struct hash_pair {
	template <class T1, class T2>
	size_t operator()(const pair<T1, T2>& p) const
	{
		auto hash1 = hash<T1> {}(p.first);
		auto hash2 = hash<T2> {}(p.second);
		return hash1 ^ hash2;
	}
};
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif

// shortcut macros
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp              make_pair
#define fi              first
#define se              second
// #define mt              make_tuple
#define pb              push_back
#define all(x)          (x).begin(), (x).end()
#define ini(a, v)       memset(a, v, sizeof(a))
#define rep(i, a, n)    for(ll i=a ; i<n ; ++i)
#define For(i, n)       rep(i, 0, n)
#define sz(x)           (int((x).size()))
#define ump(x,y)        unordered_map<x,y>
#define umpr(x,y,z)     unordered_map<x,y,z>
void printcase(ll &x) {
	cout << "Case #" << x << ": ";
}
void read(vector<ll>&v, ll &n) {
	For(i, n)
	cin >> v[i];
}
void read(ll &x) {
	cin >> x;
}
void read(string &s) {
	cin >> s;
}
void read(int &x) {
	cin >> x;
}
void read(ll a[], ll &n) {
	For(i, n)
	cin >> a[i];
}
void print() {
	cout << endl;
}
void write(vector<ll>&v, ll &n) {
	For(i, n)
	cout << v[i] << " ";
	cout << endl;
}
void write(vector<ll>&v) {
	ll n = v.size();
	For(i, n)
	cout << v[i] << " ";
	cout << endl;
}
void write(ll x) {
	cout << x << endl;
}
void write(string &s) {
	cout << s << endl;
}
void write(int &x) {
	cout << x << endl;
}
void write(ll a[], ll &n) {
	For(i, n)
	cout << a[i] << " ";
	cout << endl;
}


const ll inf = 1000001;

struct Query
{
	ll l, r, idx;
};

bool cmp(Query x, Query y)
{
	return x.r < y.r;
}

void update(ll idx, ll val, ll bit[], ll n)
{
	for (; idx <= n; idx += idx & -idx)
		bit[idx] += val;
}

ll query(ll idx, ll bit[], ll n)
{
	ll sum = 0;
	for (; idx > 0; idx -= idx & -idx)
		sum += bit[idx];
	return sum;
}

void printall(vl arr, ll n, Query queries[], ll q)
{
	ll bit[n + 1];
	memset(bit, 0, sizeof(bit));

	ll last_visit[inf];
	memset(last_visit, -1, sizeof(last_visit));

	ll ans[q];
	ll query_counter = 0;
	for (ll i = 0; i < n; i++)
	{
		if (last_visit[arr[i]] != -1)
			update (last_visit[arr[i]] + 1, -1, bit, n);

		last_visit[arr[i]] = i;
		update(i + 1, 1, bit, n);

		while (query_counter < q && queries[query_counter].r == i)
		{
			ans[queries[query_counter].idx] =
			    query(queries[query_counter].r + 1, bit, n) -
			    query(queries[query_counter].l, bit, n);
			query_counter++;
		}
	}

	for (ll i = 0; i < q; i++)
		cout << ans[i] << endl;
}



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	IOS;
	ll n, q;
	cin >> n >> q;
	vl v(n);
	read(v, n);
	Query qu[q];
	For(i, q) {
		cin >> qu[i].l >> qu[i].r;
		qu[i].idx = i;
		--qu[i].l;
		--qu[i].r;
	}
	sort(qu, qu + q, cmp);
	printall(v, n, qu, q);
	return 0;
}



Measured memory_bytes: 38944
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

int main() {
	ll n, ans = 0;
	cin >> n;
	for (ll i = 1; i <= sqrt(n) + 10000; i++)
	{
		if (n <= i)break;
		if ((n - i) % i == 0 and (n - i) / i > i) ans += (n - i) / i;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
D, N = map(int, input().split())
ans = []
if D == 0:
    for i in range(110):
        if i % 100 != 0:
            ans.append(i)
elif D == 1:
    for i in range(100, 10101, 100):
        if i != 10000:
            ans.append(i)
else:
    for i in range(10000, 1010001, 10000):
        if i != 1000000:
            ans.append(i)

print(ans[N - 1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()


void solve(){
  int a, b; cin >> a >> b;
  cout << max({a+b, a-b, a*b}) << '\n';
}

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

Measured memory_bytes: 256
def main():
    from itertools import accumulate as ac
    n = int(input())
    s = input()
    R_list = [0]*n
    G_list = [0]*n
    B_list = [0]*n
    for i, j in enumerate(s):
        if j == "R":
            R_list[i] += 1
        elif j == "G":
            G_list[i] += 1
        else:
            B_list[i] += 1
    R_list = list(ac(R_list[::-1]))[::-1]
    G_list = list(ac(G_list[::-1]))[::-1]
    B_list = list(ac(B_list[::-1]))[::-1]
    RG_list = [0]*n
    RB_list = [0]*n
    GR_list = [0]*n
    GB_list = [0]*n
    BR_list = [0]*n
    BG_list = [0]*n
    for i, j in enumerate(s[:-1]):
        if j == "R":
            RG_list[i] += G_list[i+1]
            RB_list[i] += B_list[i+1]
        elif j == "G":
            GR_list[i] += R_list[i+1]
            GB_list[i] += B_list[i+1]
        else:
            BR_list[i] += R_list[i+1]
            BG_list[i] += G_list[i+1]
    RG_list = list(ac(RG_list[::-1]))[::-1]
    RB_list = list(ac(RB_list[::-1]))[::-1]
    GR_list = list(ac(GR_list[::-1]))[::-1]
    GB_list = list(ac(GB_list[::-1]))[::-1]
    BR_list = list(ac(BR_list[::-1]))[::-1]
    BG_list = list(ac(BG_list[::-1]))[::-1]
    ans = 0
    for i in range(n-1):
        if s[i] == "R":
            ans += GB_list[i+1]
            ans += BG_list[i+1]
        elif s[i] == "G":
            ans += RB_list[i+1]
            ans += BR_list[i+1]
        else:
            ans += RG_list[i+1]
            ans += GR_list[i+1]
    for i in range(n):
        for j in range(i+1, n):
            k = 2*j-i
            if k >= n:
                continue
            else:
                if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
                    ans -= 1
    print(ans)


main()


Measured memory_bytes: 10176
import java.util.*;
public class Main{
	public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
      	int size=sc.nextInt();
      	int k=sc.nextInt();
      	int[]  arr=new int[size];
      	for(int i=0;i<size;i++) arr[i]=sc.nextInt();
      	int[] res=new int[size];
      	res[0]=0;
      	for(int i=1;i<size;i++){
          int mins=Integer.MAX_VALUE;
          	for(int j=i-1;j>=0&&j>=i-k;j--){
            	mins=(int)Math.min(Math.abs(arr[i]-arr[j])+res[j],mins);
            }
        	res[i]=mins;
        	//System.out.println(res[i]);
        }
      System.out.println(res[size-1]);
    }
}

Measured memory_bytes: 48608