akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
using namespace std;
int n,i;
int main(){
	int a,out;
	double h,w,to,tn;
	while(cin >> n && n){
		out = 0;
		tn = 100;
		for(i=0;i<n;i++){
			cin >> a >> h >> w;
			h /= 100;
			to = fabs(22-(w/(h*h)));
			if(tn > to) {
				out = a;
				tn = to;
			}
			else if(tn == to && a < out){
				out = a;
				tn = to;
			}
		}
		cout << out << endl;
	}
	return 0;
}

Measured memory_bytes: 0
H, W, K = list(map(int, input().split()))
C = [input() for i in range(H)]

ans = 0
for i in range((1 << H)):
    for j in range((1 << W)):
        black = 0
        for k in range(H):
            for l in range(W):
                if ((i >> k) & 1) == 0 and ((j >> l) & 1) == 0 and C[k][l] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)


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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 1e6 + 7;
const int MX = 1e9 + 7;
const LL INF = 1LL * MX * MX;

int n;
char in[N];
int limit[N];

int check(int v){
	int zeroes = 0, ones = 0, mx = 0;
	for(int i = 1; i <= n; ++i){
		char c = in[i];
		if(c == '0'){
			++zeroes;
		}
		else if(c == '1'){
			++ones;
			mx = max(mx, ones - zeroes);
		}
		else{
			if(zeroes - ones + limit[i] + 1 <= v)
				++zeroes;
			else{
				++ones;
				mx = max(mx, ones - zeroes);
			}
		}
	}
	
	return mx + v;
}

