akhauriyash/Code-Regression huggingface dataset:
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#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())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,M;
    R(N,M);
    VPII pp;
    REP(i,N){
        int x;R(x);
        pp.PB({x,1});
    }
    REP(i,M){
        int B,C;
        R(B,C);
        pp.PB({C,B});
    }
    sort(ALL(pp),greater<PII>());
    LL an=0;
    int r=N;
    REP(i,SZ(pp)){
        int v=min(r,pp[i].S);
        r-=v;
        an+=v*(LL)pp[i].F;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 2420
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}

int main() {
    string S;
    int odd1 = 0, odd2 = 0;
    
    cin >> S;
    
    for (auto i : S) {
        if (i == '1')
            odd2++;
        else
            odd1++;
        swap(odd1, odd2);
    }
    
    if (odd1 > S.length() / 2)
    odd1 = S.length() - odd1;
    if (odd2 > S.length() / 2)
    odd2 = S.length() - odd2;

    cout << min(odd1, odd2) << endl;
    
    return 0;
}




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

#define INF (INT64_MAX)
#define MOD (1000000000+7)
#define MAX 100000

string s;

int dp[MAX];
int pcnt;
int gcnt;

int main() {
	cin >> s;

	int sz = s.size();
	int ans = 0;
	for( int i = 0; i < sz; i++ ) {
		if( s[i] == 'g' ) {
			if( pcnt < gcnt ) {
				pcnt++;
				ans++;
			}
			else {
				gcnt++;
			}
		}
		else {
			if( pcnt < gcnt ) {
				pcnt++;
			}
			else {
				gcnt++;
				ans--;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int N;
    cin >> N;
    int max=0;
    int total=0;

    for( int ni = 0 ; ni < N ; ni++ ){
        int val;
        cin >> val;
        total = total + val;
        if(max < val){
            max = val;
        }
    }

    cout << total - max/2;
    

}

Measured memory_bytes: 256
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード(アルファベット順,bits/stdc++.hは使わない派閥)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    A[0]=-1;
    vector<ll> answer(N,0);

    for(int i=1; i<N; i++){
        cin>>A[i];
        answer[A[i]-1]++;
    }

    for(auto num : answer)
        cout<<num<<endl;



    return 0;
}


Measured memory_bytes: 6420
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int h;
        static int w;

        static void Main(string[] args)
        {
            //[summary]B - Grid Compression
            var line = ReadLine();
            h = line[0];
            w = line[1];
            //マス目の状態を取得
            var grid = GetGrid().ToList();

            //白いマス目だけの行がないかチェック
            var whiteRow = CheckAllWhiteRow(grid).ToList();

            //白いマス目だけの列がないかチェック
            var whiteCol = CheckAllWhiteColumn(grid).ToList();

            //縦横いずれかに黒いマス目を含んだ行,列のみを出力
            for(int i = 0; i < h; i++)
            {
                if (!whiteRow.Contains(i))
                {
                    string s = "";

                    for (int j = 0; j < w; j++)
                    {
                        if (!whiteCol.Contains(j))
                        {
                            s += grid[i][j];
                        }
                    }

                    Console.WriteLine(s);
                }                
            }
        }

        static IEnumerable<int> CheckAllWhiteRow(List<List<char>> grid)
        {
            for(int i = 0; i < h; i++)
            {
                bool isAllWhite = true;

                for(int j = 0; j < w; j++)
                {
                    if (grid[i][j] == '#')
                    {
                        isAllWhite = false;
                        break;
                    }
                }

                if (isAllWhite)
                {
                    yield return i;
                }
            }
        }

        static IEnumerable<int> CheckAllWhiteColumn(List<List<char>> grid)
        {
            for (int j = 0; j < w; j++)
            {
                bool isAllWhite = true;

                for (int i = 0; i < h; i++)
                {
                    if (grid[i][j] == '#')
                    {
                        isAllWhite = false;
                        break;
                    }
                }

                if (isAllWhite)
                {
                    yield return j;
                }
            }
        }

        static IEnumerable<List<char>> GetGrid()
        {
            for(int i = 0; i < h; i++)
            {
                var array = Console.ReadLine().ToCharArray();
                yield return array.ToList();
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();

            foreach (var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
}

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

N = int(input())
A = list(map(int, input().split()))
s = sum(A)

if s%(N*(N+1)//2)!=0:
    print('NO')
    exit()

k = s//(N*(N+1)//2)
B = [A[(i+1)%N]-A[i] for i in range(N)]
B = list(map(lambda x: x-k, B))
cnt = 0

for Bi in B:
    if Bi>0 or Bi%N!=0:
        print('NO')
        exit()
        
    cnt += (-Bi)//N

if cnt==k:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 97076
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vpii vab(n);
		for(int i=0;i<n;i++)
		{
			scanf("%d%d", &vab[i].second, &vab[i].first);
		}
		sort(vab.begin(), vab.end());

		ll t=0;
		int ans=1;
		for(auto mab:vab)
		{
			t+=mab.second;
			if(t>mab.first)
			{
				ans=0;
				break;
			}
		}
		printf("%s\n", ans?"Yes":"No");
	}
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll d, t, s;
  cin >> d >> t >> s;
  if(t*s>=d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#define MAXN 100100
int cmp(const int* a, const int* b) {
	return *a - *b;
}
int main(void) {
	static int a[MAXN];
	static int cnt[MAXN];
	static long long map[MAXN];
	int i, n, pos = 0;
	int x = -1, y = -1;
	scanf("%d", &n);
	for(i = 0; i < n; i++) scanf("%d", &a[i]);
	qsort(a, n, sizeof(int), cmp);
	for(map[pos] = a[pos], cnt[pos] = i = 1; i < n; i++) {
		if(a[i] == a[i - 1]) cnt[pos]++;
		else {
			pos++;
			map[pos] = a[i];
			cnt[pos] = 1;
		}
	}
	for(int i = n - 1; i >= 0; i--) {
		if(cnt[i] >= 4 && x == -1 && y == -1) {
			x = y = i;
			break;
		}
		if(cnt[i] >= 2 && x != -1) {
			y = i;
			break;
		}
		if(cnt[i] >= 2 && x == -1) {
			x = i;
		}
	}
	if(x == -1 && y == -1) puts("0");
	else printf("%lld\n", map[x] * map[y]);
	return 0;	
}

Measured memory_bytes: 1780
#include<iostream>
using namespace std;
#include<string>
#include<stdio.h>

typedef struct box { int val; string name; box *prev, *next; } box_t;

box_t* init()
{
    box_t* head = new box_t;
    head->val = -1;
    head->name = '\0';
    head->next = NULL;
    head->prev = NULL;
    return head;
}

box_t* make_tail(box_t* head)
{
    box_t* tail = new box_t;
    tail->val = -1;
    tail->name = '\0';
    head->next = tail;
    tail->next = NULL;
    tail->prev = head;
    return tail;
}

box_t* b_insert(box_t* tail, int data, string str)
{
    box_t* box = new box_t;
    box->val = data;
    box->name = str;
    box->prev = tail->prev;
    box->next = tail;
    tail->prev->next = box;
    tail->prev = box;
    return box;
}

int f_delete(box_t* head)
{
    if(!(head->next->next)) return -1;
    box_t* box = head->next;
    head->next = box->next;
    box->next->prev = head;
    delete box;
    return 1;
}

void f_cycle(box_t* head, box_t* tail)
{
    box_t* box1 = head->next;
    box_t* box2 = tail->prev;
    if(box1 == tail || box1 == box2) return;
    box1->next->prev = head;
    head->next = box1->next;
    box2->next = box1;
    box1->prev = box2;
    box1->next = tail;
    tail->prev = box1;
    return;
}

int task(box_t* head, box_t* tail, int t, int q)
{
    box_t* box = head->next;
    if(box->next == tail){
        t = t + box->val;
        cout << box->name;
        printf(" %d\n", t);
        delete box;
        return -1;
    }
    if(box->val > q){
        box->val -= q;
        t = t + q;
        f_cycle(head, tail);
        return t;
    }
    t = t + box->val;
    cout << box->name;
    printf(" %d\n", t);
    f_delete(head);
    return t;
}

int main()
{
    box_t* head = init();
    box_t* tail = make_tail(head);
    int i, n, w, q;
    scanf("%d %d", &n, &q);
    string s;
    for(i = 0; i < n; i++){ cin >> s; scanf("%d", &w); b_insert(tail, w, s); }
    int time = 0;
    do{
        time = task(head, tail, time, q);
    }while(time > 0);
    return 0;
}

Measured memory_bytes: 5932
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Measured memory_bytes: 43436
from numpy import *;i=int32;p=input;q=searchsorted;N=int(p());A,B,c=i(p().split()),i(p().split()),0;
for k in range(1,30):
  a=A%(1<<k);a,b=sort(hstack((a,a-2**k))),B%(1<<k);c+=(sum(q(a,2**k-b)-q(a,2**(k-1)-b)))%2<<k-1
print(c)


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

int main() {
    int a, b; cin >> a >> b;
    string ans = "";
    if (a > 0) {
        ans = "Positive";
    } else if (a <= 0 && 0 <= b) {
        ans = "Zero";
    } else {
        int len = b - a + 1;
        if (len % 2 == 0) ans = "Positive";
        else ans = "Negative";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
x,y = map(int,input().split())
s = (2 * y -x) / 3
t = (2 * x -y) / 3
if s.is_integer() and t.is_integer() and s >= 0 and t >= 0:
    def comb(n, r, mod=10 ** 9 + 7):
        a = 1
        b = 1
        r = min(r, n - r)
        for i in range(r):
            a = a * (n - i) % mod
            b = b * (i + 1) % mod
        return a * pow(b, mod - 2, mod) % mod
    s = int(s)
    t = int(t)
    print(comb(s + t, t, mod=10 ** 9 + 7))
else:
    print(0)

Measured memory_bytes: 38640
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>

using namespace std;

int main(int argc, char **argv){
	int n;
	vector<pair<int, int>> v;
	pair<int, int> p;
	while (cin >> n && n > 0){
		v.clear();
		for (int i = 0; i < n; i++) {
			cin >> p.second >> p.first;
			v.push_back(p);
		}

		sort(v.begin(), v.end());
		int weight = 0;
		int i;
		for (i = 0; i < v.size(); i++) {
			weight += v[i].second;
			if (weight > v[i].first) {
				cout << "No" << endl;
				break;
			}
		}
		if (i == v.size()) {
			cout << "Yes" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include<math.h>
#include <vector>
#include <numeric>

using namespace std;


int main() {

    string S;
    cin >> S;

    int num = 0;
    for (int i = 0; i < S.size(); ++i) {
        string sss = S.substr(i, 1);
        if (sss == "+") {
            ++num;
        } else {
            --num;
        }
    }

    cout << num << endl;
    return 0;
}


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

using namespace std;

int main() {
  int K, N;
  cin >> N >> K;
  
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  
  int best = h[N - 1];
  for (int i = 0; i + K - 1 < N; i++) {
    best = min(best, h[i + K - 1] - h[i]);
  }
  
  cout << best << endl;
  
  return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**5)
def dfs(s, mx):
  if len(s)==N:
    print(s)
  else:
    for i in range(mx+1):
      if i<mx:
        dfs(s+chr(ord('a')+i),mx)
      else:
        dfs(s+chr(ord('a')+i), mx+1)

N = int(input())
dfs("",0)

Measured memory_bytes: 4412
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> ab(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        ab[i] = {a, b};
    }
    vector<pair<ll, ll>> cd(m);
    rep(i, m) {
        int c, d;
        cin >> c >> d;
        cd[i] = {c, d};
    }
    vector<int> ans(n);
    rep(i, n) {
        int dist = 1e9;
        int check_point = -1;
        rep(j, m) {
            int check_dist = abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second);
            if ( dist > check_dist ) {
                check_point = j + 1;
                dist = check_dist;
            }
            ans[i] = check_point;
        }
    }
    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int m1, d1, m2, d2, i1, i2;
	if(scanf("%d", &m1)== 1);
	if(scanf("%d", &d1)== 1);
	if(scanf("%d", &m2)== 1);
	if(scanf("%d", &d2)== 1);
	
	i1 = 1;
	i2 = 0;
	
	if (m1 == 1 ||m1 == 3||m1 == 5 || m1 == 7 ||m1 == 8||m1 == 10||m1 == 12){
		if(d1 == 31){
			printf("%d", i1);
		}else{
			printf("%d", i2);
		}
	}else if(m1 == 4||m1 == 6||m1 == 9|| m1 == 11){
		if(d1 == 30){
			printf("%d", i1);
		}else{
			printf("%d", i2);
		}	
	}else{
		if(d2 == 1){
			printf("%d", i1);
		}else{
			printf("%d", i2);
		}
	}

    return 0;
}

Measured memory_bytes: 128
import sys
readline = sys.stdin.readline
write = sys.stdout.write

from math import pi, sqrt, acos, sin

def solve():
    EPS = 1e-9
    W, H, A, B, C = map(int, readline().split())
    if W == 0:
        return False
    a = sqrt(A / pi); b = sqrt(B / pi)
    mx = max(a, b)
    if 2*mx > min(W, H) - EPS:
        write("impossible\n")
        return True

    def calc(a, b, S):
        EPS = 1e-8
        left = abs(a-b) + EPS; right = a+b - EPS
        while left + EPS < right:
            mid = (left + right) / 2
            s = 0
            #print(a, b, mid, (a**2 + mid**2 - b**2) / (2*a*mid), (b**2 + mid**2 - a**2) / (2*b*mid))
            ta = acos((a**2 + mid**2 - b**2) / (2*a*mid))
            tb = acos((b**2 + mid**2 - a**2) / (2*b*mid))
            s = ((2*ta - sin(2*ta)) * a**2 + (2*tb - sin(2*tb)) * b**2) / 2
            if s < S:
                right = mid
            else:
                left = mid
        return right

    d0 = calc(a, b, C)
    e0 = abs(a - b)
    if e0 - EPS < d0:
        dx = W - a - b
        dy = H - a - b
        d1 = sqrt(dx**2 + dy**2)
        ax = ay = a; bx = a+dx*d0/d1; by = a+dy*d0/d1
        if bx-b < 0:
            ax -= bx-b; bx = b
        if by-b < 0:
            ay -= by-b; by = b
        if d0 < d1:
            write("%.16f %.16f %.16f %.16f %.16f %.16f\n" % (ax, ay, a, bx, by, b))
        else:
            write("impossible\n")
    else:
        write("%.16f %.16f %.16f %.16f %.16f %.16f\n" % (mx, mx, a, mx, mx, b))
    return True
while solve():
    ...


Measured memory_bytes: 5784
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#define pq priority_queue
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;


int main(){
  long long a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k%2==0) cout<<a-b<<endl;
  else cout<<b-a<<endl;
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int K; cin >> K;
    int A[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << A[K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
edges = [[] for i in range(n)]
for i in range(m):
    tx, ty, _tz = list(map(int, input().split()))
    edges[tx-1].append(ty-1) 
    edges[ty-1].append(tx-1) 
visited = [False] * n
ans = 0
for i in range(n):
    if not visited[i]:
        q = [i]
        visited[i] = True
        while q:
            u = q.pop(0)
            for v in edges[u]:
                if not visited[v]:
                    q.append(v)
                    visited[v] = True
        ans += 1
print(ans)


Measured memory_bytes: 27488
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define F       first
#define S       second
#define _READ   freopen("input.txt","r", stdin);
#define _FAST   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
void solve()
{
	string s;
	cin>>s;
	if(s[2]==s[3] && s[5]==s[4])
		cout<<"Yes";
	else
		cout<<"No";
}
int32_t main()
{
    
    int t;
    t=1;
    while(t--)
        solve();
    return 0;
}
/*
===FOR N-Dimensional Vector===
https://codeforces.com/blog/entry/76149
g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined a.cpp -o a -D_GLIBCXX_DEBUG
*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
 
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())

using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
 
int main() {
  int n;cin >> n;
  int d; cin >> d;
  int ans = 0;
  for(int i = 1;i<=n;i++){
      for(int j = 22;j<=d;j++){
          int d1 = j % 10;
          int d10 = j /10;
          if(d1*d10 == i and d1 > 1) ans += 1;
      }
  }
  cout << ans  << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ka = []
for i in range(n):
    ka.append(list(map(int, input().split())))

food = [0] * (m+1)

# print(ka)

for i in range(n):
    for j in range(1,ka[i][0]+1):
        # print(ka[i][j])
        food[ka[i][j]] += 1
    # print("--------")

ans = 0
for _food in food:
    if _food == n:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){
	int n,count;
	
	while(cin>>n,n){
		count=0;
		while(n>1){
			if(n%2==0){
				n=n/2;
			}
			else{
				n=n*3+1;
			}
			count++;
		}
		cout<<count<<endl;
	}
}

Measured memory_bytes: 1160
#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 ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll t,n,i,j,k,l,c,f;
	string s;
	cin>>s;
    i=0;
    ll cnt=0,ans=0;
    for(i=0;i<s.length();i++)
    {
        cnt=0;
        while(s[i]=='R'){cnt++;i++;}
        ans=max(ans,cnt);
    }cout<<ans;
	return 0;
}


Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

int N;
vector<int> D;
vector<bool> use;
int cal(){
	int prev = 0;
	int ret = 24;
	for(int i=1;i<24;++i){
		if( use[i] ){
			int res = min(i-prev,24-i);
			ret = min(ret,res);
			prev = i;
		}
	}
	return ret;
}

int dfs(int pos){
	int ret = 0;
	if( pos == N ){
		return cal();
	}
	int ter = D[pos];
	if( use[ter] == false ){
		use[ter] = true;
		int res = dfs(pos+1);
		ret = max(ret,res);
		use[ter] = false;
	}
	if( use[24-ter] == false ){
		use[24-ter] = true;
		int res = dfs(pos+1);
		ret = max(ret,res);
		use[24-ter] = false;
	}
	return ret;
}
void solve(){
	cin>>N;
	D = vector<int>(N);
	use = vector<bool>(25,false);
	use[0] = true;
	use[24] = true;
	for(int i=0;i<N;++i){
		cin>>D[i];
	}
	int ans = dfs(0);
	cout<< ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define FORE(i,a,b) for (int i=(int)(a);i<=(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REPE(i,n) FOR(i,0,n)

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

int main() {
  int N,D; cin >> N >> D;
  int XS[N][D];
  REP(i,N)REP(j,D) cin >> XS[i][j];

  int ans = 0;
  FOR(i,0,N-1) {
    FOR(j,i+1,N) {
      int total = 0;
      REP(k,D) total += pow(XS[i][k]-XS[j][k],2);
      if (total == pow(floor(sqrt(total)),2)) ans++;
    }
  }

  cout << ans;
  return 0;
}

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

using namespace std;
#define f first
#define s second
#define p pair<int,int>
#define P pair<ll,ll>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define db double
#define zero(a) memset(a,0,sizeof(a))
#define inff(a,n) fill(a,a+n+1,inf)
#define all(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define write(x) printf("%d\n",x)

const int maxn = 1e6;
const ll inf = 1e9;
const int base1 = 31, base2 = 127;

int n, m, cnt, ans, flag = 1, a[maxn];
vector<int>v[maxn];

void dfs(int u, int fa)
{
	for (auto i : v[u])
	{
		if (i == fa)continue;
		if (a[i] == -1)
		{
			a[i] = (a[u] ^ 1);
			dfs(i, u);
		}
		else
		{
			if (a[i] == a[u])flag = 0;
		}
	}
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i<m; i++)
	{
		int x, y;
		cin >> x >> y;
		v[x].pb(y);
		v[y].pb(x);
	}
	memset(a, -1, sizeof(a));
	a[1] = 0;
	dfs(1, 0);
	if (flag)
	{
		for (int i = 1; i <= n; i++)if (a[i])cnt++;
		cout << 1ll * cnt*(n - cnt) - m;
	}
	else
	{
		cout << 1ll * n*(n - 1) / 2 - m;
	}
	return 0;
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,arr[105],mn=INT_MAX,ans;
    cin>>x>>n;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    if(n==0)
        ans = x;
    if(n!=0)
    {
        ans = arr[0]-1;
        mn = abs(arr[0]-x)+1;
    }
    for(int i=1;i<n;i++)
    {
        if(arr[i]-arr[i-1]!=0)
        {
            for(int j=arr[i-1]+1;j<arr[i];j++)
            {
                if(mn>abs(x-j))
                {
                    ans = j;
                    mn = abs(x-j);
                }
            }
        }
    }
    if(n!=0 && mn > abs(arr[n-1]-x)+1)
        ans = arr[n-1]+1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int K = sc.nextInt();
        String S = sc.next();
        
        if(S.length() <= K) {
        	System.out.println(S);
        }else {
        	System.out.println(S.substring(0, K) + "...");
        }
        
        }
	}



Measured memory_bytes: 38624
#include<cstdio>
#include<vector>
using namespace std;
int num;//キャラクタの最大数
vector<int> vec;//キャラクタの格納
int ans;//出力する答え
//
int Input();//入力
void Show();//現在のキャラクタの表示
int Delete();//同じキャラクタが4つ連なったら消滅させる。消滅できなかったら0を返す
int Combo();//コンボさせる。戻り値は残ったキャラクタ数
int Calc();//最高の手順を探す
//
int main(void)
{
	while(Input()){
		printf("%d\n",Calc());
	}
		fflush(stdin);
		getchar();
	return 0;
}
//
int Input()
{
	vec.clear();
	int ibuf;
	scanf("%d",&num);
	if(num!=0){
		for(int f1=0;f1<num;f1++){
			scanf("%d",&ibuf);
			vec.push_back(ibuf);
		}
	}
	else return 0;
	return 1;
}
//
void Show()
{
	printf("Show~\n");
	for(int f1=0;f1<(int)vec.size();f1++){
		printf("%d\n",vec[f1]);
	}
	printf("~Show\n");
}
//
int Delete()
{
	int mem;
	int ret=0;
	for(int f1=0;f1<(int)vec.size()-3;f1++){
		if(vec[f1]==vec[f1+1]&&vec[f1]==vec[f1+2]&&vec[f1]==vec[f1+3]){
			ret=1;
			mem=vec[f1];
			for(int f2=f1;f2<(int)vec.size();f2++){
				if(mem==vec[f2]){
					vec.erase(vec.begin()+f2);
					f2--;
				}
				else{
					break;
				}
			}
		}
	}
	return ret;
}
//
int Combo()
{
	vector<int> mem;
	int ret;
	mem=vec;
	while(Delete());
	ret=vec.size();
	vec=mem;
	return ret;
}
//
int Calc()
{
	vector<int> mem=vec;
	int ret=10001;
	//
	for(int f1=1;f1<(int)vec.size()-1;f1++){
		vec=mem;
		if(vec[f1]!=vec[f1-1]){
			for(int f2=1;f2<=3;f2++){
				vec[f1]=f2;
				int m=Combo();
				ret>m?ret=m:0;
			}
		}
	}
	vec=mem;
	//
	return ret;
}

Measured memory_bytes: 1172
def str_reverse(s, a, b):
    s_new = s[0:a]
    s_rev = s[a:b+1]
    s_rev_len = len(s_rev)
    for i in range(s_rev_len):
        j = s_rev_len - i - 1
        s_new += s_rev[j]
    s_new += s[b+1:]
    return s_new

def str_replace(s, a, b, new):
    s_new = s[0:a]
    s_new += new
    s_new += s[b+1:]
    return s_new


s = input()
n = int(input())
for q in range(n):
    line = input()
    if line.find('print') == 0:
        cmd, a, b  = line.split()
        a = int(a)
        b = int(b)
        print(s[a:b+1])

    elif line.find('reverse') == 0:
        cmd, a, b  = line.split()
        a = int(a)
        b = int(b)
        s = str_reverse(s, a, b)

    elif line.find('replace') == 0:
        cmd, a, b, p  = line.split()
        a = int(a)
        b = int(b)
        s = str_replace(s, a, b, p)

Measured memory_bytes: 7852
#include<bits/stdc++.h>
#include <time.h>
using namespace std;
#include <math.h>
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 200001
 
#define ll long long int
 vector<int> wav;
 int m;vector<int> q;
 //int dp[22][11][1002
 vector<int> a;
 bool solve(int m,int k){
 	int ans=0;
 	for(auto x: a){
 		if(x%m==0){
 			ans+= x/m -1;
 		}
 		else{
 			ans+= x/m;
 		}
 	}
 	return ans<=k;
 }
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		a.push_back(t);
	}
	int l=1;
	int r=1e9;
	while(l<r){
		int mid= (l+r)/2;
		if(solve(mid,k)){
			r=mid;
		}
		else{
			l=mid+1;
		}
		//cout<<l<<" "<<r<<endl;
	}
	cout<<l<<endl;

 
}


Measured memory_bytes: 4284
import sys, os
import collections

MOD = 10 ** 9 + 7


alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def solve(input_stream):
  N = read_int(input_stream)
  S = input_stream.readline().strip()

  ans = ""
  for char in S:
    index = alphabet.find(char)
    ans += alphabet[ (index + N) % len(alphabet)]
  return [ans]

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

Measured memory_bytes: 3316
nn = int(input())
ll = list(map(int,input().split()))

uniqlen = sorted(set(ll),reverse=True)
mydb = [[0]*2 for i in range(len(uniqlen))]
for ind in range(len(uniqlen)):
    mydb[ind][0] = uniqlen[ind]
    mydb[ind][1] = ll.count(uniqlen[ind])

ans = 0

for i in range(len(mydb)):
    for j in range(i+1,len(mydb)):
        for k in range(j+1,len(mydb)):
                if max([mydb[i][0],mydb[j][0],mydb[k][0]])*2 < sum([mydb[i][0],mydb[j][0],mydb[k][0]]):
 #                   print(mydb[i][0],mydb[j][0], mydb[k][0])
                    ans += mydb[i][1]*mydb[j][1]*mydb[k][1]

print(ans)


Measured memory_bytes: 74180
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;

int change(int num){
	if (num == 9) return 1;
	if (num == 1) return 9;
	return num;
}

int main()
{
	int n;
	cin >> n;
	int a = n / 100;
	int b = (n - 100 * a) / 10;
	int c = n - 100 * a - 10 * b;
	int ans = 100 * change(a) + 10 * change(b) + change(c);
	cout << ans << endl;
	return 0;
}

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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int r;
    cin >> r;
    if(r < 1200) cout << "ABC" << endl;
    else if(r < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n; cin>>n;
    if(n==25) cout << "Christmas" << endl;
    if(n==24) cout << "Christmas Eve" << endl;
    if(n==23) cout << "Christmas Eve Eve" << endl;
    if(n==22) cout << "Christmas Eve Eve Eve" << endl;
}

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

int main()
{
    int n;
    cin>>n;
    set<int> s;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.insert(x);
    }
    puts(s.size()==n?"YES":"NO");
}

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

int main()
{
  int n;
  int k;
  int s,t;
  cin>>n;
  while(n!=0){
    s=n+1;
    t=n;
    for(int i=0;i<n;i++){
      cin>>k;
      if(k==0)
	s-=1;
      if(k<2)
	t-=1;
    }
    if(t==0)
      cout<<"NA\n";
    else
      cout<<s<<'\n';
    cin>>n;
  }
  return 0;
}
    


Measured memory_bytes: 3116
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    char[] S = scn.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<>();
    map.put('0', 0);
    map.put('1', 0);
    for (char ch : S) {
      map.put(ch, map.get(ch) + 1);
    }

    int ans = 2 * Math.min(map.get('0'), map.get('1'));
    System.out.println(ans);

  }

}


Measured memory_bytes: 27692
a, b, c = map(int, input().split())

def f(a, b, c):
    if a%2==1 or b%2==1 or c%2==1:
        return 0
    if a==b==c:
        return -1
    return f((b+c)/2, (c+a)/2, (a+b)/2)+1
ans = f(a, b, c)
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n][2];
        for(int i = 0; i < n; i++){
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < n; i++){
            if(arr[i][0] == arr[i][1]){
                count++;
            } else {
               count = 0;
            }
            if(count == 3){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }
}


Measured memory_bytes: 35992
def main():
    n,m=map(int,input().split())
    k = [list(map(int,input().split())) for _ in range(n)]
    f = [0] * m
    for i in k:
        for j in i[1:]:
            f[j-1] += 1
    print(f.count(n))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9056
def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = x*a + y*b
for c_count in range(0, max(x,y)*2 + 2, 2):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

Measured memory_bytes: 3064
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


#include <bits/stdc++.h>
using namespace std;
long long n;
#define PI (double)3.141592653589793238462643383279502884197169399375105820974944


int main() {
	cout<<fixed<<setprecision(16);
    cin>>n;
	cout<<2*PI*n;
    return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    set<int> even;
    set<int> odd;
    set<int> all;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        all.insert(a);
        if(i % 2 == 0)
        {
            even.insert(a);
        }
        else odd.insert(a);
    }
    int ans = 0;
    int count = 0;
    for(int cand : all)
    {
        if(count % 2 == 0 && even.find(cand) == even.end()) ans++;
        else if(count % 2 == 1 && odd.find(cand) == odd.end()) ans++;
        count++;
    }
    cout << ans / 2 << endl;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v;
    int flag=1;
    int j;
    for(int i=0;i<n;i++){
        cin>>j;
        v.push_back(j);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n-1;i++){
        if(v[i]==v[i+1])flag=0;
    }
    if(flag==1)cout<<"YES";
    else cout<<"NO";
    

    return 0;
}


Measured memory_bytes: 1400
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int N, c; bool f; long long val[11], lim[11];
long long solve(long long cur, int d) {
	if (f && d + 1 == c) return 10;
	if (d == c) return 1;
	long long ret = 0;
	for (int i = -9; i <= 9; i++) {
		long long x = cur + val[d] * i;
		if (abs(N - x) <= lim[d + 1]) ret += solve(x, d + 1) * ((d == 0 ? 9 : 10) - abs(i));
	}
	return ret;
}
int main() {
	cin >> N;
	long long ret = 0;
	for (int i = 2; i <= 18; i++) {
		c = (i + 1) / 2; f = (i % 2 == 1);
		int mul = 1;
		for (int j = 0; j < c; j++) {
			string s = to_string(mul); while (s.size() < i) s = '0' + s; reverse(s.begin(), s.end());
			val[j] = stoll(s) - mul;
			mul *= 10;
		}
		for (int j = c - 1; j >= 0; j--) lim[j] = lim[j + 1] + val[j] * 9;
		ret += solve(0, 0);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int d;
int t;
int s;

void input() {
  cin >> d >> t >> s;
}

void solve() {
  string ans = "Yes";

  if (1.0l * d / s > t)
    ans = "No";

  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 3;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {

	int a[10] = {};

	rep(i, 6) {
		cin >> a[i];
	}

	sort(a, a + 5);

	if (a[4] - a[0] > a[5]) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 20160116
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
const int Maxn=100005;
int a[Maxn];
int main(){
	int n;
	scanf("%d",&n);
	int x=1,y=n-1;
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
		x=max(x,a[i]);
		y=min(y,a[i]);
	}
	if (x-y>1){
		printf("No\n");
		return 0;
	}
	if (x==y){
		if (x<=n/2 || x==n-1){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
		return 0;
	}
	int c1=0,c2=0;
	for (int i=0;i<n;i++){
		if (a[i]==x) c1++;
		else c2++;
	}
	if (x>c2 && x<=c2+(c1/2)){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	string a;
	cin >> a;
	int flag = 0;
	for (int i = 0; i < a.length(); i++)
	{
		if (i % 2 == 0)
		{
			if (a[i] != 'h')
				flag = 1;
		}
		else
		{
			if (a[i] != 'i')
				flag = 1;
		}
	}
	if (a.length() % 2 != 0)
		flag = 1;
	if (flag)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

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

const long long MOD = 1e9 + 7;
const int MAX_N = 21;

int n, a[MAX_N][MAX_N];
long long dp[1 << MAX_N];

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

    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];

    dp[0] = 1;
    for (int mask = 1; mask < (1 << n); mask++) {
        int i = __builtin_popcount(mask) - 1;
        int mask2 = mask;
        while (mask2) {
            int j = __builtin_ffs(mask2) - 1;
            if (a[i][j]) dp[mask] += dp[mask ^ 1 << j];
            mask2 &= mask2 - 1;
        }
        dp[mask] %= MOD;
    }

    cout << dp[(1 << n) - 1] << "\n";

    return 0;
}


Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

struct union_find {
    vector<int> par, sz;

    union_find(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i =0; i < n; i++)
            par[i] = i, sz[i] = 0;
    }

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

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

        if (x == y) return ;

        else if (sz[x] < sz[y])
            par[x] = y;
        else {
            par[y] = x;
            if (sz[x] == sz[y])
                sz[x]++;
        }
    }

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

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

ll minimum_spanning_tree(int n, vector<PP> &G) {
    ll ans = 0;
    union_find uf(n);
    sort(G.begin(), G.end());

    for (int i = 0; i < G.size(); i++) {
        int u = G[i].second.first;
        int v = G[i].second.second;
        ll cost = G[i].first;

        if (uf.same(u, v))
            continue;

        else  {
            uf.unite(u, v);
            ans += cost;
        }
    }
    
    return ans;
}

int main() {
    int V, E;   cin >> V >> E;
    vector<PP> G;
    for (int i = 0; i < E; i++) {
        int s, t;   ll w;
        cin >> s >> t >> w;
        G.push_back(PP(w, P(s, t)));
    }

    ll ans = minimum_spanning_tree(V, G);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4928