int main(){
	scanf("%s", in + 1);
	n = strlen(in + 1);
	
	int mx = 0;
	for(int i = n; i >= 1; --i){
		limit[i] = mx;
		if(in[i] == '0'){
			++mx;
		}
		else{
			--mx;
			if(mx < 0)
				mx = 0;
		}
	}
	
	int ans = N;	
	int s = mx, e = n;

	while(e - s >= 5){
		int mid = (s + e) / 2;
		int Left = min(check(mid - 1), check(mid));
		int Right = min(check(mid + 1), check(mid + 2));
		ans = min(ans, min(Left, Right));

		if(Left < Right)
			e = mid;
		else
			s = mid + 1;
	}
	
	for(int i = s; i <= e; ++i)
		ans = min(ans, check(i));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8640
#AGC025 A
'''
問題
AとBは自然数とする
AとBの各桁の数の和をSA，SBとする
和がNであるとわかっているとき，SA＋SBの最小値は？

Nは2以上10000以下

考察
最大でもループは10000以下なのでしらみつぶせばよい
'''

N = int(input())

def dsum(n):
	return sum([int(x) for x in list(str(n))])

result = []

for i in range(1,(N//2)+1):
	result.append(dsum(i)+dsum(N-i))

print(min(result))

Measured memory_bytes: 3480
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 1000000007;

vector<int> G[100010];
ll fuhen[100010];
ll arr[100010];

int main(){
	int N, X;
	cin >> N >> X;
	vector<int> S(N);
	for (int i = 0;i < N;i++) {
		cin >> S[i];
	}
	for (int i = 0;i <= X;i++) {
		for (int j = 0;j < N;j++) {
			if (i < S[j]) {
				fuhen[i]++;
			}
			else {
				G[i].push_back(i % S[j]);
			}
		}
	}
	arr[X] = 1;
	for (ll i = 0;i < N;i++) {
		for (int j = 0;j <= X;j++) {
			if (arr[j] == 0)continue;
			for (int x : G[j]) {
				arr[x] += arr[j];
				arr[x] %= MOD;
			}
			if (fuhen[j] > i) arr[j] *= (fuhen[j] - i);
			else arr[j] = 0;
			arr[j] %= MOD;
		}
	}
	ll ans = 0;
	for (ll i = 0;i <= X;i++) {
		ans += arr[i] * i;
		ans %= MOD;
	}
	cout << ans << endl;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int r = n%10;
	if(r == 0 || r == 1 || r == 6 || r == 8) cout << "pon" << endl;
	else if(r == 3) cout << "bon" << endl;
	else cout << "hon" << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int main()
{
    int N; cin >> N;
    vector<int> odd_cnt(100002, 0);
    vector<int> even_cnt(100002, 0);
    int max_cnt1 = 0, max_cnt2 = 0;
    int max_elm1 = 0, max_elm2 = 0;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        A[i] = a;
        if (i % 2 == 0) {
            even_cnt[a]++;
            if (max_cnt1 < even_cnt[a]) {
                max_cnt1 = even_cnt[a];
                max_elm1 = a;
            }
        }
        else {
            odd_cnt[a]++;
            if (max_cnt2 < odd_cnt[a]) {
                max_cnt2 = odd_cnt[a];
                max_elm2 = a;
            }
        }
    }
    bool all_same = true;
    for (int i = 1; i < N; i++) {
        if (A[0] != A[i]) {
            all_same = false;
            break;
        }
    }
    if (all_same) {
        cout << N / 2 << endl;
        exit(0);
    }

    sort(odd_cnt.begin(), odd_cnt.end(), greater<int>());
    sort(even_cnt.begin(), even_cnt.end(), greater<int>());
    if (max_elm1 != max_elm2) {
        cout << N - max_cnt1 - max_cnt2 << endl;
    }
    else {
        cout << min(N - even_cnt[0] - odd_cnt[1], N - even_cnt[1] - odd_cnt[0]) << endl;
    }
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int sum_(int num);

int main() {
    int input;
    int min_sum=9*6;
    cin >> input ;

    int half = int(input/2);
    for (int i = 1; i <= half ; ++i) {
        int a = i;
        int b = input - i;
        int check_sum = sum_(a) + sum_(b);
        if (check_sum < min_sum) {
            min_sum = check_sum;
        }
    }
    string b;
    b = to_string(min_sum);

    std::cout << b << std::endl;
    return 0;
}


int sum_(int num){
    int sum = 0;
    int dig;
    while (num){
        dig = num % 10;
        sum = sum + dig;
        num = int ( num / 10 ) ;
    }
    return sum;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 200;
const int MAXW = 20000;
int T[MAXN][MAXW];

int W,N;
int M[MAXN]; int V[MAXN];



void solve()
{
	for(int i = 1; i <= N; i++)
		for(int j = 1; j<= W; j++)
		{
			if(j<M[i])
				T[i][j] = T[i-1][j];
			else
				T[i][j] = max(T[i-1][j],T[i][j-M[i]]+V[i]);
		}
	cout << T[N][W]<<endl;
}

int main()
{
	
	cin >> N >> W;
	fill(*T,*(T)+W+1,0);
	for(int i = 1; i <= N; i++)
		cin >> V[i] >> M[i];

	solve();
}

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

int main() {
    int R[200000], n;

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

    return 0;
}



Measured memory_bytes: 3868
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class e_2{
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        var z = new int[n];
        var w = new int[n];
        for(int i=0; i<n; i++){
            int[] num = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            z[i] = num[0] + num[1];
            w[i] = num[0] - num[1];
        }
        Console.WriteLine(Math.Max(z.Max() - z.Min(),w.Max() - w.Min()));
    }
}


Measured memory_bytes: 24152
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).ant()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

void solve(){
	int n, k, d;
	cin>>n>>k;
	map<int, int> mp;
	FOR(_, 0, k){
		cin>>d;
		int arr[d];
		FOR(i, 0, d){
			cin>>arr[i];
			mp[arr[i]]++;
		}
	}
	int cnt=0;
	FOR(i, 1, n+1){
		if(mp[i]==0){
			cnt++;
		}
	}
	cout<<cnt<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); 	
	int t=1;
	//cin>>t;
	FOR(i, 1, t+1){		
	//	cout<<"Case #"<<i<<":"<<endl;
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}


Measured memory_bytes: 3656
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        vi a;
        rep(i,n)
        {
            vp(a,x);
        }
        s=0;
        Rep(i,n)
        {
            if(i!=a[i-1])s++;
        }
        if(s<=2) cout<<Y;
        else cout<<N;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    int a, b, c, k; cin >> a >> b >> c >> k;
    int cnt = 0;
    while (b<=a) cnt++, b *= 2;
    while (c<=b) cnt++, c *= 2;
    cout << (cnt<=k? "Yes": "No") << endl;
}


Measured memory_bytes: 3536
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    int N,K,cnt=0,decline=0;
    cin >> N >> K;
    long int A[200001]={0};
    for(int i=0;i<N;i++){
        int x; cin >>x;
        if(A[x] == 0) cnt++;
        A[x]++;
    }
    int k = cnt-K;
    if(k<=0) cout<<0;
    else {
        sort(A,A+200001,greater<int>());
        for(int i=0;i<k;i++){
            decline += A[cnt-1];
            cnt--;
        }
        cout<< decline;
    }
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<30)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;
 
int a[220000];
int ans[220000];
vector<int> dp(220000, INF);

int main() {
    string str1, str2;
    int flag = 1;
    cin >> str1 >> str2;

    for (int i = 0; i < str1.size(); i++) {
        if (str1[i] != str2[i]) flag = 0;
    }

    if (flag) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 3420
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def next_permutation(a):
    n = len(a)
    if n == 0 or n == 1:
        return False
    kFound = False
    for k in reversed(range(n - 1)):
        if a[k] < a[k + 1]:
            kFound = True
            break
    if not kFound:
        return False

    for l in reversed(range(n)):
        if a[k] < a[l]:
            break
    swap(a, k, l)
    return a[:k + 1] + [i for i in reversed(a[k + 1:])]

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
a = []
for i in range(1,n+1):
    a.append(i)
flag = 0
s = 0
t = 0
u = 1
while flag < 2:
    if p == a:
        s = u
        flag += 1
    if q == a:
        t = u
        flag += 1
    a = next_permutation(a)
    u += 1
if s - t >= 0:
    print(s - t)
else:
    print(t - s)


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

int main()
{
    std::vector<std::string> days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
    std::vector<int> next = { 7, 6, 5, 4, 3, 2, 1 };

    std::string s;
    std::cin >> s;

    for (int i = 0; i < days.size(); i++) {
        if (days[i] == s) {
            std::cout << next[i] << std::endl;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
using namespace std;

int main() {
    long long n;
    cin>>n;
    if(n==0){
      cout<<'0';
      return 0;
    }
    vector<long long> num;
    long long i=0;
    while(n!=0){
      if(n%(long long)(pow(2,i+1))==0){
        num.push_back(0);
      }
      else{
        num.push_back(1);
        if(i%2==0)n-=(long long)pow(2,i);
        else n+=(long long)pow(2,i);
      }
      i++;
    }
    reverse(num.begin(),num.end());
    for(long long i=0;i<num.size();i++)cout<<num[i];
    return 0;
}


Measured memory_bytes: 256
<?php
list($s) = strs();
$n = strlen($s);
$cnt = $ans = 0;
for ($i = 0; $i < $n; ++$i) {
    if ($s[$i] === 'g') $cnt++;
    else $cnt--;
}
echo intdiv($cnt, 2);
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
string s,s1="ABC",s2="ARC";

int main(){
	cin>>s;
	if(s==s1)
		cout<<s2;
	else
		cout<<s1;
	
	
	
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  bool b = true;
  if(S.size() % 2 != 0) {b = false;}
  for (int i = 0; i < S.size(); i++) {
    if (S.substr(i,2) != "hi") {
      b = false;
    }
    i = i + 1;
  }
  if (b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int inf = 10000000;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int a[N];
    int ans = 0;
    for(int i = 0; i < N; i++){
      cin >> a[i];
      while(a[i] % 2 == 0){
        a[i] = a[i] / 2;
        ans++;
      }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	string f = "ABC";
	int cntA = 0;
	long long res = 0;
	int n = s.size();

	for (int i = 0; i + 1 < n; i ++) {
		if (s[i] == 'B' and s[i + 1] == 'C') {
			res += cntA;
			i ++;
		}
		else if (s[i] == 'A') cntA ++;
		else cntA = 0;
	}

	cout << res << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    string s,s1,s2;
    scanf("%d",&n);
    cin>>s;
    scanf("%d",&k);
    s1+=s[k-1];
    for(int i=0; i<s.size(); i++) {
        if(s[i]!=s1[0]) {
            s2+="*";
            continue;
        }
        s2+=s[i];
    }
    cout<<s2<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

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

#define INF INT_MAX
#define MOD 1000000007
#define all(x) x.begin(), x.end()

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

    int N; cin >> N;
    string S; cin >> S;

    int len = sqrt(N);

    vvi B(len + 5, vi(26)); vi P(N);
    for(int x = 0; x < N; x++){
        P[x] = x / len;
    }

    for(int x = 0; x < N; x++){
        B[P[x]][S[x] - 'a']++;
    }

    int Q; cin >> Q;
    while(Q--){
        int q; cin >> q;
        if(q == 2){
            int l, r; cin >> l >> r;
            l--, r--;

            vi Cnt(26);
            if(P[l] == P[r]){
                for(; l <= r; l++) Cnt[S[l] - 'a']++;
            }else{
                for(int i = l; P[l] < P[i]+1; l++)
                    Cnt[S[l] - 'a']++;
                for(int i = P[l]; i < P[r]; i++)
                    for(int x = 0; x < 26; x++)
                        Cnt[x] += B[i][x];
                for(int i = r; P[r] > P[i]-1; r--)
                    Cnt[S[r] - 'a']++;
            }

            int ans=  0;
            for(int x = 0; x < 26; x++)
                if(Cnt[x]) ans++;
            cout << ans << endl;
        }else{
            int n; char c; cin >> n >> c;
            n--;
            B[P[n]][S[n] - 'a']--;
            B[P[n]][c - 'a']++;
            S[n] = c; 
        }
    }

    return 0;
}

Measured memory_bytes: 2844
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main()
{
   int A, B, Q;
   cin >> A >> B >> Q;
   vector<long long> s;
   rep(i, A)
   {  
      long long S;
      cin >> S;
      s.push_back(S);
   }
   vector<long long> t;
   rep(i, B)
   {
      long long T;
      cin >> T;
      t.push_back(T);
   }
   vector<long long> x;
   rep(i, Q)
   {
      long long X;
      cin >> X;
      x.push_back(X);
   }
   for(int i = 0; i < Q; i++)
   {
      long long ans = 1e12;
      auto be_spos = lower_bound(s.begin(), s.end(), x[i]) - 1;
      auto be_tpos = lower_bound(t.begin(), t.end(), x[i]) - 1;
      for(int j = 0; j < 2; j++)
      {
         auto spos = be_spos + j;
         for(int k = 0; k < 2; k++)
         {
            auto tpos = be_tpos + k;
            if(s.begin() <= spos && spos < s.begin() + A 
                  && t.begin() <= tpos && tpos < t.end() + B)
            {
               long long  sum1 = abs(*spos - x[i]) + abs(*spos - *tpos);
               long long sum2 = abs(*tpos - x[i]) + abs(*spos - *tpos);
               ans = min({ans, sum1, sum2}); 
            }  
         }
      }
      cout << ans << endl;
   }
   return 0;
}


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

long double pi=3.14159265359;

int main() {
  long double A, B, H, M;
  cin >> A >> B >> H >> M;
  long double Hkakudo=(H*60+M)/2;
  
  long double Mkakudo=M*6;
  
  long double kakudo=max(Mkakudo, Hkakudo)-min(Mkakudo, Hkakudo);
  
  if(kakudo>180) {
    kakudo=360-kakudo;
  }
  
  cout << fixed << setprecision(12) << pow(pow(A,2)+pow(B,2)-2*A*B*cos(kakudo*pi/180), 0.5) << endl;
}

Measured memory_bytes: 4172
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T gcd(T u, T v) {
    ll r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T lcm(T u, T v) {
    return u * v / gcd(u, v);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> AB(N);
    cin >> AB;

    SORT(AB);
    ll ans = 0;
    int index = 0;
    while (M != 0) {
        int c = min(AB[index].second, M);
        M -= c;
        ans += (ll)AB[index].first * c;
        index++;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define MAX_NUM 100000
bool era[MAX_NUM+1]={false};

void makeERA(){
	for(int i=2;i<MAX_NUM;i++){
		if(era[i]==true){
			int x=MAX_NUM/i;
			for(int j=2;j<=x;j++){
				era[i*j]=false;
			}
		}
	}
	era[2]=true;
}

int main(){
	for(int i=0;i<MAX_NUM;i++)era[i]=true;
	era[0]=false;era[1]=false;
	makeERA();
	
	vector<int> prime;
	rep(i,MAX_NUM)if(era[i])prime.pb(i);
	
	int n,a,b;
	while(cin>>n>>a>>b&&(n||a||b)){
		int maxi = -1;
		int x,y;
		rep(i,prime.size()){
			if(prime[i]>n)break;
			int q = prime[i];
			int p = min(q,n/q);
			bool f=false;
			for(int j=p;j>=0;j--){
				if(era[j]){
					p=j;
					f=true;
					break;
				}
			}
			if(!f)continue;
			if((double)p/q>=(double)a/b && p*q>maxi){
				maxi = p*q;
				tie(x,y) = tie(p,q);
			}
		}
		cout<<x<<" "<<y<<endl;
	}
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i)
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
    ~debug() { cerr << endl; }
eni(!=) { cerr << boolalpha << i; ris; }
eni(==) { ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << &", " [ 2 * (it == d.b)] << *it;
  ris << "]";
}
#else
    sim dor(const c&) { ris; }
#endif
};
#define imie(...) "" << #__VA_ARGS__ " = " << (__VA_ARGS__) << ""
#define arr array
using ll = long long;
const int INF = 1e9 + 5;
const int N = 1e6 + 5;

//check if cell co-ordinates are zero
bool check(pair<int,int> p) {
	return p.first == 0 || p.second == 0;
}
//dp[i][j] => max length of LCS at index i in a and index j in b
int main() {
	string a,b;
	cin >> a >> b;
	vector<vector<pair<int,pair<int,int>>>> dp(a.size() + 1,vector<pair<int,pair<int,int>>>(b.size() + 1,{-INF,{0,0}}));
	
	dp[0][0] = {0,{0,0}};
	for(int i = 0; i < (int)a.size(); i++) {
		for(int j = 0; j < (int)b.size(); j++) {
			if(a[i] == b[j]) {
				dp[i+1][j+1] = max(dp[i+1][j+1], make_pair(1 + dp[i][j].first, make_pair(i, j)));
			}
			dp[i+1][j] = max(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i, j)));
			dp[i][j+1] = max(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i, j)));
	  	}
	}

	pair<int,pair<int,int>> ans = {0,{0,0}};
	for(int i = 0; i <= (int)a.size(); i++) {
		for(int j = 0; j <= (int)b.size(); j++) {
			ans = max(ans, make_pair(dp[i][j].first, make_pair(i, j)));
		}
	}
	//debug() << ans;
	
	string s;
	pair<int,int> curr = ans.second;
	while(!check(curr)) {
		int i = curr.first;
		int j = curr.second;
		pair<int,int> previous = dp[i][j].second; //dp[i][j] => the cell from which we reach (i,j)
		if(previous == make_pair(i - 1, j - 1)) {
			//assert(a[i-1] == b[j-1]);
			s += a[i-1];
		}
		curr = previous;
	}

	reverse(s.begin(),s.end());
	cout << s << "\n";

    return 0;
}




Measured memory_bytes: 108792
#define _USE_MATH_DEFINES    
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define quickIO()   {cin.tie(0);    cout.sync_with_stdio(false);}
#define rep(i,n)    for(ll i=0; i<(ll)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define fcout cout << fixed << setprecision(10) 
const ll inf = 1e18;
const ll mod = 1e9 +7;
     
ld sqrtld(ld x){
    ld left = 0, right = x;
    rep(i, 100){
        ld mid = (left + right)/2;
        if (mid*mid <= x)   left =mid;
        else    right = mid;
    }
    return left;
}

ll gcd(ll a, ll b){
    if(b>a){
        ll c =b; b=a;   a=c;
    }
    ll d = a%b;
    if(d==0){
        return b;
    }else if(d==1){
        return 1;
    }else{
        gcd(b,d);
    }
}


ll cul(ll n){
    return (n-1)*n/2;
}


int a[20010];
int main (){
    int n;  cin >> n;
    rep(i,n){
        int p=0;
        cin >> p;
        a[p] = a[p] + i + 1;
    }

    for(int i=1; i<=n; i++){
        cout << 25000 * i + a[i] << " " ;
    }
    cout << endl;
    for(int i=n; i>0; i--){
        cout << 25000 * i  << " " ;
    }
    cout << endl;
    return 0;
}



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

using namespace std;

#define run_forrest_run ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define vi vector <int>
#define sz(a) (int)a.size()
#define fi first
#define se second
#define si set <int>
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);} 

const int inf = 1e9;	
const int mod = inf + 7;

const int N = 205000;
vector <int> g[N];
vector <bool> visited(N);
vector <int> color(N);
int dp[100001];

int main()
{
	run_forrest_run;
	int n,k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i <= k; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (i - a[j] < 0)
				continue;
			if (dp[i-a[j]] == 0)
				dp[i] = 1;
		}
	}
	if (dp[k])
		cout << "First";
	else cout << "Second";
}


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

//#define abs(N) ((N>0)?N:-1*N)
//#define min(A,B) ((A>B)?B:A)
//#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

#define M_PI 3.14159265358979

int main(){
	while(true){
		int n;
		cin >> n;
		if(n==0) break;
		double s[n],sum=0,avg;
		for (int i = 0; i < n; ++i) {
			cin >> s[i];
			sum += s[i];
		}
		avg = sum / n;
		double a2=0;
		for (int i = 0; i < n; ++i) {
			a2 += (s[i]-avg)*(s[i]-avg);
		}

		printf("%.5f\n",sqrt(a2/n));
	}

	return 0;
}



Measured memory_bytes: 3176
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 1001
  
void count(char *X,char *Y){
  int i,j,x[N][N];
  
  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      x[i][j]=0;
    }
  }
  for(i=0; i<strlen(X); i++){
    for(j=0; j<strlen(Y); j++){
      if(X[i]==Y[j])x[i+1][j+1]=x[i][j]+1;
      else if(x[i][j+1]>x[i+1][j]) x[i+1][j+1]=x[i][j+1];
      else x[i+1][j+1]=x[i+1][j];
    }
  }
  printf("%d\n",x[strlen(X)][strlen(Y)]);
}
  
int main(){
  int n,i,j;
  char A[N],B[N];
  scanf("%d",&n);

for(i=0;i<n;i++){
    scanf("%s",A);
    scanf("%s",B);
    count(A,B);
  }
  return 0; 
}



Measured memory_bytes: 5704
#include <cstdio>
#include <stdio.h>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <iostream>
using namespace std;

bool pairCompare(const pair<int, int>& firstElof, const pair<int, int>& secondElof)
{
    if(firstElof.second > secondElof.second) {
        return true;
    } else if(firstElof.second == secondElof.second && firstElof.first < secondElof.first) {
        return true;
    } 
    return false;
}

int main() {
    int N;
    cin >> N;

    vector<pair<int, int> > red(N);
    vector<pair<int, int> > blue(N);

    for(int i = 0; i < N; i++) {
        int first, second;
        scanf(" %d %d", &first, &second);
        pair<int, int> p(first, second);
        red.at(i) = p; 
    }

    for(int i = 0; i < N; i++) {
        int first, second;
        scanf(" %d %d", &first, &second);
        pair<int, int> p(first, second);
        blue.at(i) = p; 
    }

    sort(red.begin(), red.end(), pairCompare);
    sort(blue.begin(), blue.end());

    int count = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < red.size(); j++) {
            if(red.at(j).second < blue.at(i).second && red.at(j).first < blue.at(i).first) {
                count++;
                //printf("red %d, %d\n", red.at(j).first, red.at(j).second);
                //printf("blue %d, %d\n", blue.at(i).first, blue.at(i).second);
                red.erase(red.begin() + j);
                break;
            } 
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
L=list(map(int,input().split()))

import itertools
l=[i for i in range(1,N)]
Arr=list(itertools.combinations(l,K-1)) #Lの中から2個

#print(Arr)

ans=10**12
for i in Arr:
    cost=0
    hight=L[0]
    for j in range(1,N):
        if j in i:
            if hight<L[j]:
                hight=L[j]
            else:
                cost+=(hight-L[j]+1)
                hight+=1
        else:
            hight=max(hight,L[j])
    if ans>cost:
        ans=cost
print(ans)

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

int main()
{
    set<int> s;
    int n,a;
    cin>>n;

    for(int i=0; i<n; i++)
    {
        cin>>a;
        s.insert(a);
    }
    if(n==s.size())
    
        cout<<"YES"<<endl;
    
    else
    
        cout<<"NO"<<endl;
    
    return 0;
}

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

int main(){
  map<string, int> mp;
  string s;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}

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

int main() {
  ll N, M, K;
  cin >> N >> M >> K;
  vector<ll> A(N), B(M);
  for (ll i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (ll i = 0; i < M; ++i) {
    cin >> B[i];
  }
  vector<ll> sum_a(N + 1), sum_b(M + 1);
  for (ll i = 0; i < N; ++i) {
    sum_a[i + 1] = sum_a[i] + A[i];
  }
  for (ll i = 0; i < M; ++i) {
    sum_b[i + 1] = sum_b[i] + B[i];
  }
  ll ans = 0;
  ll idx = M;
  for (ll i = 0; i < N + 1; ++i) {
    if (sum_a[i] > K) {
      break;
    }
    while (sum_a[i] + sum_b[idx] > K) {
      --idx;
    }
    if (sum_a[i] + sum_b[idx] <= K) {
      ans = max(ans, i + idx);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 9468
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

a,b,c=get_i
puts yn_judge(c.between?(a,b))

Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<60)
#define mod 1000000007


int N, a[1001];
signed main(){

	cin >> N;
	for (int i = 2; i <= N; i++){
		int n = i;
		for (int p = 2; p <= N; p++){
			int power = 0;
			while (n%p == 0){ n /= p; power++; }
			a[p] += power;
		}
	}
	int result = 1;
	for (int i = 2; i <= N; i++)
		result = result * (a[i] + 1) % mod;

	cout << result << endl;


	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;
typedef pair<long long, long long> pl;
typedef vector<vector<long long>> matrix;

#define F 						first
#define S 						second
#define PB 						push_back
#define MP 						make_pair
#define all(c) 					c.begin(), c.end()
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define tr(c,i) 				for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) 			(c.find(x) != c.end())	//for set and map
#define cpresent(c,x) 			(find(all(c),x) != c.end())	//for vectors
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon 				1e-9
// #define MOD						(ll)1e9

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

const ll MOD = 1e9+7;

int main() {
	doublade();
	// w(t) {
		ll s;
		cin >> s;
		vl poss(s+1, 0);
		poss[3] = poss[4] = poss[5] = 1, poss[6] = 2;
		f(i, 7, s+1) {
			poss[i] = 1;
			for(ll j=3; j+3<=i; j++) {
				poss[i] += poss[j]%MOD;
				poss[i] %= MOD;
			}
			poss[i] %= MOD;
		}
		cout<<poss[s]<<"\n";
	// }
	return 0;
}

Measured memory_bytes: 3632
N,M = map(int,input().split())
H = list(map(int,input().split()))
route = []
for i in range(M):
    L = list(map(int,input().split()))
    route.append(L)

# route.sort()
good_list = [1 for i in range(N)]
for item in route:
    A = item[0]-1
    B = item[1]-1
    if H[A] > H[B]:
        good_list[B]= 0
    elif H[A] < H[B]:
            good_list[A] = 0
    else:
        good_list[A] = 0
        good_list[B] = 0
# print(good_list)
print(sum(good_list))

Measured memory_bytes: 98548
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        String S = next();
        boolean coffee = S.charAt(2) == S.charAt(3) && S.charAt(4) == S.charAt(5);
        System.out.println(coffee ? "Yes" : "No");
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
ll mod=1e6+3;
void add(ll &x,ll y){
	x+=y;
	x%=mod;
}
ll ex(ll x,ll p){
	ll a=1;
	while(p){
		if(p%2) a=a*x%mod;
		x=x*x%mod;
		p/=2;
	}
	return a;
}
ll inv(ll x){
	return ex(x,mod-2);
}
void solve(int N,int K){
	ll dp[1001][2]={};
	dp[0][0]=1;
	rep(i,N) rep(j,2){
		rep1(k,K){
			if(i+k>N) break;
			add(dp[i+k][1-j],dp[i][j]);
		}
	}
	vector<int> ds;
	rep1(i,N) if(N%i==0) ds.pb(i);
	vector<ll> ans;
	rep(x,ds.size()){
		int d=ds[x];
		ll v=0;
		rep(i,K+1){
			if(d==i){
				if(N<=K) add(v,2);
				break;
			}
			add(v,2*i*dp[d-i][1]);
		}
		rep(y,x){
			if(d%ds[y]==0) add(v,-ans[y]*ds[y]);
		}
		v=v*inv(d)%mod;
		ans.pb(v);
	}
	ll ret=0;
	for(ll x:ans) add(ret,x);
	cout<<(ret+mod)%mod<<endl;
}
int main(){
	while(true){
		int N,K;
		cin>>N>>K;
		if(N==0) break;
		solve(N,K);
	}
}

Measured memory_bytes: 1228
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001; // > 10^9
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

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

  if (m >= n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  } 
  
  return 0;
}




Measured memory_bytes: 768
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || a + c == b || b + c == a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}


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

int max3(int x, int y, int z)
{
  int max = x;
  if (y > max) max = y;
  if (z > max) max = z;
  return max;
}

int min3(int x, int y, int z)
{
  int min = x;
  if (y < min) min = y;
  if (z < min) min = z;
  return min;
}

int main(){
  int a,b,c,k;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  int maxabc=max3(a,b,c);
  int minabc=min3(a,b,c);
  int midabc=a+b+c-maxabc-minabc;
  int ans = 0;
  for(int i=0;i<k;i++){
    maxabc=maxabc*2;
  }
  ans=maxabc+minabc+midabc;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++){
    cin>>a[i];
}
ll sum=a[0];
for(ll i=0;i<n-1;i++){
    sum+=seinomi(a[i+1]-a[i]);
}
cout<<sum<<endl;
return 0;
}










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

#define all(v) (v).begin(), (v).end()
using namespace std;

void simulate(vector <int> &H)
{
    int smallest, smallest_position = H.size();
    for(int i = 0; i < H.size(); i++)
    {
        if(H[i] != 0)
        {
            smallest = H[i];
            smallest_position = i;
            break;
        }
    }

    for(int i = smallest_position + 1; i < H.size(); i++)
    {
        H[i] %= smallest;
    }

    sort(all(H));
}

int main()
{
    int no_of_monsters;
    cin >> no_of_monsters;

    vector <int> health(no_of_monsters, 0);
    for(int i = 0; i < no_of_monsters; i++)
        cin >> health[i];

    sort(all(health));

    while(health[no_of_monsters - 2] > 0)
    {
        simulate(health);
    }

    cout << health[no_of_monsters - 1];
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define qq ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define mid(l,r) l+(r-l)/2
typedef long long int ll;
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
using namespace std; 
int main() 
{
	qq;
	ll n,a,b;
   cin>>n>>a>>b;
   cout<<(min(n*a,b))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;




int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();

    rep(i, n) {
        if (s.at(i) == t.at(i))continue;
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const int MAX_N=2e5+3;


const unsigned long long B=1e12+7;


int main(){
    int X;cin>>X;
    int cnt=X/105+(X%105!=0);
    if((cnt*105-X)<=cnt*5)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


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

int main()
{
	int n_route = 0;
	int t_limit = 0;
	int a, b;
	int i = 0;
	int min_cost = 0x7ffff;
	scanf("%d %d", &n_route, &t_limit);
	for(i = 0; i < n_route; i++) {
		scanf("%d %d", &a, &b);
		if (t_limit < b) {
			continue;
		}
		if (a < min_cost) {
			min_cost = a;
		}
	}
	if (min_cost == 0x7ffff) {
		printf("TLE\n");
	} else {
		printf("%d\n", min_cost);
	}
	return 0;
}


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

int main() {
  string S;
  cin >> S;

  int ans = 0;
  if (S[0] == 'R') ans++;
  if (S[1] == 'R') {
    ans++;
    if (S[2] == 'R') 
    ans++;
  } else if (S[2] == 'R' && ans == 0) ans++;
  cout << ans << endl;  
  return 0;
}

Measured memory_bytes: 3620
using System;

namespace ARC064_D___An_Ordinary_Game
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            Console.WriteLine(((S.Length % 2) == 0) ^ (S[0] == S[S.Length - 1]) ? "Second" : "First");
        }
    }
}


Measured memory_bytes: 11232